Skip to main content
Glama
kvochkin-dev

MCP Gateway

MCP Gateway


MCP Gateway — puerta de enlace de Model Context Protocol lista para producción para LLM rusos: interfaz única para GigaChat y YandexGPT con fallback automático, anonimización de datos personales según 152-FZ y ahorro del 86% en tokens.

Conecte cualquier cliente MCP (Hermes Agent, Claude Code, Cursor, n8n) y obtenga acceso a los modelos rusos a través de un solo endpoint. Stack: FastAPI, MCP SDK, GigaChat API, YandexGPT API.


✨ Características

Función

Descripción

🔀 Multiproveedor

GigaChat (principal) + YandexGPT (fallback) + Ollama (local)

🛡️ 152-ФЗ

Detección y anonimización integradas de datos personales: teléfono, INN, pasaporte, SNILS, dirección

💰 Ahorro del 86%

GigaChat ~200₽/M tokens frente a YandexGPT ~1 455₽/M tokens

🔄 Fallback automático

Cambio sin interrupciones de proveedores ante errores y límite de tasa (429)

🐳 Docker Ready

Docker Compose completo para desplegar con un solo comando

💚 Health Checks

Endpoints de monitoreo y servicio systemd con inicio automático


Related MCP server: Multi-Provider LLM MCP Server

🏗️ Arquitectura

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

🚀 Inicio rápido

# Клонирование
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

📋 Endpoints de API

Método

Ruta

Descripción

GET

/health

Estado del servicio y proveedores

GET

/docs

Swagger UI

POST

/mcp

Interfaz MCP (tools)

Health Check

curl http://localhost:8000/health
{
  "status": "healthy",
  "gigachat": "connected",
  "yandexgpt": "connected",
  "anonymizer": "ready"
}

🔐 Configuración

Todos los secretos se almacenan en .env (archivo excluido de git):

GIGACHAT_CLIENT_ID=***
GIGACHAT_CLIENT_SECRET=***
YANDEXGPT_API_KEY=***
YANDEXGPT_FOLDER_ID=***

🧪 Pruebas

pytest tests/ -v

13/13 pruebas pasadas — clientes de proveedores, lógica de fallback, anonimizador de datos personales.


📁 Estructura del proyecto

mcp-gateway/
├── app.py                  # FastAPI + MCP сервер
├── src/
│   ├── clients/            # GigaChat, YandexGPT клиенты
│   └── anonymizer/         # 152-ФЗ анонимизация ПД
├── scripts/
│   └── mcp-monitor.sh      # Мониторинг сервисов
├── docs/                   # Отчёты и документация
├── tests/                  # 13 тестов
└── docker-compose.yml      # Docker-развёртывание

📄 Licencia

MIT — úsalo libremente.


Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides 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
  • F
    license
    A
    quality
    D
    maintenance
    Unified MCP server for querying multiple LLM providers (Gemini, OpenAI, Anthropic, etc.) with advanced routing, cost optimization, and fallback resilience.
    2
    16 npm
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables MCP-compatible applications to interact with local and cloud-hosted LLM models for model management, text generation, chat, embeddings, and web search/fetch.
    958 npm
    AGPL 3.0