317d5c81f8
- 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
33 lines
1023 B
Python
33 lines
1023 B
Python
"""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",
|
|
],
|
|
)
|