MCP-AI-Gateway
Unified local MCP AI Gateway that routes across Groq, OpenRouter, Mistral, and local Ollama providers, with OpenAI-compatible APIs, MCP tools, fallback/racing router, monitoring, and web dashboard.
README
MCP-AI-Gateway
Unified local MCP AI Gateway that routes across Groq, OpenRouter, Mistral, and local Ollama providers, with OpenAI-compatible APIs, MCP tools, fallback/racing router, monitoring, and web dashboard.

🚀 Features
- Async Python gateway with provider abstraction layer
- Built-in providers:
- Groq (
openai/gpt-oss-120bdefault, plusmoonshotai/kimi-k2-instruct-0905) - OpenRouter (
openai/gpt-4o-minidefault) - Mistral (
codestral-latestdefault, plusdevstral-medium-latest) - Ollama
- Groq (
- Intelligent router:
- priority routing
- fallback routing
- parallel racing mode
- rate-limit aware provider scoring
- MCP server capabilities:
- tool registration/discovery
- prompt template discovery/rendering
- schema validation
- SSE and HTTP transport
- OpenAI-compatible API:
POST /v1/chat/completionsPOST /v1/completionsGET /v1/models
- Web UI (React + Vite + Tailwind):
- Dashboard
- Providers
- Models
- Chat
- Logs
- Stats
- Runtime gateway API key generation
- Observability:
- Prometheus metrics (
/metrics) - structured logs
- SQLite request statistics
- Prometheus metrics (
- Extensible plugin system for additional providers
- CLI:
mcp-ai start|stop|status|providers|models - Docker + docker-compose support
- GitHub Actions CI for backend lint/tests and frontend build
🗂️ Repository Structure
mcp-ai-gateway/
api/
providers/
router/
mcp_server/
plugins/
database/
web_ui/
config/
cli/
tests/
Dockerfile
docker-compose.yml
README.md
⚡ Quick Start (Local)
1) 📦 Prerequisites
- Python 3.11+
- Node.js 20+
- Optional: local Ollama daemon at
http://localhost:11434
2) 🐍 Install backend
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e .[dev]
3) 🔐 Configure environment
cp .env.example .env
# edit .env values
4) ⚙️ Edit config
config/config.yaml controls providers, routing, security, and default models.
5) ▶️ Start backend
uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload
6) 🖥️ Start web UI
cd web_ui
npm install
VITE_API_BASE=http://localhost:8000 VITE_API_KEY=change-me npm run dev
🐳 Docker Deployment
docker compose up --build
Services:
- Gateway API: http://localhost:8000
- Web UI: http://localhost:3000
- Redis:
localhost:6379(optional cache/rate-limit backend)
🧩 API Overview
OpenAI-Compatible 🤝
POST /v1/chat/completionsPOST /v1/completionsGET /v1/models
Use header X-API-Key: <key> (or Authorization: Bearer <key>).
MCP Endpoints 🔌
- JSON-RPC MCP transport:
POST /mcp - SSE streaming output:
POST /mcp/stream
Supported MCP methods:
initializenotifications/initializedpingtools/listtools/callprompts/listprompts/get
Dashboard APIs 📊
GET /api/dashboardGET /api/providersPOST /api/providers/{name}/togglePOST /api/providers/{name}/priorityPOST /api/providers/{name}/configGET /api/modelsGET /api/settingsPOST /api/settings/default-modelPOST /api/settings/api-key/generateGET /api/logsGET /api/stats
Monitoring 📈
GET /healthGET /metrics
🛠️ CLI
mcp-ai start
mcp-ai status
mcp-ai providers
mcp-ai models
mcp-ai stop
🧭 Warp MCP Integration
Add this to Warp MCP config:
{
"mcpServers": {
"mcp-ai-gateway": {
"url": "http://localhost:8000/mcp",
"headers": {
"Authorization": "Bearer REPLACE_WITH_MCP_GATEWAY_API_KEY"
}
}
}
}
🧱 Configuration Example
providers:
groq:
enabled: true
api_key: ${GROQ_API_KEY}
priority: 1
default_model: openai/gpt-oss-120b
mistral:
enabled: false
api_key: ${MISTRAL_API_KEY}
priority: 12
default_model: codestral-latest
openrouter:
enabled: true
priority: 2
default_model: openai/gpt-4o-mini
ollama:
enabled: true
priority: 3
routing:
fallback_enabled: true
racing_mode: false
🧪 Plugin Providers
New providers can be added under plugins/ by implementing ProviderPlugin and enabling provider config in config/config.yaml.
Included plugin examples:
openai_provider.pytogether_provider.pyopenrouter_provider.py
✅ Testing
pytest
CI runs on pushes and pull requests to main via .github/workflows/ci.yml:
- Backend job:
ruff check .andpytest -q - Frontend job:
npm installandnpm run buildinweb_ui/
🔄 Release Workflow
- Open PR from
dev/*branch tomain - Ensure CI is green
- Merge using GitHub CLI or GitHub UI
📚 Developer Guide
Detailed guide: docs/developer-guide.md
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。