-
Notifications
You must be signed in to change notification settings - Fork 14
feat: Add MCP client integration for external tool consumption #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
esafwan
wants to merge
10
commits into
develop
Choose a base branch
from
feature/mcp-client-integration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,755
−60
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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
70d41c5 to
85da11d
Compare
- 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.
526a21d to
abb2d91
Compare
- 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Update sdk_tools.py to load MCP tools alongside native tools
MCP tools integrate transparently with existing litellm.py provider
Frontend:
Documentation:
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.