mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
✨ feat: Implement MCP Server Management API and UI Components
- Added API endpoints for managing MCP servers: create, read, update, and delete functionalities. - Introduced new UI components for MCP server configuration, including MCPFormPanel and MCPConfig. - Updated existing types and data provider to support MCP operations. - Enhanced the side panel to include MCP server management options. - Refactored related components and hooks for better integration with the new MCP features. - Added tests for the new MCP server API functionalities.
This commit is contained in:
parent
20100e120b
commit
351f30254c
26 changed files with 1189 additions and 290 deletions
|
|
@ -5,6 +5,13 @@ const { CacheKeys } = require('librechat-data-provider');
|
|||
const { requireJwtAuth } = require('~/server/middleware');
|
||||
const { getFlowStateManager } = require('~/config');
|
||||
const { getLogStores } = require('~/cache');
|
||||
const {
|
||||
getMCPServers,
|
||||
getMCPServer,
|
||||
createMCPServer,
|
||||
updateMCPServer,
|
||||
deleteMCPServer,
|
||||
} = require('@librechat/api');
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
|
@ -202,4 +209,44 @@ router.get('/oauth/status/:flowId', async (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Get all MCP servers for the authenticated user
|
||||
* @route GET /api/mcp
|
||||
* @returns {Array} Array of MCP servers
|
||||
*/
|
||||
router.get('/', requireJwtAuth, getMCPServers);
|
||||
|
||||
/**
|
||||
* Get a single MCP server by ID
|
||||
* @route GET /api/mcp/:mcp_id
|
||||
* @param {string} mcp_id - The ID of the MCP server to fetch
|
||||
* @returns {object} MCP server data
|
||||
*/
|
||||
router.get('/:mcp_id', requireJwtAuth, getMCPServer);
|
||||
|
||||
/**
|
||||
* Create a new MCP server
|
||||
* @route POST /api/mcp/add
|
||||
* @param {object} req.body - MCP server data
|
||||
* @returns {object} Created MCP server with populated tools
|
||||
*/
|
||||
router.post('/add', requireJwtAuth, createMCPServer);
|
||||
|
||||
/**
|
||||
* Update an existing MCP server
|
||||
* @route PUT /api/mcp/:mcp_id
|
||||
* @param {string} mcp_id - The ID of the MCP server to update
|
||||
* @param {object} req.body - Updated MCP server data
|
||||
* @returns {object} Updated MCP server with populated tools
|
||||
*/
|
||||
router.put('/:mcp_id', requireJwtAuth, updateMCPServer);
|
||||
|
||||
/**
|
||||
* Delete an MCP server
|
||||
* @route DELETE /api/mcp/:mcp_id
|
||||
* @param {string} mcp_id - The ID of the MCP server to delete
|
||||
* @returns {object} Deletion confirmation
|
||||
*/
|
||||
router.delete('/:mcp_id', requireJwtAuth, deleteMCPServer);
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue