AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Mcp Gateway

mcp-harrisoncn-mcp-gateway Β· by HarrisonCN

πŸ”€ A lightweight, open-source gateway for managing, routing, and monitoring multiple MCP (Model Context Protocol) servers. Auth Β· Rate-limit Β· Metrics Β· Tool discovery.

β€” No reviews yet
0 installs
38 views
0.0% view→install

Install

$ agentstack add mcp-harrisoncn-mcp-gateway

βœ“ scanned Β· βœ“ verified, works with Claude Code, Cursor, and more.

Security review

βœ“ Passed

No issues found. Passed automated security review. Β· v0.1.0 How review works β†’

  • βœ“ Prompt-injection patterns
  • βœ“ Secret / credential exfiltration
  • βœ“ Dangerous shell & filesystem operations
  • βœ“ Untrusted network calls
  • βœ“ Known-malicious package signatures

What it can access

  • ● Network access Used
  • βœ“ Filesystem access No
  • βœ“ Shell / process execution No
  • βœ“ Environment & secrets No
  • βœ“ Dynamic code execution No

From automated source analysis of v0.1.0. β€œUsed” means the capability is present in the source β€” more access means more to trust, not that it’s unsafe.

View the full security report β†’

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-harrisoncn-mcp-gateway)

Reliability & compatibility

βœ“ Security review passed
0 installs to date
β€” no reviews yet
β—‹ 5mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work β†’
Are you the author of Mcp Gateway? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

mcp-gateway

A lightweight, open-source gateway for your MCP servers.

Route Β· Authenticate Β· Rate-limit Β· Monitor β€” all your Model Context Protocol servers from a single endpoint.

[](LICENSE) [](https://nodejs.org) [](https://www.typescriptlang.org) [](https://www.npmjs.com/package/mcp-gateway) [](https://ghcr.io/HarrisonCN/mcp-gateway)

[English](#) Β· [δΈ­ζ–‡](docs/README.zh-CN.md) Β· [Docs](docs/) Β· [Examples](examples/)


The Problem

As MCP becomes the standard protocol for AI agents to interact with tools, teams are running dozens of MCP servers β€” filesystem, GitHub, databases, Slack, search, and more. Managing them is chaos:

  • Every AI client connects to every server independently
  • No central authentication or access control
  • No visibility into which tools are being called, by whom, and how often
  • No rate limiting to prevent runaway agents from hammering your APIs

mcp-gateway solves this. It sits between your AI clients and your MCP servers, acting as a single, observable, secure entry point.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      AI Clients                         β”‚
β”‚   Claude Code Β· Cursor Β· Copilot Β· Your App Β· Scripts   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚  HTTP / REST
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   mcp-gateway                           β”‚
β”‚                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Auth   β”‚  β”‚  Router  β”‚  β”‚  Metrics / Monitor   β”‚  β”‚
β”‚  β”‚ API Key  β”‚  β”‚ Tool β†’   β”‚  β”‚  Prometheus Β· Logs   β”‚  β”‚
β”‚  β”‚   JWT    β”‚  β”‚ Server   β”‚  β”‚  Dashboard           β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚  β”‚Rate Limitβ”‚  β”‚ Registry β”‚  β”‚  Health  β”‚              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚              β”‚              β”‚  stdio / SSE / WS
       β–Ό              β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚Filesystemβ”‚  β”‚  GitHub  β”‚  β”‚PostgreSQLβ”‚  ... more
β”‚  Server  β”‚  β”‚  Server  β”‚  β”‚  Server  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

  • Unified API endpoint β€” one URL for all your MCP tools, auto-routed by tool name
  • Authentication β€” API key, JWT, or no-auth modes
  • Rate limiting β€” per-key sliding window, with standard X-RateLimit-* headers
  • Health monitoring β€” automatic health checks with configurable intervals
  • Metrics β€” Prometheus-compatible /metrics endpoint + JSON aggregation
  • Tool discovery β€” GET /api/v1/tools lists all tools across all servers
  • YAML/JSON config β€” simple, declarative configuration with env var overrides
  • Docker-ready β€” official Docker image, Compose examples included
  • TypeScript SDK β€” embed the gateway as a library in your own project

Quick Start

Install

npm install -g mcp-gateway
# or
npx mcp-gateway init

Configure

# Generate a default config file
mcp-gateway init

# Edit mcp-gateway.yml to add your servers
# mcp-gateway.yml
port: 4000

servers:
  - id: filesystem
    name: Filesystem
    transport: stdio
    command: npx
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]

  - id: github
    name: GitHub
    transport: stdio
    command: npx
    args: ["-y", "@modelcontextprotocol/server-github"]
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: "${GITHUB_TOKEN}"

Run

mcp-gateway start
# β†’ mcp-gateway listening on http://0.0.0.0:4000
# β†’ βœ“ Filesystem β€” 8 tools available
# β†’ βœ“ GitHub β€” 26 tools available

Call a Tool

# List all available tools
curl http://localhost:4000/api/v1/tools

# Call a tool (auto-routes to the right server)
curl -X POST http://localhost:4000/api/v1/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool": "read_file", "arguments": {"path": "/tmp/hello.txt"}}'

# With authentication
curl -X POST http://localhost:4000/api/v1/tools/call \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"tool": "create_issue", "server": "github", "arguments": {"title": "Bug report", "body": "..."}}'

API Reference

| Method | Path | Description | |--------|------|-------------| | GET | /api/v1/health | Gateway health and server summary | | GET | /api/v1/servers | List all registered servers | | GET | /api/v1/servers/:id | Get server details and tools | | GET | /api/v1/tools | List all tools (filterable by ?server= or ?tag=) | | POST | /api/v1/tools/call | Invoke a tool | | GET | /api/v1/metrics | Aggregated metrics (JSON or Prometheus) | | GET | /api/v1/requests | Recent request log |

Configuration Reference

port: 4000                    # HTTP port (env: MCP_GATEWAY_PORT)
host: 0.0.0.0                 # Bind address (env: MCP_GATEWAY_HOST)
logLevel: info                # debug | info | warn | error

auth:
  strategy: api-key           # none | api-key | jwt
  apiKeys:
    - "your-secret-key"

rateLimit:
  limit: 100                  # Max requests per window
  windowSeconds: 60           # Window duration
  perKey: true                # Per-key or global

monitor:
  requestLog: true            # Log all requests
  prometheus: true            # Enable Prometheus /metrics
  retentionHours: 24          # Metrics retention

corsOrigins:
  - "https://your-app.com"

servers:
  - id: my-server             # Unique identifier
    name: My Server           # Display name
    transport: stdio          # stdio | sse | websocket
    command: npx
    args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
    env:
      MY_VAR: "${ENV_VAR}"    # Environment variable substitution
    tags: [files, local]
    enabled: true
    timeout: 30000            # ms
    maxConcurrency: 10

Docker

# Pull and run
docker run -p 4000:4000 \
  -v $(pwd)/mcp-gateway.yml:/app/mcp-gateway.yml \
  -e GITHUB_TOKEN=ghp_... \
  ghcr.io/harrisonCN/mcp-gateway:latest

# Or with Docker Compose
cd examples/docker
docker compose up

Embed as a Library

import { Gateway, loadConfig } from 'mcp-gateway';

const config = await loadConfig('./mcp-gateway.yml');
const gateway = new Gateway(config);

await gateway.start();
// Gateway is now running at http://localhost:4000

// Graceful shutdown
process.on('SIGTERM', () => gateway.stop());

What's New in v0.2.0

| Feature | Description | |---------|-------------| | SSE Transport | Connect to MCP servers via Server-Sent Events | | WebSocket Transport | Full-duplex WS transport with keep-alive pings | | Config Hot Reload | Edit mcp-gateway.yml without restarting | | Request Tracing | X-Request-Id on every request & response | | CORS Middleware | Configurable cross-origin support | | Web Dashboard | Live monitoring UI at /dashboard | | 4 Bug Fixes | Concurrency, id collision, handle leaks, timeouts |

Roadmap

| Feature | Status | |---------|--------| | stdio transport | βœ… Done | | SSE transport | βœ… Done (v0.2.0) | | WebSocket transport | βœ… Done (v0.2.0) | | Config hot reload | βœ… Done (v0.2.0) | | Web dashboard UI | βœ… Done (v0.2.0) | | Redis-backed rate limiting | πŸ“‹ Planned | | OAuth2 / OIDC auth | πŸ“‹ Planned | | Tool-level access control (RBAC) | πŸ“‹ Planned | | Request replay & debugging | πŸ“‹ Planned | | Multi-tenant mode | πŸ“‹ Planned | | OpenTelemetry tracing | πŸ“‹ Planned |

Contributing

Contributions are welcome! See [CONTRIBUTING.md](docs/CONTRIBUTING.md).

git clone https://github.com/HarrisonCN/mcp-gateway.git
cd mcp-gateway
npm install
npm run dev -- start -c examples/basic/mcp-gateway.yml

License

MIT Β© 2026 HarrisonCN


Built for the agentic era · If this helps you, please ⭐ star the repo

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source β€” we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.