Get the FREE Ultimate OpenClaw Setup Guide →

mcp-gateway

MCP Gateway is a reverse proxy and management layer for MCP servers, enabling scalable, session-aware stateful routing and lifecycle management of MCP servers in Kubernetes environments.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio microsoft-mcp-gateway node server.js \
  --env PORT="3000" \
  --env MCP_GATEWAY_HOST="0.0.0.0" \
  --env MCP_GATEWAY_LOG_LEVEL="info"

How to use

MCP Gateway acts as a reverse proxy and control plane for MCP servers and tools. It provides a data plane that routes MCP requests to registered MCP adapters (the MCP servers) with session-affinity, and a control plane to manage adapters and tools via REST APIs. It also hosts a dedicated tool gateway router that can dynamically route tool execution requests to registered tool servers based on tool definitions. To start, deploy the gateway in your environment, register MCP adapters under /adapters, and register tools under /tools. Once registered, you can establish a streamable MCP connection through /adapters/{name}/mcp and route tool calls through /mcp, which the gateway will forward to the appropriate tool servers while maintaining session consistency. The system supports authentication and authorization, ensuring that read and write access align with roles such as mcp.admin and specific engineer principals.

How to install

Prerequisites:

  • Node.js (14.x or later) and npm installed on your host
  • Optional: Docker and kubectl if you plan to deploy in Kubernetes

Installation steps:

  1. Clone the repository or download the release package.
  2. Install dependencies: npm install
  3. Configure environment variables (example):
    • PORT=3000
    • MCP_GATEWAY_LOG_LEVEL=info
    • MCP_GATEWAY_HOST=0.0.0.0
  4. Run the server: npm start or node server.js
  5. (Optional) Build and deploy to Kubernetes or your chosen orchestrator following your organization’s deployment patterns.

If you prefer a Docker-based deployment, you can containerize the server using a standard Node.js image and expose port 3000 to your cluster.

Additional notes

Notes and tips:

  • Ensure session affinity is configured so that a given session_id consistently routes to the same MCP server instance.
  • When registering tools, include container image details, tool definitions, and execution endpoints so the Tool Gateway Router can route requests properly.
  • Secure access with the gateway’s authentication mechanisms (e.g., Entra ID RBAC) and assign roles like mcp.admin to control who can deploy adapters or tools.
  • For local testing, you can run a lightweight MCP adapter and a sample tool server behind the gateway to validate routing and dynamic tool invocation.
  • If you encounter routing issues, check the Tool Gateway Router readiness and ensure multiple router instances are running behind the gateway for high availability.
  • Review the sample-servers directory (e.g., mcp-proxy) for examples of proxying local and remote MCP servers.
  • Monitor logs via the /adapters/{name}/logs and /tools/{name}/logs endpoints to diagnose deployment or routing problems.

Related MCP Servers

Sponsor this space

Reach thousands of developers