feat: MCP Client plugin (Task 5.17) - integrate external MCP servers for AI agents
- New plugin app/plugins/builtins/mcp_client/ with server config CRUD
- Models: McpServerConfig with TenantMixin (name, url, api_token, enabled)
- Routes: GET/POST/PATCH/DELETE /api/v1/mcp-client/servers
- Routes: GET /servers/{id}/tools, POST /servers/{id}/execute
- client.py: async MCP client using httpx for external server calls
- tool_registry_integration.py: registers external MCP tools in AI tool registry
- Migration: 0001_initial.sql for mcp_server_configs table
- Frontend: mcpClient.ts API client with React Query hooks
- Frontend: MCP Client settings UI in SettingsMcp.tsx (server CRUD, tool viewing)
- Tests: 8 tests covering CRUD, auth, tool registry integration
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"""MCP Client plugin — allows LeoCRM agents to use external MCP servers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from app.plugins.base import BasePlugin
|
||||
from app.plugins.manifest import PluginManifest, PluginRouteDef
|
||||
|
||||
|
||||
class McpClientPlugin(BasePlugin):
|
||||
"""MCP Client plugin: integrates external MCP servers into the AI tool registry."""
|
||||
|
||||
manifest = PluginManifest(
|
||||
name="mcp_client",
|
||||
version="1.0.0",
|
||||
display_name="MCP Client",
|
||||
description="Allows LeoCRM AI agents to use external MCP servers (web search, code execution, etc.).",
|
||||
dependencies=["permissions"],
|
||||
routes=[
|
||||
PluginRouteDef(
|
||||
path="/api/v1/mcp-client",
|
||||
module="app.plugins.builtins.mcp_client.routes",
|
||||
router_attr="router",
|
||||
),
|
||||
],
|
||||
events=[],
|
||||
migrations=["0001_initial.sql"],
|
||||
permissions=[
|
||||
"mcp-client:read",
|
||||
"mcp-client:write",
|
||||
"mcp-client:admin",
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user