SuperAPIAI Directory

mcp-hub

github.com · AI developer platforms

Serve many stdio MCP servers from one container over HTTPS, with path-based routing, an aggregate endpoint using meta-tools, built-in OAuth 2.1 and hot reload.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

mcp-hub is a dual-era Model Context Protocol (MCP) gateway used to expose multiple stdio MCP servers uniformly from a single container and publish them over HTTPS. It simultaneously supports both the MCP 2026-07-28 and 2025-11-25 revisions on each endpoint; clients can choose for themselves, and it is impossible to tell from the response which version is being used.

Purpose mcp-hub mainly solves the problem of MCP clients that cannot start processes locally (such as ChatGPT connectors, Claude Web and Code, Mistral Le Chat, Cursor, LibreChat, and other Streamable-HTTP clients) accessing backend MCP servers. It replaces the approach of deploying a separate authentication proxy container for each stdio MCP server (each requiring a full image, OAuth stack, hostname, and compose stack) with a single process.

Main capabilities

  • Path routing: access different servers through paths such as https://host/paperless、https://host/homeassistant .
  • /hub aggregation endpoint: register a single connector to access all servers through 6 meta-tools (list_servers, list_tools, get_tool_schema, call_tool, wake_server, sleep_server), avoiding flooding the model context with an N×tools pattern.
  • Per-server tool filtering: decide which tools to expose through allowTools / denyTools, supporting exact names or the list_* prefix; filtered tools will not appear in tools/list, and even if a client calls them, they will be rejected before the server is woken up.
  • Built-in OAuth 2.1: login protected by a single password, supports CIMD (Client ID Metadata Document)-preferred registration while retaining RFC 7591 dynamic registration; also supports manually issuing credentials through the admin CLI.
  • API tokens: provide long-lived resource-bound tokens for clients that cannot perform OAuth (OpenAI Responses API, xAI API, Gemini API).
  • Upstream OAuth: if a remote server uses OAuth, an oauth block can be configured, and the hub will register, obtain, and refresh tokens itself.
  • On-demand lifecycle: stdio and docker servers start when used and sleep after 60 minutes of idleness, during which initialize / tools/list are answered from a persistent snapshot; keepAlive: true can exempt an individual server, and IDLE_TIMEOUT_MINUTES=0 can exempt the entire hub.
  • Supervision and hot reload: child processes are pinged and restarted with exponential backoff when they die; edits to mcp.json only start/stop/restart the affected servers.
  • Stateless Streamable HTTP: no session state, avoiding process or memory leaks caused by claude.ai's reconnection behavior of not sending DELETE.
  • Dual-era support: each endpoint (/hub, /<name>/mcp, and --stdio) answers both MCP revisions simultaneously; the 2026 revision includes elicitation (questions from sub-servers can be passed through to the end user) and subscriptions (the hub provides subscriptions/listen, and subscribe according to the version understood by the subserver).
  • Change notifications: clients can open a subscriptions/listen stream to learn about changes to the subserver's tools, prompts, or resources; the hub subscribes in the way the subserver understands (2026 servers use subscriptions/listen, 2025 servers use resources/subscribe).
  • Lightweight design: a single Node process, no database (state is a JSON file plus signing keys under /data), ten runtime dependencies, multi-architecture images provided, with the goal of running comfortably on single-board computers such as a Raspberry Pi.

Usage Configuration is located at /config/mcp.json, in exactly the same format as Claude Code's mcpServers, so entries can be copied 1:1; ${VAR} is expanded from the container environment. stdio servers (command / args / env) are started as supervised child processes; remote servers (type: "http" or "sse", with url and optional headers) are connected as MCP clients, and the configured headers are injected on every request.

Deployment options:

  • Option A (recommended): use the prebuilt GHCR image, supporting linux/amd64 and linux/arm64, with tags including latest, X.Y.Z, X.Y, and sha-<commit>.
  • Option B: build from source.
  • Option C: install via npm (package name @ni-c/mcp-hub, providing the mcp-hub and mcp-hub-admin binaries); the container remains the recommended deployment method.

Connecting clients: add https://<host>/hub (or https://<host>/<name>/mcp) as a custom connector, and log in once with a password. Claude Code can use claude mcp add -t http name https://<host>/<name>/mcp. API-only clients use tokens issued by the admin CLI.

The admin CLI can list or revoke clients, and can also issue long-lived, resource-bound API tokens for clients that cannot perform OAuth.

Use cases

  • Need to access from MCP clients that cannot locally start processes, accessing multiple stdio MCP servers.
  • Want to replace registering each server separately with a single connector.
  • Need to run an MCP gateway on resource-constrained devices (such as a Raspberry Pi).
  • Need to provide isolation for servers of different trust levels (type: "docker" communicates across container boundaries via the Docker API, or type: "unix" / "tcp" connects to sockets).

Limitations and caveats

  • All stdio child processes share the hub's Unix user and can read its mounted files; only fully trusted stdio servers should be installed. Servers of different trust levels should be placed in separate containers.
  • If a non-empty PASSWORD or bcrypt PASSWORD_HASH is not set, the HTTP hub will still start, but login is disabled, and clients cannot be approved or tokens issued.
  • /data stores the Ed25519 JWT keys, registered OAuth clients, approvals, and refresh tokens; it should be mounted as a volume, and rebuilding will invalidate all connector authorizations.
  • Each access token is bound to one resource; RESOURCE_BOUND_TOKENS=false is a migration mode that issues unbound tokens that can access all paths.
  • TRUSTED_PROXIES determines how req.ip and login rate limiting are counted; when unset, per-IP limiting degrades to a single global counter.
  • A reverse proxy must satisfy: TLS termination, allow WebSockets/SSE, disable proxy buffering, request timeout greater than 310 seconds, request body limit no higher than MCP_BODY_LIMIT, and forward X-Forwarded-Proto / Host.
  • Reserved names include mcp, hub, authorize, token, register, login, consent, health, livez, revoke, jwks, interaction, session, userinfo, upstream, .well-known.
  • Change notifications are carried over subscriptions/listen on 2026-07-28, whose state is an open response rather than a session table.
  • Regarding the specific behavior of 2025-11-25 clients, the material is truncated at the end, and a complete explanation is not yet available.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools