Multi-MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi-MCP Serveraggregate results for 'hello world'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Multi-MCP Server
A distributed Model Context Protocol (MCP) server setup featuring multiple independent MCP servers and a master aggregator server. This project demonstrates how to build and orchestrate MCP-based services for tool calling and result aggregation.
๐ Features
Multiple MCP Servers: Three specialized MCP servers running on separate ports
Server 1: Greeting service
Server 2: Mathematical operations
Server 3: Text manipulation
Master Aggregator: A central MCP server that orchestrates calls to all three servers
HTTP Transport: Stateless HTTP-based communication using JSON-RPC 2.0
Async Support: Fully asynchronous implementation for high performance
Easy Deployment: Simple setup with virtual environment and uvicorn
๐ Prerequisites
Python 3.8+
Virtual environment (recommended)
๐ ๏ธ Installation
Clone the repository (if applicable) or navigate to the project directory:
cd /path/to/Multi-MCPServerCreate and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txt
๐โโ๏ธ Running the Servers
Start Individual MCP Servers
Run each server in separate terminals or background processes:
# Server 1 (Port 8001)
PORT=8001 uvicorn mcp_server1:app --host 0.0.0.0 --port 8001
# Server 2 (Port 8002)
PORT=8002 uvicorn mcp_server2:app --host 0.0.0.0 --port 8002
# Server 3 (Port 8003)
PORT=8003 uvicorn mcp_server3:app --host 0.0.0.0 --port 8003Start Master Aggregator Server
uvicorn master_mcp:app --host 0.0.0.0 --port 8000๐ Usage
Available Tools
Server 1 Tools
greet(name: str): Returns a personalized greeting message
Server 2 Tools
add(a: float, b: float): Returns the sum of two numbers
Server 3 Tools
reverse_text(text: str): Returns the reversed text
Master Server Tools
aggregate_results(input_text: str): Calls all three servers and aggregates their results
Example API Calls
Direct Server Calls
# Greet
curl -X POST http://localhost:8001/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "greet", "arguments": {"name": "World"}}, "id": 1}'
# Add numbers
curl -X POST http://localhost:8002/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "add", "arguments": {"a": 10, "b": 20}}, "id": 1}'
# Reverse text
curl -X POST http://localhost:8003/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "reverse_text", "arguments": {"text": "hello"}}, "id": 1}'Aggregated Results
# Aggregate all results
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc": "2.0", "method": "tools/call", "params": {"name": "aggregate_results", "arguments": {"input_text": "test"}}, "id": 1}'Response:
{
"greet_result": "Hello, test! โ from MCP Server 1",
"add_result": "30.0",
"reverse_text_result": "tset"
}๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Master MCP โโโโโโ Server 1 โ
โ (Port 8000) โ โ (Port 8001) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Server 2 โ โ Server 3 โ
โ (Port 8002) โ โ (Port 8003) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโMaster Server: Orchestrates calls to individual servers
Individual Servers: Specialized MCP servers with unique tools
HTTP Transport: All communication uses HTTP with JSON-RPC 2.0 over Server-Sent Events
๐ง Configuration
Ports: Configurable via
PORTenvironment variable (defaults: 8001, 8002, 8003)Host: Default
0.0.0.0for external accessTransport Security: Configurable via
TransportSecuritySettings
๐งช Testing
Run the servers and use the provided curl examples to test functionality.
๐ฆ Dependencies
fastmcp: MCP server frameworkhttpx: Async HTTP clientuvicorn: ASGI serverfastapi: Web framework
See requirements.txt for full list.
๐ค Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Troubleshooting
Common Issues
Port already in use: Change the PORT environment variable
Connection refused: Ensure all servers are running
JSON parsing errors: Check request format matches JSON-RPC 2.0 specification
Logs
Check server logs for detailed error information. Enable debug logging by setting LOG_LEVEL=DEBUG.
๐ Additional Resources
JSON-RPC 2.0 Specification /Users/arvindacharya/Desktop/Quadra-Projects/MCP/Multi-MCPServer/README.md
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Acharya-Arvind/Aggregate-MCP-server-sample'
If you have feedback or need assistance with the MCP directory API, please join our Discord server