MCP Gateway
@lucky-aeon
The MCP gateway is a reverse proxy server that forwards requests from clients to the MCP server or uses all MCP servers under the gateway through a unified portal.
Overview
What is MCP Gateway?
MCP Gateway is a reverse proxy server that forwards requests from clients to MCP servers or acts as a unified portal for all MCP servers under the gateway. It supports SSE (default) and Streamable HTTP transport protocols, which are switchable at startup.
How to use MCP Gateway?
Deploy via Docker using the provided image (ghcr.io/lucky-aeon/mcp-gateway). Configure config.json to set the gateway protocol, authentication, and MCP service manager settings. Use the API endpoints: /deploy to register MCP servers, /sse and /message for SSE mode, or /stream for Streamable HTTP mode. The gateway protocol can also be set with the --protocol CLI flag.
Key features of MCP Gateway
- Deploy multiple MCP servers via
uvx,npx, or SSE URL. - Unified portal to call any MCP server.
- Aggregate all downstream SSE streams into one.
- List all tools from all servers with namespacing.
- Streamable HTTP aggregated endpoint with session management.
- Dynamic capability aggregation (gateway advertises capabilities present in at least one downstream server).
- MCP OAuth 2.1 resource server authentication with Protected Resource Metadata discovery.
Use cases of MCP Gateway
- Unify multiple MCP servers behind a single endpoint for clients.
- Aggregate and namespace tools from different MCP servers.
- Use MCP OAuth 2.1 authentication for secure access.
- Switch between SSE and Streamable HTTP transport without changing client architecture.
FAQ from MCP Gateway
What transport protocols does MCP Gateway support?
MCP Gateway supports SSE (default) and Streamable HTTP (MCP spec 2025-03-26), switchable at startup via config.json or the --protocol flag.
How do I configure authentication?
Set Auth.Enabled to true or false in config.json. When enabled, every MCP request must include a Bearer access token. You can use built-in SaaS mode or external OAuth providers. For local development, set Auth.Enabled to false.
How do I deploy an MCP server through the gateway?
Send a POST /deploy request with JSON containing mcpServers, specifying the server name and either a url or command (with optional args and env).
What is the difference between SSE mode and gateway SSE mode?
In "Use MCP (SSE Mode)", requests go directly to a specific MCP server (e.g., /{server-name}/sse). In "Use Gateway (SSE Mode), requests go to a single /sseendpoint, and the gateway merges all downstream SSE streams. Tools are namespaced as{serverName}-{toolName}`.
How does Streamable HTTP mode work?
The gateway exposes /stream. Establish a session with POST /stream (initialize), get a Mcp-Session-Id header, then include it on subsequent requests. Handshake with notifications/initialized, then call tools or list resources.