Skip to content

Conversation

@esafwan
Copy link
Contributor

@esafwan esafwan commented Dec 31, 2025

  • Add MCP Server DocType for storing connection configs (URL, auth, headers)

  • Add MCP Server Header child table for custom HTTP headers

  • Add Agent MCP Server child table linking agents to MCP servers

  • Update Agent DocType with agent_mcp_server field in Tools and MCP tab

  • Create mcp_client.py adapter module with:

    • create_mcp_tools() for loading MCP tools as FunctionTools
    • execute_mcp_tool() for calling MCP servers
    • sync_mcp_server_tools() for fetching available tools
    • test_mcp_connection() for connectivity testing
    • get_agent_mcp_servers/get_available_mcp_servers APIs
  • Update sdk_tools.py to load MCP tools alongside native tools

  • MCP tools integrate transparently with existing litellm.py provider

Frontend:

  • Update ToolsTab.tsx with real MCP data support and status badges
  • Add mcpApi.ts service for MCP server CRUD operations

Documentation:

  • Add comprehensive MCP Client Integration section to AGENTS.md

HUF now acts as an MCP client, allowing agents to consume tools from external MCP servers (Gmail, GitHub, Slack, databases, etc.) while remaining NOT an MCP server itself.

- Add 'MCP Server' DocType for storing connection configs (URL, auth, headers)
- Add 'MCP Server Header' child table for custom headers
- Add 'Agent MCP Server' child table for linking agents to servers
- Update 'Agent' DocType schema to include MCP servers list
- Add huf/ai/mcp_client.py: Core adapter using litellm.experimental_mcp_client
  - Handles HTTP/SSE connections, Auth, and OpenAI-format tool conversion
- Update SDK tools to discover and load MCP tools alongside native tools
- Implement safe execution wrappers for external tools
- Update ToolsTab.tsx to display connected MCP servers with status badges
- Add sync, toggle, and remove actions for MCP servers
- Add mcpApi.ts service to interface with backend MCP endpoints
- Document MCP architecture, DocTypes, and authentication methods
- Explain tool discovery and execution flows
- Add usage examples for connecting external MCP servers
@esafwan esafwan force-pushed the feature/mcp-client-integration branch from 70d41c5 to 85da11d Compare December 31, 2025 14:27
- Replace experimental 'litellm.load_mcp_tools' with native '_sync_tools_via_http' in 'mcp_client.py' to resolve 'unexpected keyword argument mcp_url' errors caused by recent 'litellm' library updates.
- Update 'execute_mcp_tool' to use '_execute_mcp_tool_http', ensuring stable JSON-RPC 2.0 compliance for tool execution.
- Remove dependency on unstable experimental MCP client signatures, improving reliability when connecting to external Frappe MCP servers.
@Sanjusha-tridz Sanjusha-tridz force-pushed the feature/mcp-client-integration branch from 526a21d to abb2d91 Compare January 6, 2026 11:57
- Update 'tool' field in 'Agent Tool Call' DocType from 'Link' to 'Data'.
- Remove 'options' configuration pointing to 'Agent Tool Function'.
  - Introduced MCP Server Tool child doctype to store individual tool details.
  - Added fields: tool_name, enabled, description, and parameters.
  - This structure will serve as the configuration layer for enabling/disabling specific MCP tools.
  - DocType Update: Added tools Table field to MCP Server pointing to MCP Server Tool.
  - Sync Logic: Updated sync_mcp_server_tools in mcp_client.py to populate the child table instead of just caching JSON.
  - Agent Integration: Modified create_mcp_tools to iterate over the mcp_server.tools child table.
  - Filtering: Implemented checks to skip tools where enabled is false, effectively allowing users to control tool exposure to agents.
  - Added enable_auto_sync and auto_sync_interval fields to MCP Server DocType to configure automated tooling synchronization.
  - Implemented auto_sync_mcp_server_tools in mcp_client.py to check and sync tools based on the configured interval.
  - Registered an hourly scheduler event in hooks.py to trigger the auto-sync check.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants