Skip to content

[feature][agent][mcp][bounty-eligible] Support multi-MCP execution and direct model initialization #891

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ascender1729
Copy link

@ascender1729 ascender1729 commented Jun 16, 2025

Description:
This PR enhances Swarms agents by enabling connectivity to multiple MCP (Modular Command Protocol) servers simultaneously, allowing tools to be executed across different microservices. The implementation supports both configuring MCP URLs directly through the agent constructor and via environment variables.

Key Features:

  • Support for multiple MCP servers through mcp_urls parameter or MCP_URLS environment variable
  • New handle_multiple_mcp_tools method for executing tools across different servers
  • Added execute_mcp_call function for direct server-specific tool execution
  • Enhanced error handling with retry logic for reliable tool execution
  • Robust JSON payload extraction from model responses
  • Complete documentation of the multi-MCP workflow and payload format
  • Example servers (weather_server.py and news_server.py) for testing

Impact:

  • Enables distributed tool execution across specialized microservices
  • Improves system architecture by separating tool concerns
  • Provides fault tolerance through connection to multiple servers
  • Maintains backward compatibility with existing single-server implementations

Issue:
Closes #881

Testing:

  • Added unit tests in test_multi_mcp.py
  • Created end-to-end examples with local MCP servers
  • Manual verification with demo servers

Tag maintainer:
@kyegomez


📚 Documentation preview 📚: https://swarms--891.org.readthedocs.build/en/891/

@github-actions github-actions bot added documentation Improvements or additions to documentation tests structs tools labels Jun 16, 2025
@ascender1729 ascender1729 marked this pull request as ready for review June 16, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation structs tests tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT][Add Multiple MCP Tool Execution]
1 participant