-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Enhance MCP integration and example #8060
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
base: main
Are you sure you want to change the base?
Conversation
- Implement MCPClient and MCPTool for handling MCP tools - Enhance ReAct class with async_forward method for async tool execution - Update README and example to demonstrate MCP integration and usage
… context management
…move redundant comments
… resource management
…sses, enhancing resource cleanup in MCPServer, and adding JSON schema mapping utility. Introduce example configuration for multiple MCP servers.
…xample configurations for multiple servers, and removing the deprecated MCPReactAgent example. Adjust server configuration paths for consistency.
…nd garbage collection. Update multi-server example for improved clarity and remove unnecessary path setup. Add psutil dependency for better resource monitoring.
…resource management - Added MCPServerManager to manage multiple MCP server connections and provide DSPy-compatible tools. - Introduced Server class for handling individual MCP server connections with robust initialization and cleanup processes. - Integrated logging capabilities for better tracking of server operations and errors. - Updated example scripts to utilize the new MCPServerManager and demonstrate multi-server functionality. - Added support for Airbnb server configuration in the servers_config.json file.
…ion details and usage instructions
@@ -41,10 +41,12 @@ dependencies = [ | |||
"json-repair>=0.30.0", | |||
"tenacity>=8.2.3", | |||
"anyio", | |||
"mcp>=1.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include mcp in the main dependency. Include it in the extra dependency instead
@@ -99,7 +101,7 @@ repository = "https://github.com/stanfordnlp/dspy" | |||
keywords = ["dspy", "ai", "language models", "llm", "openai"] | |||
|
|||
[tool.poetry.dependencies] | |||
python = ">=3.9,<3.13" | |||
python = ">=3.10,<3.13" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change the minimum support Python version
@@ -0,0 +1,127 @@ | |||
# DSPy Model Context Protocol (MCP) Guide |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examples are not actively used. Can we have a documentation page in docs/docs/tutorials?
@ThanabordeeN Thank you for the PR. The maintainer team is discussing how we should support the MCP integration in |
Okay , with pleasure. |
Hi, @ThanabordeeN. Regarding the MCP support in
|
Of course, I am interested in being a part of this development because I have personally benefited from using this tool in research and other personal projects. |
Thank you @ThanabordeeN ! Looking forward to collaborating with you. (+ Thank you @TomeHirata !) |
📝 Changes Description
TLDR; Enhanced DSPy's ReAct with concurrent MCP server support, enabling efficient integration with external APIs (e.g., Airbnb) through asynchronous operations and robust resource management.
This MR/PR introduces significant improvements to DSPy's ReAct framework, enabling concurrent interaction with multiple MCP (Model Context Protocol) servers. Key enhancements include:
mcp_multi_server_example.py
:mcp.py
:async_forward
inreact.py
) for efficient management of multiple server connections.Example Usage
✅ Contributor Checklist