MCP Gateway
MCP Gateway
MCP Gateway — 面向俄罗斯 LLM 的生产就绪 Model Context Protocol 网关:通过一个统一接口访问 GigaChat 和 YandexGPT,支持自动 fallback、符合 152-ФЗ 的个人数据匿名化,并节省 86% 的 token 费用。
接入任意 MCP 客户端(Hermes Agent、Claude Code、Cursor、n8n),即可通过一个 endpoint 访问俄罗斯模型。技术栈:FastAPI、MCP SDK、GigaChat API、YandexGPT API。
✨ 功能
功能 | 描述 |
🔀 多提供商支持 | GigaChat(主要)+ YandexGPT(fallback)+ Ollama(本地) |
🛡️ 152-ФЗ | 内置个人数据检测与匿名化:电话、ИНН、护照、СНИЛС、地址 |
💰 节省 86% | GigaChat ~200₽/M token,而 YandexGPT ~1 455₽/M token |
🔄 自动 fallback | 在错误和速率限制(429)时无缝切换提供商 |
🐳 Docker 就绪 | 完整的 Docker Compose,一条命令即可部署 |
💚 健康检查 | 监控端点及带自动启动的 systemd 服务 |
Related MCP server: Multi-Provider LLM MCP Server
🏗️ 架构
flowchart TB
classDef client fill:#eef2f7,stroke:#4a5568,stroke-width:1.5px
classDef gateway fill:#edf2f7,stroke:#4a5568,stroke-width:1.5px
classDef llm fill:#e2e8f0,stroke:#4a5568,stroke-width:1.5px
subgraph Client["👤 Клиент"]
Agent["🤖 MCP-клиент<br>Hermes Agent / Claude Code / n8n"]
end
class Client client
subgraph Gateway["⚙️ MCP Gateway (FastAPI, port 8000)"]
MCP["MCP Server<br>5 tools"]
Anon["🛡️ Анонимизатор ПД<br>152-ФЗ"]
Fallback["🔀 Fallback-оркестратор"]
MCP --> Anon --> Fallback
end
class Gateway gateway
subgraph Providers["🧠 LLM-провайдеры"]
Giga["GigaChat<br>~200₽/M токенов"]
Yandex["YandexGPT<br>~1 455₽/M токенов"]
Ollama["Ollama<br>локально, 0₽"]
end
class Providers llm
Agent --> MCP
Fallback -->|"основной"| Giga
Fallback -.->|"fallback"| Yandex
Fallback -.->|"fallback"| Ollama🚀 快速开始
# Клонирование
git clone https://github.com/kvochkin-dev/mcp-gateway.git
cd mcp-gateway
# Настройка окружения
cp .env.example .env
# Впишите свои API-ключи в .env
# Запуск через Docker
docker-compose up -d
# Или напрямую
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py📋 API 端点
方法 | 路径 | 描述 |
|
| 服务与提供商状态 |
|
| Swagger UI |
|
| MCP 接口(tools) |
健康检查
curl http://localhost:8000/health{
"status": "healthy",
"gigachat": "connected",
"yandexgpt": "connected",
"anonymizer": "ready"
}🔐 配置
所有密钥都存储在 .env 中(该文件已从 git 中排除):
GIGACHAT_CLIENT_ID=***
GIGACHAT_CLIENT_SECRET=***
YANDEXGPT_API_KEY=***
YANDEXGPT_FOLDER_ID=***🧪 测试
pytest tests/ -v13/13 测试通过 — 提供商客户端、fallback 逻辑、个人数据匿名化器。
📁 项目结构
mcp-gateway/
├── app.py # FastAPI + MCP сервер
├── src/
│ ├── clients/ # GigaChat, YandexGPT клиенты
│ └── anonymizer/ # 152-ФЗ анонимизация ПД
├── scripts/
│ └── mcp-monitor.sh # Мониторинг сервисов
├── docs/ # Отчёты и документация
├── tests/ # 13 тестов
└── docker-compose.yml # Docker-развёртывание📄 许可证
MIT — 可自由使用。
This server cannot be deployed
Maintenance
Related MCP Connectors
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
OpenAI-compatible LLM gateway for Russia: 500+ models, ruble pricing, balance, chat.
Connect MCP clients to 2,000+ AI models without managing provider API keys.
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides a unified MCP interface for running completions, embeddings, image generation, and classification across OpenAI, Anthropic, Groq, and Mistral. Eliminates provider-specific boilerplate by standardizing API calls for text generation, vector embeddings, and classification tasks.MIT
- FlicenseAqualityDmaintenanceUnified MCP server for querying multiple LLM providers (Gemini, OpenAI, Anthropic, etc.) with advanced routing, cost optimization, and fallback resilience.222 npm-
- AlicenseAqualityFmaintenanceMCP server for Yandex GPT API enabling text generation, embeddings, classification, summarization, and tokenization.851 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible applications to interact with local and cloud-hosted LLM models for model management, text generation, chat, embeddings, and web search/fetch.958 npmAGPL 3.0