feat(mcp): add Model Context Protocol integration
Add MCP integration including: - New MCP settings tab with server configuration - Tool invocation UI components - API endpoints for MCP management - Integration with chat system for tool execution - Example configurations
This commit is contained in:
23
app/routes/api.mcp-update-config.ts
Normal file
23
app/routes/api.mcp-update-config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { type ActionFunctionArgs } from '@remix-run/cloudflare';
|
||||
import { createScopedLogger } from '~/utils/logger';
|
||||
import { MCPService, type MCPConfig } from '~/lib/services/mcpService';
|
||||
|
||||
const logger = createScopedLogger('api.mcp-update-config');
|
||||
|
||||
export async function action({ request }: ActionFunctionArgs) {
|
||||
try {
|
||||
const mcpConfig = (await request.json()) as MCPConfig;
|
||||
|
||||
if (!mcpConfig || typeof mcpConfig !== 'object') {
|
||||
return Response.json({ error: 'Invalid MCP servers configuration' }, { status: 400 });
|
||||
}
|
||||
|
||||
const mcpService = MCPService.getInstance();
|
||||
const serverTools = await mcpService.updateConfig(mcpConfig);
|
||||
|
||||
return Response.json(serverTools);
|
||||
} catch (error) {
|
||||
logger.error('Error updating MCP config:', error);
|
||||
return Response.json({ error: 'Failed to update MCP config' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user