Skip to main content
Glama

MCP Gateway

Model Context Protocol サーバー向けのセルフホスト型コントロールプレーン。使用するすべての MCP サーバーを 1 箇所で定義し、Web GUI から管理し、エージェントに単一のエンドポイント(サーバーごと、または名前空間化されたツールを持つサーバーのグループ全体)を提供します。

 Claude Code · Claude Desktop · Cursor · VS Code · your agent
        │  Streamable HTTP  /mcp/servers/<id>   /mcp/groups/<id>      (+ API key)
        ▼
 ┌────────────────────── MCP Gateway ──────────────────────┐
 │  web GUI  ·  admin REST API  ·  sessions  ·  logs        │
 │  groups: namespaced tools  pg-analytics__execute_sql …   │
 │  upstream manager: start/stop, restart w/ backoff,       │
 │  health checks, idle stop, tool filters & renames        │
 └───────┬──────────────────┬──────────────────┬───────────┘
   stdio (npx/uvx/docker)   Streamable HTTP     legacy SSE
   Postgres, filesystem…    remote MCP servers  older servers

シナリオ。 エージェントが 2 つの Postgres データベースを必要としています。GUI で pg-analyticspg-orders を追加し(PostgreSQL (DBHub) テンプレートから)、それらをグループ databases に入れ、エージェントを http://gateway:8808/mcp/groups/databases に向けます。エージェントには pg-analytics__execute_sqlpg-orders__execute_sql が見えます。ゲートウェイがプロセス、資格情報、再起動、ログを管理します。完全で実行可能なバージョンは examples/postgres-scenario にあります。

機能

  • 任意のアップストリームトランスポート — stdio プロセス(npxuvxdocker run、その他)、Streamable HTTP、および bearer/basic/header 認証付きのレガシー SSE リモート。

  • ライフサイクル管理 — 自動/遅延起動、アイドル停止、指数バックオフと上限付き再起動、ヘルスチェック ping、起動/リクエスト/ツール呼び出しのタイムアウト、キャプチャされた stderr。

  • グループ — 1 つのエンドポイントの背後に複数のサーバー。ツールとプロンプトは名前空間化され(prefix__tool. または -)、競合処理付きパススルーも可能。メンバーごとのフィルター、統合された指示、暗黙の all グループ。

  • ツールポリシー — サーバーごとの include/exclude glob、非表示、リネーム、説明の書き換え。

  • 完全な MCP プロキシ — ツール、リソース(+テンプレート、サブスクリプション)、プロンプト、補完、ロギング、進捗、キャンセル、list_changed の伝播、およびサーバー→クライアントの sampling / elicitation / roots を発信元セッションへルーティング。

  • ダウンストリームトランスポート — Streamable HTTP(再開可能なストリームを備えたステートフル、またはステートレス)、レガシー SSE、さらに Claude Desktop などのクライアント向けの stdio ブリッジである mcp-gateway-connect

  • セキュリティ — API キー(ハッシュ化、サーバー/グループにスコープ、期限付き)、GUI/API 用の管理トークン、シークレットの秘匿化(redaction)、${ENV} 補間(シークレットを設定ファイルに書かずに済む)、DNS リバインディング保護、CORS 許可リスト。

  • GUI — ダッシュボード、16 テンプレートのサーバーカタログ(Postgres ×3、MySQL、SQLite、filesystem、GitHub、Playwright、Context7、fetch、memory、…)、Test connection 付きタブ式エディタ、Try it 付きツールエクスプローラ、リソース/プロンプトブラウザ、ライブログ、メトリクス、クライアント別接続スニペット、セッション、設定、インポート/エクスポート(Claude Desktop / Cursor / VS Code の mcpServers ファイル)。

Related MCP server: Master MCP Server

スクリーンショット

ダッシュボード — 実行中のサーバー、グループ、アクティブなセッション、ライブイベントフィード:

MCP Gateway ダッシュボード

サーバーカタログ — トランスポート、ステータス、ツール数、再起動回数をひと目で確認:

サーバー一覧

サーバーの詳細ビュー — ランタイムとエンドポイントの情報に加え、GUI から直接ツールを呼び出せるツールエクスプローラ:

サーバーの詳細とツールエクスプローラ

クイックスタート

必要環境:Node.js ≥ 20(実行するアップストリームサーバーに応じて npx / uvx / docker も必要)。

git clone <this repo> mcp-gateway && cd mcp-gateway
npm install
npm run build
npm start                     # → http://127.0.0.1:8808

その後、GUI で:Servers → Add server → PostgreSQL (DBHub) → DSN を貼り付け → Test connectionCreate server。サーバーの Connect タブを開き、クライアント用のスニペットをコピーします。例:

claude mcp add --transport http pg-analytics http://127.0.0.1:8808/mcp/servers/pg-analytics

開発モード(Vite のホットリロードが :5173、ゲートウェイが :8808):npm run dev

Docker

docker compose up -d --build              # GUI on http://localhost:8808, data in ./data

イメージには node/npxuvxgit が同梱されているため、npm ベースおよび Python ベースの MCP サーバーをコンテナ内で起動できます。ポートが他の人から到達可能な場合は、環境変数 GATEWAY_ADMIN_TOKEN を設定してください。設定を事前にロードするには、ファイルをマウントして GATEWAY_SEED_CONFIG=/path/to/config.json を設定します。初回起動時にデータボリュームへコピーされます。

全体像

概念

説明

サーバー

1 つのアップストリーム MCP サーバー定義:トランスポート、ライフサイクル、ツールポリシー、転送オプション。エンドポイントは /mcp/servers/<id>

グループ

名前空間化されたツール/プロンプトと統合されたリソースを持つ 1 つの仮想 MCP サーバーとして公開される、順序付きサーバー集合。エンドポイントは /mcp/groups/<id>。暗黙のグループ all には、有効なすべてのサーバーが含まれます。

APIキー

/mcp/* の Bearer トークン(保存時ハッシュ化、サーバー/グループにスコープ、任意の有効期限)。Require API key がオンのときに強制されます。

セッション

接続中の 1 つのダウンストリームクライアント(Streamable HTTP または SSE)。GUI で表示および終了できます。

管理トークン

GUI と /api/* を保護します。GATEWAY_ADMIN_TOKEN または Settings で設定します。

設定は単一の JSON ファイル(data/config.json、モード 0600、アトミック書き込み、.bak 保持)です。全フィールドは docs/CONFIG.md を参照してください。各ツールのクライアント設定は docs/CLIENTS.md に、設計の全体は docs/SPEC.md にあります。GUI には組み込みの Docs ページ(Settings の隣の /docs)もあり、ゲートウェイの仕組みと、サーバーの追加・カスタマイズ・接続方法を順を追って説明しています。

CLI

mcp-gateway serve [--host 127.0.0.1] [--port 8808] [--data-dir ./data] [--config <file>] [--public-url <url>] [--log-level info]
mcp-gateway import <file> [--format gateway|mcpServers] [--mode merge|replace]    # into the config file (restart to apply)
mcp-gateway export [--format gateway|mcpServers] [--secrets] [--out <file>]
mcp-gateway hash-token <token>                                                     # sha256 for settings.auth.adminTokenHash
mcp-gateway connect <url> [--api-key K] [--header 'Name: v'] [--sse]              # stdio ⇄ HTTP bridge
mcp-gateway-connect <url> …                                                        # same bridge as a standalone package (@mcp-gateway/connect)

環境変数:GATEWAY_HOSTGATEWAY_PORTGATEWAY_DATA_DIRGATEWAY_CONFIGGATEWAY_ADMIN_TOKENGATEWAY_PUBLIC_URLGATEWAY_LOG_LEVELGATEWAY_REQUIRE_API_KEYGATEWAY_WEB_DIRGATEWAY_SEED_CONFIG(Docker)。優先順位:CLI フラグ > 環境変数 > config.json > デフォルト。

エンドポイント

パス

目的

POST/GET/DELETE /mcp/servers/:id · /mcp/groups/:id

Streamable HTTP MCP エンドポイント

GET /mcp/servers/:id/sse + POST …/messages?sessionId=(グループも同様)

レガシー HTTP+SSE

GET /api/health

生存確認(認証なし)

/api/servers, /api/groups, /api/keys, /api/sessions, /api/logs, /api/settings, /api/templates, /api/config/{export,import}, /api/connect/:kind

管理 REST API(JSON。設定時は Authorization: Bearer <admin token>

GET /api/events

GUI が使用する Server-Sent Events フィード(ステータス、ログ、セッション、メトリクス)

/

Web GUI

リクエスト/レスポンスの形式を含む完全なルート一覧は docs/SPEC.md §7 にあります。

セキュリティに関する注意

  • 管理トークンがない場合、GUI/API は開放されます。デフォルトのループバックバインドを維持するか、GATEWAY_ADMIN_TOKEN を設定してください。

  • /mcp を localhost の外に公開する前に Require API key をオンにしてください。キーは、各エージェントが必要とするサーバー/グループにスコープしてください。

  • シークレット:リテラル値ではなく ${VAR} 参照を優先してください。シークレットと思われるキーの値は、API レスポンスとエクスポートで秘匿(redaction)されます(?secrets=1 / シークレット付きエクスポートには含まれます)。

  • インターネットに公開するものには、前面に TLS 終端のリバースプロキシを配置してください(Anthropic API MCP コネクタに必要です)。

  • ゲートウェイは設定したコマンドを実行します。管理アクセス権を持つ人は誰でも、ホスト上で任意のプロセスを実行できます。

開発

npm run dev          # gateway (tsx watch) + Vite dev server
npm run typecheck    # all workspaces
npm test             # vitest: shared unit tests, server integration tests (real stdio/HTTP fixtures), bridge tests
npm run build        # server bundle (esbuild), connect bundle, web (vite)

構成:packages/shared(zod 設定スキーマ、DTO、テンプレート、命名ヘルパー — ブラウザセーフ)、packages/server(Express 5 + @modelcontextprotocol/sdk:アップストリームマネージャー、プロキシサーバー、セッション、REST/MCP ルート、CLI)、packages/web(React 19 + Vite)、packages/connect(stdio ブリッジ)、examples/postgres-scenario(docker-compose デモ)。

制限事項 / ロードマップ

  • アップストリームサーバーへの OAuth は未実装です(bearer/basic/header 認証を使用してください)。ダウンストリームクライアント向けの OAuth も未実装です(代わりに API キーを使用します)。

  • グループ内でリソースは名前空間化されません。URI は所有サーバーにルーティングされ、メンバー間で同一の URI は最初のメンバーに解決されます。

  • レート制限はありません。必要であれば前面にリバースプロキシを配置してください。

  • シングルプロセス、インメモリのセッションとログ(再起動するとセッションは失われ、クライアントは再初期化します)。

ライセンス

Apache License 2.0 — LICENSENOTICE を参照してください。

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

Maintenance

Maintainers
Response time
Release cycle
Releases (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

  • A
    license
    Not graded
    quality
    D
    maintenance
    A central hub that aggregates multiple MCP resource servers into a single unified interface, enabling users to access tools and capabilities from multiple backend servers through one connection point.
    45
    202
    MIT
  • 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
  • F
    license
    Not graded
    quality
    D
    maintenance
    A centralized gateway and router that integrates multiple MCP servers into a single endpoint with built-in policy enforcement and secret management. It features a Web GUI for managing tool access, audit logs, and multi-environment configurations across various sub-servers.

View all related MCP servers

Related MCP Connectors

  • 34 production API tools over one hosted MCP endpoint.

  • MCP Server for agents to onboard, pay, and provision services autonomously with InFlow

  • MCP server for AI access to Swagger by SmartBear.

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

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