MCP-Gateway
by mohandshamada
Overview
A federated gateway service for the Model Context Protocol (MCP) that aggregates multiple MCP servers into a single, namespaced, authenticated endpoint for AI agents like Claude.
Installation
npm startEnvironment Variables
- NODE_ENV
- LOG_LEVEL
- CONFIG_PATH
- MCP_GATEWAY_TOKENS
- MCP_GATEWAY_TOKEN
- MCP_DOMAIN
- MCP_SSL_EMAIL
- MCP_API_TOKEN
- GITHUB_TOKEN
- BRAVE_API_KEY
- OAUTH_CLIENT_ID
- OAUTH_CLIENT_SECRET
- API_CLIENT_ID
- API_CLIENT_SECRET
- LEGACY_CLIENT_ID
- LEGACY_CLIENT_SECRET
- LEGACY_USERNAME
- LEGACY_PASSWORD
- ALLOWED_PATHS
- ENABLE_FILE_OPERATIONS
- ENABLE_TERMINAL
- HEADER_Authorization
Security Notes
The project implements robust internal security features like timing-safe token comparison, configurable rate limiting, CORS, and environment variable validation/redaction. For its own `/admin/permissions/exec` endpoint, it employs a strict command whitelist and dangerous pattern blacklist. However, critical vulnerabilities exist: 1) The provided `config/gateway.json` (within the prompt context) contains hardcoded API tokens and OAuth client secrets, which is a severe risk if used directly in production. While the documentation suggests generating tokens and using environment variables, this specific configuration example is unsafe. 2) The `install.sh` and `setup-ubuntu.sh` scripts configure the gateway to run as `root` by default, granting maximum privileges to the entire process and its child MCP servers. This significantly increases the blast radius in case of a vulnerability. 3) The 'Desktop Commander' MCP server, a core pre-installed tool, explicitly exposes functionalities to 'Run shell commands' and 'file editing'. While the gateway's *own* `/admin/permissions/exec` endpoint is hardened, the Desktop Commander tool's methods (e.g., `execute_command`) allow arbitrary shell commands to be run by the AI agent through the MCP protocol, potentially bypassing the gateway's internal whitelist/blacklist and inheriting the `root` privileges. This is a very high privilege level for an AI-controlled component.
Similar Servers
mcpo
Exposes Model Context Protocol (MCP) tools as OpenAPI-compatible HTTP servers.
mcp-context-forge
Converts web content (HTML, PDF, DOCX, etc.) and local files from a URL into high-quality Markdown format. It supports multiple conversion engines, content optimization, batch processing, and image handling.
mcphub
An orchestration hub that aggregates, manages, and routes Model Context Protocol (MCP) servers and their tools, providing a centralized interface, user management, OAuth 2.0 authorization server capabilities, and AI-powered tool discovery and routing.
MCPJungle
MCPJungle is a self-hosted Model Context Protocol (MCP) Gateway that allows developers to register and manage various MCP servers and their tools from a central location, enabling AI agents to discover and consume these tools from a single gateway.