natlight/mcp-server-orchestration
If you are the rightful owner of mcp-server-orchestration and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This repository demonstrates a sophisticated MCP server that orchestrates multiple other MCP servers to provide intelligent code generation.
MCP Server Orchestration
Demonstration of MCP server orchestration - an intelligent code assistant that manages and coordinates multiple MCP servers using OpenAI Agents SDK.
Overview
Question: Can an MCP server start up and orchestrate other MCP servers?
Answer: YES! This repository demonstrates a sophisticated MCP server (code-assistant-server.py
) that orchestrates multiple other MCP servers as internal components to provide intelligent code generation with proper standards compliance and up-to-date library documentation.
Architecture
External MCP Client
β
βββββββββββββββββββββββββββββββββββββββββββ
β code-assistant-server.py β β Main MCP Server
β β
β βββββββββββββββββββββββββββββββββββββββ β
β β OpenAI Agent β β β Orchestration Layer
β β β β
β β βββββββββββββββ ββββββββββββββββββββ β
β β β Standards β β Context7 ββ β β Internal MCP Clients
β β β MCP Client β β MCP Client ββ β
β β βββββββββββββββ ββββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββ β
β β MCP Server β β β External Interface
β β (External Interface) β β
β βββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββ
β β
βββββββββββββββββββ βββββββββββββββββββ
β standards-serverβ β context7 server β β Internal MCP Servers
β (subprocess) β β (subprocess) β (managed as subprocesses)
βββββββββββββββββββ βββββββββββββββββββ
Servers
1. Code Assistant MCP Server (code-assistant-server.py
)
The main orchestrating server that:
- Starts and manages other MCP servers as subprocesses
- Uses OpenAI Agents SDK for intelligent orchestration
- Communicates with internal MCP servers via JSON-RPC
- Provides intelligent code generation with context from multiple sources
2. Team Coding Standards MCP Server (standards-server.py
)
Provides access to team coding standards and best practices as resources.
Key Features
- MCP Server Orchestration: Demonstrates that MCP servers can start and manage other MCP servers
- Intelligent Agent Integration: Uses OpenAI Agents SDK for smart coordination
- Multi-Server Communication: Combines coding standards and library documentation
- Production-Ready: Proper error handling, cleanup, and monitoring
- Multiple Language Support: Python, JavaScript, TypeScript, Java, Go, Rust, SQL, HTML, CSS
Installation & Setup
- Install dependencies:
pip install -r requirements.txt
- Set OpenAI API Key:
export OPENAI_API_KEY=your_openai_api_key_here
-
Ensure Docker is running (for Context7 server)
-
Run the Code Assistant Server:
python code-assistant-server.py
Usage Examples
Basic Code Generation
{
"method": "tools/call",
"params": {
"name": "generate_code_with_context",
"arguments": {
"request": "Create a REST API endpoint for user authentication",
"language": "python",
"libraries": ["fastapi", "pydantic"],
"include_tests": true,
"include_docs": true
}
}
}
Check Server Status
{
"method": "tools/call",
"params": {
"name": "get_server_status",
"arguments": {}
}
}
Testing
Run the test suite:
python test_code_assistant.py
Files
code-assistant-server.py
- Main orchestrating MCP serverstandards-server.py
- Team coding standards MCP servertest_code_assistant.py
- Comprehensive test suiterequirements.txt
- Python dependenciesmcp-config-example.json
- MCP client configuration exampleIMPLEMENTATION_SUMMARY.md
- Detailed technical documentation
How It Works
- Startup: Code assistant server starts internal MCP servers as subprocesses
- Request Processing: External requests trigger the OpenAI Agent
- Context Gathering: Agent fetches coding standards and library documentation
- Code Generation: Agent generates context-aware code following best practices
- Response: Complete solution returned with tests and documentation
Benefits
- Modularity: Each MCP server has specific responsibilities
- Intelligence: Agent makes decisions about context gathering
- Scalability: Easy to add more internal MCP servers
- Reusability: Components can be used independently
License
MIT License - see LICENSE file for details.