MCP Agent Orchestrator
MCP Agent Orchestrator
Python、FastAPI、PostgreSQL、Docker、およびLLMを搭載したエージェントで構築された、本番運用向けのMCP(Model Context Protocol)Agent Orchestratorです。
概要
MCP Agent Orchestratorは、自然言語のクエリを受け取り、必要なエージェントを判断し、MCPツールに接続してPostgreSQLからデータを取得し、構造化されたレスポンスを生成します。
現在のシステムは以下をサポートしています:
給与分析
会社分析
従業員情報
会社の役割
マルチエージェントオーケストレーション
フォローアップクエリのルーティング
MCPツール実行のトレーシング
障害およびタイムアウトの処理
リクエストIDと実行タイミング
PostgreSQLベースのデータ
Dockerデプロイメント
自動化されたCIテスト
Related MCP server: Cloudflare Remote PostgreSQL MCP Server
アーキテクチャ
Client
|
v
FastAPI API
|
v
Orchestrator
|
+--------------------+
| |
v v
Salary Agent Company Agent
| |
+---------+----------+
|
v
MCP Server
|
v
PostgreSQL
Technology Stack
Python 3.13
FastAPI
Uvicorn
PostgreSQL
psycopg2
Model Context Protocol (MCP)
OpenAI / OpenRouter-compatible LLM integration
Docker
Docker Compose
pytest
GitHub Actions
MCPOrchestrator/
|
├── api.py
├── orchestrator.py
├── harness.py
├── salary_agent.py
├── company_agent.py
├── database.py
├── postgres_database.py
├── requirements.txt
├── Dockerfile
├── compose.yaml
├── .dockerignore
├── .gitignore
├── README.md
|
├── tests/
│ ├── test_api.py
│ ├── test_company.py
│ ├── test_end_to_end.py
│ ├── test_failure_handling.py
│ ├── test_integration.py
│ ├── test_mcp_resilience.py
│ ├── test_orchestrator.py
│ └── test_salary.py
|
└── .github/
└── workflows/
└── ci.yml
API
Health Check
GET /health
Example:
{
"status": "healthy",
"service": "MCP Agent Orchestrator",
"database": "connected"
}
Root Endpoint
GET /
Returns basic service information.
Query Endpoint
POST /query
Request:
{
"query": "Who is the highest paid employee at Google?"
}
Example response:
{
"request_id": "example-request-id",
"status": "success",
"answer": "The highest-paid employee at **Google** is **Priya**, earning **85000** as a **ML Engineer**.",
"execution_time": 7.4,
"error": null
}
Supported Query Examples
Who is the highest paid employee at Google?
Tell me about Google.
Show me employees working at Google.
What roles exist at Google?
Analyze Google and tell me who earns the most and what roles exist.
Give me a complete analysis of Tesla.
The system can return a meaningful "no information available" response when a company is not present in the database.
Database
The project uses PostgreSQL.
Database configuration is loaded from environment variables:
DB_HOST
DB_NAME
DB_USER
DB_PASSWORD
DB_PORT
API credentials are also supplied through environment variables.
Never commit .env or API keys to Git.
Database Seeding
The project contains postgres_database.py for initializing the employee table and inserting seed data.
The seed operation is idempotent: running the script repeatedly does not insert duplicate employee records.
Run:
python postgres_database.py
Docker
Build and start the application:
docker compose up -d --build
Check the container:
docker compose ps
Check health:
curl.exe http://localhost:8000/health
Stop the application:
docker compose down
Container Security
The application container runs as a non-root user.
The application filesystem is configured as read-only while temporary runtime writes can still use /tmp.
A Docker health check is also configured for the API.
Testing
Run the complete test suite:
python -m pytest -v tests
Current test status:
86 passed
The test suite covers:
API behavior
Company agent
Salary agent
End-to-end orchestration
Failure handling
MCP resilience
Integration
Routing
Follow-up queries
Validation
Timeout handling
MCP tool-call limits
Recovery after MCP failures
CI/CD
GitHub Actions runs automatically on pushes and pull requests targeting main.
The CI pipeline:
Checks out the repository
Installs Python 3.13
Installs dependencies
Runs the test suite
Builds the Docker image
Workflow:
.github/workflows/ci.yml
MCP Execution Trace
The orchestrator records MCP activity including:
Agent name
MCP tool name
Tool arguments
Execution status
Execution time
Number of MCP calls
Final execution status
This provides visibility into how a request was processed.
Failure Handling
The system includes protection against:
MCP tool failures
Invalid MCP responses
MCP timeouts
Agent timeouts
Agent iteration limits
MCP tool-call limits
Partial MCP data
Failed MCP calls
Database connectivity failures
The health endpoint reports database connectivity separately from API availability.
Development
Create and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
Install dependencies:
pip install -r requirements.txt
Run the API locally:
uvicorn api:app --host 0.0.0.0 --port 8000
Environment Variables
Create a .env file locally:
OPENROUTER_API_KEY=your_api_key
DB_HOST=your_database_host
DB_NAME=your_database_name
DB_USER=your_database_user
DB_PASSWORD=your_database_password
DB_PORT=5432
Do not commit real credentials.
Project Status
The current implementation has completed:
Core MCP orchestration
Salary agent
Company agent
PostgreSQL integration
API layer
Docker deployment
Container hardening
Automated testing
MCP resilience testing
CI pipeline
Idempotent database seeding
License
This project is currently intended as a personal/portfolio MCP orchestration project.
'@ | Set-Content README.md
Then verify that the file contains the documentation:
```powershell
Get-Content README.md | Select-Object -First 30This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceAn MCP server that gives AI agents direct read-only access to PostgreSQL databases, enabling natural language analytics through tools for schema exploration, querying, trend analysis, and data quality checks.115MIT
- AlicenseNot gradedqualityBmaintenanceEnables natural language interaction with PostgreSQL databases through MCP tools, with GitHub OAuth authentication and role-based access control.MIT
- AlicenseNot gradedqualityCmaintenanceAsk your database questions in plain English. Connects PostgreSQL databases to MCP clients and answers with real, structured data instead of guesses.MIT
- FlicenseNot gradedqualityCmaintenanceEnables natural language queries to PostgreSQL through an Ollama-powered agent, using MCP protocol to connect the backend to the database and a web interface.
Related MCP Connectors
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
GibsonAI MCP server: manage your databases with natural language
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/AvinashReddy6631/MCPOrchestrator'
If you have feedback or need assistance with the MCP directory API, please join our Discord server