Skip to main content
Glama

MCP Gateway

PyPI version Python License

Автономный CLI-шлюз, который агрегирует несколько MCP-серверов (Model Context Protocol) за одной HTTP/SSE-точкой с Code Mode — снижая расход входных токенов LLM до 92% при использовании нескольких MCP-серверов.

Возможности

  • Агрегация нескольких серверов — Подключение к нескольким MCP-серверам (HTTP, SSE, Stdio, Streamable HTTP) и предоставление их через единую точку

  • Code Mode — 4 мета-инструмента, позволяющие LLM динамически обнаруживать и использовать инструменты без предварительной загрузки всех схем

  • Поддержка OAuth 2.0 — Встроенный OAuth-поток с динамической регистрацией клиентов (RFC 7591) и хранением токенов

  • Герметичная песочница — Песочница на основе Starlark для безопасного выполнения кода

  • Соответствие протоколу MCP — Работает с Claude Desktop, Cursor и любым MCP-совместимым клиентом

Related MCP server: MCP Server Proxy

Установка

pip install mcp-gway

Или с помощью mise:

mise install
uv sync

Быстрый старт

# Add an MCP server
mcp-gway add youtube --type http --url http://localhost:3001/mcp

# Add a stdio server
mcp-gway add filesystem --type stdio --command npx --args '["-y", "@anthropic/mcp-filesystem"]'

# Add a server requiring OAuth
mcp-gway add supabase --type streamable-http --url https://mcp.supabase.com/mcp

# List all servers
mcp-gway list

# Start the gateway
mcp-gway serve --port 8080

Подключение из Claude Desktop

Добавьте в конфигурацию Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "gateway": {
      "url": "http://localhost:8080/mcp"
    }
  }
}

Команды

Команда

Описание

mcp-gway add

Добавить MCP-сервер и сгенерировать .pyi-заглушку

mcp-gway remove

Удалить MCP-сервер

mcp-gway update

Обновить инструменты для сервера

mcp-gway list

Список всех подключенных серверов

mcp-gway inspect

Показать сигнатуры инструментов для сервера

mcp-gway refresh

Обновить соединение и повторно обнаружить инструменты

mcp-gway serve

Запустить сервер шлюза

Code Mode

При подключении шлюз предоставляет 4 мета-инструмента:

Инструмент

Описание

listToolFiles

Список всех доступных .pyi-файлов заглушек

readToolFile

Чтение сигнатур функций из заглушки

getToolDocs

Получение подробной документации для инструмента

executeToolCode

Выполнение кода в изолированном интерпретаторе Starlark

OAuth-аутентификация

Для серверов, требующих OAuth (например, Supabase):

# Trigger OAuth flow
mcp-gway refresh supabase --auth

# Or store token manually
mkdir -p ~/.config/mcp-gway/tokens
echo '{"access_token": "YOUR_TOKEN"}' > ~/.config/mcp-gway/tokens/supabase.json

Разработка

# Install dependencies
mise install
uv sync

# Run tests
uv run pytest -v

# Lint and format
uv run ruff check src/ tests/
uv run ruff format src/ tests/

Архитектура

┌─────────────────────────────────────────────────────────┐
│                    MCP Gateway                          │
├─────────────────────────────────────────────────────────┤
│  CLI (click)     │  HTTP/SSE Server (Starlette)        │
│  - add           │  - POST /mcp (JSON-RPC)             │
│  - remove        │  - GET /mcp (SSE stream)            │
│  - list          │  - POST /mcp/messages               │
│  - refresh       │                                     │
├─────────────────────────────────────────────────────────┤
│  Code Mode (4 meta-tools)     │  Starlark Sandbox      │
│  - listToolFiles               │  - Hermetic execution  │
│  - readToolFile                │  - Server injection    │
│  - getToolDocs                 │                        │
│  - executeToolCode             │                        │
├─────────────────────────────────────────────────────────┤
│  Registry (.pyi files)        │  OAuth2 (RFC 7591)     │
│  - servers/*.pyi               │  - Dynamic registration│
│  - Tool signatures             │  - Token storage       │
└─────────────────────────────────────────────────────────┘
         │                │                │
    ┌────┴────┐      ┌────┴────┐      ┌────┴────┐
    │ Server1 │      │ Server2 │      │ Server3 │
    │ (HTTP)  │      │ (SSE)   │      │ (Stdio) │
    └─────────┘      └─────────┘      └─────────┘

Лицензия

MIT

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
8Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Aggregates multiple MCP servers behind a single, secure endpoint with unified tool/resource discovery, OAuth authentication, and resilient request routing. Enables users to manage and interact with multiple MCP backends through one centralized interface with load balancing and circuit breakers.
    2
  • A
    license
    Not graded
    quality
    D
    maintenance
    Aggregates multiple MCP servers into a single endpoint, enabling LLM clients to access tools, resources, and prompts from various backends through one connection.
    15
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    Aggregates multiple MCP servers via a single interface with token optimization and multiple operating modes (Gateway, Meta, Proxy, Search, Code).
    7
    8
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Aggregates multiple MCP servers into a single unified endpoint with hot-plugging, multi-protocol support, and management via web and CLI.
    9

View all related MCP servers

Related MCP Connectors

  • MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.

  • Self-hosted federated MCP gateway: one OAuth 2.1 MCP server in front of N apps, user-level scopes.

  • AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.

View all MCP Connectors

Latest Blog Posts

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/deuriib/mcp-gateway'

If you have feedback or need assistance with the MCP directory API, please join our Discord server