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.
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:
- Clone the repository or download the release package.
- Install dependencies: npm install
- Configure environment variables (example):
- PORT=3000
- MCP_GATEWAY_LOG_LEVEL=info
- MCP_GATEWAY_HOST=0.0.0.0
- Run the server: npm start or node server.js
- (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
microsandbox
opensource self-hosted sandboxes for ai agents
mcp-context-forge
An AI Gateway, registry, and proxy that sits in front of any MCP, A2A, or REST/gRPC APIs, exposing a unified endpoint with centralized discovery, guardrails and management. Optimizes Agent & Tool calling, and supports plugins.
azure-ai-travel-agents
A robust enterprise application sample (deployed on ACA) that leverages MCP and multiple AI agents orchestrated by Langchain.js, Llamaindex.TS and Microsoft Agent Framework.
nosia
Self-hosted AI RAG + MCP Platform
mcp-container-ts
This is a quick start guide that provides the basic building blocks to set up a remote Model Context Protocol (MCP) server using Azure Container Apps. The MCP server is built using Node.js and TypeScript, and it can be used to run various tools and services in a serverless environment.
RiMCP_hybrid
Rimworld Coding RAG MCP server