MCP Gateway 75f126b1

MCPAI代理

提供方 mohandshamada

AI代理 stdio · 本地进程 OAuth 授权 社区 / 第三方 Claude DesktopClaude
查看接入方式

MCP Gateway是一个生产就绪的联邦网关服务,用于聚合多个Model Context Protocol(MCP)服务器,提供单一命名空间和认证端点,内置75个即用工具。

一句话选型结论

按资料字段整理

MCP Gateway 75f126b1 属于AI代理类 MCP 服务器,stdio · 本地进程,OAuth 授权,可直接接入 Claude Desktop、Claude,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类AI代理 传输方式stdio · 本地进程 鉴权OAuth 授权 部署方式本地部署
GitHub 星标 3 仓库热度,无公开仓库时显示未标注
工具数 40 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

AI代理
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量40暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

联邦网关TypeScript本地部署MCP协议工具聚合生产就绪OAuth支持

安装与配置

stdio · 本地进程 OAuth 授权
客户端在本机拉起子进程,数据不出本机
docker run -p 8080:8080 \

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Docker,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 40 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
给代理接外部能力

让代理在任务中途调用搜索、数据库等真实工具。

多步任务编排

把一串操作拆成步骤,由代理按顺序执行。

自动化重复流程

把固定流程交给代理跑,减少手工操作。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 40 个工具,覆盖面较广,能满足多种调用。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好OAuth 授权对应的凭据,并按最小权限配置。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在AI代理场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
MCP Gateway 75f126b1当前 40 stdio · 本地进程 本地部署 有 2026-05-17
Filesystem 560c4363 13 未标注 本地部署 无 2026-05-17
Server Everything (everything) 11 stdio · 本地进程 本地部署 有 2026-05-17
Time 7365cb6d 2 SSE · 服务端推送 远程部署 有 2026-05-18
Everything Claude Code 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Openmemory 557e1585 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

AI代理
字段来自项目仓库与公开索引,中文说明由本站标注
提供方mohandshamada上游标注的维护方 mohandshamada
分类AI代理本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式OAuth 授权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · Docker本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

42.6 KB
来自项目仓库与上游目录的原文,未做删改

MCP Gateway

A production-ready Federated Gateway Service for the Model Context Protocol (MCP) that aggregates multiple MCP servers into a single, namespaced, authenticated endpoint with 75 pre-installed tools ready to use out of the box.


Highlights

  • 75 Tools Pre-installed - 5 MCP servers ready to use immediately
  • Zero Configuration Startup - Just npm install && npm start
  • Caddy Integration - Automatic SSL with Let's Encrypt, reverse proxy
  • OAuth Support - Client ID/Secret authentication for Claude app integration
  • Claude Desktop Ready - Auto-generated configuration for Claude app
  • Ubuntu Server Optimized - Full root access with secure 755 permissions for MCP tools
  • Production Hardened - Circuit breaker, retry logic, health monitoring, graceful degradation
  • Enterprise Features - Request correlation, persistent configuration, comprehensive logging

Pre-installed MCP Servers

Server Tools Description
Filesystem 14 Read/write files, directories, search, file info
Memory 9 Knowledge graph with entities, relations, observations
Sequential Thinking 1 Step-by-step problem solving with branching
Desktop Commander 25 Terminal commands, file editing, process management
Chrome DevTools 29 Browser debugging, performance analysis, network inspection
O'Reilly Learning 5 Access O'Reilly Learning Platform content
AI Unified Memory 8 Shared memory server for Claude, Kimi, Hermes, OpenClaw
Total 91 Ready to use immediately

Quick Start

Complete Installation (Recommended)

The interactive install script handles everything - dependencies, domain setup, OAuth, and SSL:```bash

Clone and run complete installation

git clone https://github.com/mohandshamada/MCP-Gateway.git
cd MCP-Gateway
sudo ./scripts/install.sh


The install script will:
- Install Node.js 22+ and system dependencies
- Install Google Chrome (for Chrome DevTools MCP)
- Install and configure Caddy with automatic SSL
- Ask for your domain name
- Set up OAuth server with your credentials
- Configure and start all services
- Print your SSE link and OAuth credentials

### Alternative: Step-by-Step Installation```bash
# Clone and run setup
git clone https://github.com/mohandshamada/MCP-Gateway.git
cd MCP-Gateway
sudo ./scripts/setup-ubuntu.sh

This setup script will:
- Install Node.js 22+ and system dependencies
- Install all MCP server packages
- Install Google Chrome (for Chrome DevTools MCP)
- Create directories with secure 755 permissions
- Build the gateway
- Create and enable systemd service

Production Setup with Caddy (SSL + Domain)

For production deployment with HTTPS and domain:```bash

Set your domain and email

export DOMAIN="mcp.example.com"
export EMAIL="admin@example.com"

Run setup scripts in order

sudo ./scripts/setup-ubuntu.sh # System dependencies
sudo ./scripts/setup-caddy.sh # Caddy reverse proxy
sudo ./scripts/setup-gateway.sh # MCP Gateway service


The setup scripts will:
- Install and configure Caddy web server
- Set up automatic SSL via Let's Encrypt
- Create systemd services for both Caddy and MCP Gateway
- Configure proper log directories and permissions

See DEPLOYMENT.md for detailed deployment instructions.

### Manual Installation```bash
# Clone repository
git clone https://github.com/mohandshamada/MCP-Gateway.git
cd MCP-Gateway/mcp-gateway

# Install dependencies (includes all MCP servers)
npm install

# Setup MCP directories
npm run setup:mcp

# Build
npm run build

# Start
npm start

Verify Installation

Use the built-in validation script for a comprehensive check:```bash
./scripts/validate-installation.sh


Or use the quick health check:```bash
./scripts/health-check.sh

Verify manually:```bash

Check health (all 5 servers should be healthy)

curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:3000/admin/health

Expected: {"status":"healthy","servers":{"total":5,"healthy":5,"unhealthy":0}}

List all 71 tools

curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:3000/admin/tools | jq '.data.total'

Expected: 71


### Documentation

For detailed guides, see:

- **Installation Checklist** - Step-by-step deployment checklist
- **Troubleshooting Guide** - Common issues and solutions
- **API Reference** - Complete API documentation
- **Deployment Guide** - Production deployment instructions

---

## Connect Claude as Remote MCP Server (SSE)

MCP Gateway exposes an SSE (Server-Sent Events) endpoint that allows Claude to connect as a **remote MCP server**. This gives Claude access to all 71 tools from anywhere.

### SSE Endpoint URL```
https://your-domain.com/sse

Or for local development:```
http://localhost:3000/sse


### Step-by-Step: Add to Claude as Remote MCP Server

1. **Get your gateway URL and token**

   After running setup, your endpoint will be:```
   SSE Endpoint: https://your-domain.com/sse
   API Token: sk-xxxxxxxxxxxxx (from setup or config)
   ```

2. **Open Claude Desktop Settings**

   - Open Claude Desktop application
   - Go to **Settings** (gear icon)
   - Navigate to **Developer** > **Edit Config**

3. **Add the MCP Gateway as Remote Server**

   Add this to your `claude_desktop_config.json`:```json
   {
     "mcpServers": {
       "mcp-gateway": {
         "url": "https://your-domain.com/sse",
         "transport": "sse",
         "headers": {
           "Authorization": "Bearer YOUR_API_TOKEN"
         }
       }
     }
   }
   ```

4. **Restart Claude Desktop**

   Close and reopen Claude Desktop to load the new MCP server.

5. **Verify Connection**

   In Claude, you should now see 71 tools available from the MCP Gateway.

### Get Your Configuration Automatically

The gateway provides an API endpoint to generate your Claude configuration:```bash
# Get full configuration with your token embedded
curl -H "Authorization: Bearer YOUR_TOKEN" \
  https://your-domain.com/admin/client-config/claude

# Output (ready to use):
{
  "mcpServers": {
    "mcp-gateway": {
      "url": "https://your-domain.com/sse",
      "transport": "sse",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Test SSE Connection

Before adding to Claude, verify the SSE endpoint works:```bash

Test SSE connection (should stream events)

curl -N \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: text/event-stream" \
https://your-domain.com/sse

Check available tools

curl -H "Authorization: Bearer YOUR_TOKEN" \
https://your-domain.com/admin/tools | jq '.data.total'

Expected: 71


### Configuration File Locations

| Platform | Config File Path |
|----------|-----------------|
| **macOS** | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| **Windows** | `%APPDATA%\Claude\claude_desktop_config.json` |
| **Linux** | `~/.config/Claude/claude_desktop_config.json` |

### Example: Complete Configuration```json
{
  "mcpServers": {
    "mcp-gateway": {
      "url": "https://mcp.example.com/sse",
      "transport": "sse",
      "headers": {
        "Authorization": "Bearer sk-a1b2c3d4e5f6g7h8i9j0..."
      }
    }
  }
}

Troubleshooting Connection

Issue Solution
"Connection refused" Check gateway is running: curl https://your-domain.com/admin/health
"401 Unauthorized" Verify your API token is correct
"SSL certificate error" Ensure Caddy has valid SSL cert, or use HTTP for local dev
"No tools available" Check server health: curl .../admin/servers
"Timeout" SSE needs long-lived connections; check firewall/proxy settings

Claude Desktop Integration

Quick Setup

  1. Run the Caddy setup script to configure your domain:bash sudo ./scripts/setup-caddy.sh

  2. Get your client configuration:bash curl -H "Authorization: Bearer YOUR_TOKEN" https://your-domain.com/admin/client-config/claude

  3. Add to your Claude Desktop config (claude_desktop_config.json):json { "mcpServers": { "mcp-gateway": { "url": "https://your-domain.com/sse", "transport": "sse", "headers": { "Authorization": "Bearer YOUR_TOKEN" } } } }

  4. Restart Claude Desktop

Auto-Generated Configuration

After setup, client configurations are saved to client-configs/:```
client-configs/
├── claude-desktop-config.json # Claude Desktop configuration
├── sse-client-config.json # Generic SSE client configuration
├── oauth-client-config.json # OAuth configuration (if enabled)
└── test-connection.sh # Connection test script


### Get Configuration via API```bash
# Full configuration with instructions
curl -H "Authorization: Bearer $TOKEN" https://your-domain.com/admin/client-config

# Download Claude Desktop config file directly
curl -H "Authorization: Bearer $TOKEN" https://your-domain.com/admin/client-config/claude

Caddy Reverse Proxy Setup

Quick Setup (Recommended)

Use the simplified setup script:```bash

Set environment variables

export DOMAIN="mcp.example.com"
export EMAIL="admin@example.com"

Run setup

sudo ./scripts/setup-caddy.sh


The script will:
- Create caddy system user if needed
- Install Caddy if not present
- Set up log directory with proper permissions
- Set up ACME storage directories for SSL certificates
- Install and configure Caddyfile from template
- Validate configuration and start service

### Caddyfile Template

The setup uses `scripts/Caddyfile.template` which includes:
- Automatic SSL via Let's Encrypt
- Security headers (X-Frame-Options, XSS protection, etc.)
- SSE endpoint with streaming support (no timeout)
- JSON logging with rotation

### Advanced Setup

For more comprehensive setups with OAuth and client configuration generation:```bash
sudo ./scripts/caddy-integration.sh

This script provides:
- Interactive configuration - Prompts for domain, OAuth settings
- Configuration detection - Reads MCP Gateway settings automatically
- Client config generation - Creates ready-to-use Claude Desktop configs
- Testing suite - Runs integration tests after setup

Available Commands```bash

Interactive setup (default)

sudo ./scripts/caddy-integration.sh

Check current status

sudo ./scripts/caddy-integration.sh --check

Run integration tests

sudo ./scripts/caddy-integration.sh --test

Fix common issues automatically

sudo ./scripts/caddy-integration.sh --fix

Non-interactive setup (for automation)

sudo MCP_DOMAIN=mcp.example.com ./scripts/caddy-integration.sh --non-interactive


### Manual Caddy Configuration

Create `/etc/caddy/Caddyfile`:```
{
    email admin@example.com
}

your-domain.com {
    header {
        X-Content-Type-Options nosniff
        X-Frame-Options DENY
        X-XSS-Protection "1; mode=block"
        Referrer-Policy strict-origin-when-cross-origin
        -Server
    }

    # SSE endpoint needs special handling for long-lived connections
    handle /sse* {
        reverse_proxy 127.0.0.1:3000 {
            transport http {
                read_timeout 0
                write_timeout 0
            }
            flush_interval -1
        }
    }

    # All other endpoints
    handle {
        reverse_proxy 127.0.0.1:3000
    }

    log {
        output file /var/log/caddy/mcp-gateway.log {
            roll_size 100mb
            roll_keep 5
        }
        format json
    }
}

Start Caddy:```bash
sudo systemctl enable caddy
sudo systemctl start caddy


---

## OAuth Configuration

MCP Gateway includes a **built-in OAuth 2.0 authorization server** and also supports connecting to external OAuth providers:

| Feature | Description |
|---------|-------------|
| **Built-in OAuth Server** | Issue tokens directly from the gateway - no external provider needed |
| **Gateway OAuth** | Authenticate clients connecting to the gateway |
| **Server OAuth** | Authenticate gateway to remote MCP servers |

---

### Built-in OAuth Server (Recommended)

The gateway includes a complete OAuth 2.0 authorization server. This is the easiest way to get OAuth working.

#### Enable the Built-in OAuth Server

Edit `config/gateway.json`:```json
{
  "oauthServer": {
    "enabled": true,
    "tokenExpiresIn": 3600,
    "refreshTokenExpiresIn": 86400,
    "clients": [
      {
        "clientId": "mcp-client",
        "clientSecret": "your-secure-secret-here",
        "name": "MCP Gateway Client",
        "scopes": ["mcp:read", "mcp:write", "mcp:admin"],
        "grantTypes": ["client_credentials", "password", "refresh_token"]
      }
    ]
  }
}

Get an OAuth Token```bash

Using client credentials grant

curl -X POST http://localhost:3000/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=mcp-client" \
-d "client_secret=your-secure-secret-here"

Response:

{
"access_token": "abc123def456...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "mcp:read mcp:write mcp:admin"
}


#### Ready-to-Use SSE URL with OAuth Token

After getting a token, use it to connect:```bash
# Get token and save it
TOKEN=$(curl -s -X POST http://localhost:3000/oauth/token \
  -d "grant_type=client_credentials" \
  -d "client_id=mcp-client" \
  -d "client_secret=your-secure-secret-here" | jq -r '.access_token')

# Use token to access SSE endpoint
curl -N -H "Authorization: Bearer $TOKEN" http://localhost:3000/sse

# Or with domain
curl -N -H "Authorization: Bearer $TOKEN" https://mcp.example.com/sse

Claude Desktop Configuration with OAuth```json

{
"mcpServers": {
"mcp-gateway": {
"url": "https://mcp.example.com/sse",
"transport": "sse",
"headers": {
"Authorization": "Bearer YOUR_OAUTH_TOKEN"
}
}
}
}


#### Built-in OAuth Server Endpoints

| Endpoint | Method | Auth Required | Description |
|----------|--------|---------------|-------------|
| `POST /oauth/token` | POST | No | Get access token |
| `POST /oauth/revoke` | POST | No | Revoke a token |
| `POST /oauth/validate` | POST | No | Validate a token |
| `GET /.well-known/openid-configuration` | GET | No | OAuth discovery |
| `GET /oauth/info` | GET | Yes | Server info and stats |
| `POST /oauth/clients` | POST | Yes | Register new client |
| `DELETE /oauth/clients/:id` | DELETE | Yes | Remove client |

#### Supported Grant Types

| Grant Type | Use Case | Example |
|------------|----------|---------|
| `client_credentials` | Server-to-server, API access | `grant_type=client_credentials` |
| `password` | User login (with username/password) | `grant_type=password&username=user&password=pass` |
| `refresh_token` | Refresh expired tokens | `grant_type=refresh_token&refresh_token=xxx` |

#### Register a New OAuth Client via API```bash
curl -X POST http://localhost:3000/oauth/clients \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "my-app",
    "clientSecret": "my-app-secret",
    "name": "My Application",
    "scopes": ["mcp:read", "mcp:write"],
    "grantTypes": ["client_credentials"]
  }'

Check OAuth Server Status```bash

curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:3000/oauth/info

Response:

{
"enabled": true,
"stats": {
"clients": 1,
"activeTokens": 5,
"refreshTokens": 2
},
"clients": [
{
"clientId": "mcp-client",
"name": "MCP Gateway Client",
"scopes": ["mcp:read", "mcp:write", "mcp:admin"],
"grantTypes": ["client_credentials", "password", "refresh_token"]
}
]
}


#### OAuth Configuration Options

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `enabled` | boolean | `false` | Enable the built-in OAuth server |
| `issuer` | string | auto | OAuth issuer URL (auto-detected from request) |
| `tokenExpiresIn` | number | `3600` | Access token lifetime in seconds |
| `refreshTokenExpiresIn` | number | `86400` | Refresh token lifetime in seconds |
| `clients` | array | `[]` | Pre-registered OAuth clients |

#### OAuth Client Configuration

| Option | Type | Required | Description |
|--------|------|----------|-------------|
| `clientId` | string | Yes | Unique client identifier |
| `clientSecret` | string | Yes | Client secret for authentication |
| `name` | string | Yes | Human-readable client name |
| `scopes` | string[] | No | Allowed scopes (default: all) |
| `grantTypes` | string[] | No | Allowed grant types (default: client_credentials) |

---

### Quick Start: Test OAuth Server

A standalone test OAuth server is also included for development:```bash
# Start the test OAuth server on port 9000
node scripts/oauth-server.cjs 9000

# Test credentials:
# Client ID: mcp-gateway-client
# Client Secret: mcp-gateway-secret

Get a token:```bash
curl -X POST http://localhost:9000/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=mcp-gateway-client" \
-d "client_secret=mcp-gateway-secret"

Response:

{

"access_token": "abc123...",

"token_type": "Bearer",

"expires_in": 3600,

"scope": "mcp:read mcp:write mcp:admin"

}


**Test OAuth server endpoints:**

| Endpoint | Method | Description |
|----------|--------|-------------|
| `/oauth/token` | POST | Token endpoint (client_credentials, password, refresh_token) |
| `/.well-known/openid-configuration` | GET | OAuth discovery endpoint |
| `/health` | GET | Health check |

### Generate Authentication Token

Use the token generator script to create new static tokens:```bash
# Generate token with your domain (adds to config, prints ready URLs)
./scripts/generate-token.sh mcp.example.com

# Output includes:
# - Generated token
# - Ready-to-use SSE URLs with token
# - Claude Desktop config snippet
# - curl test command

Enable Gateway OAuth (External Provider)

For using an external OAuth provider, edit config/gateway.json:```json
{
"auth": {
"enabled": true,
"tokens": ["your-api-token"],
"oauth": {
"enabled": true,
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"issuer": "https://auth.example.com",
"authorizationUrl": "https://auth.example.com/authorize",
"tokenUrl": "https://auth.example.com/token",
"scopes": ["mcp:read", "mcp:write"]
}
}
}


### Connect to OAuth-Protected Remote MCP Servers

Configure a remote SSE server that requires OAuth:```json
{
  "servers": [
    {
      "id": "remote-oauth-server",
      "transport": "sse",
      "url": "https://api.example.com/mcp/sse",
      "oauth": {
        "clientId": "${API_CLIENT_ID}",
        "clientSecret": "${API_CLIENT_SECRET}",
        "tokenUrl": "https://auth.example.com/oauth/token",
        "grantType": "client_credentials",
        "scopes": ["mcp:read", "mcp:write"],
        "audience": "https://api.example.com",
        "refreshBeforeExpiry": 60
      },
      "enabled": true
    }
  ]
}

Set environment variables:```bash
export API_CLIENT_ID="your-client-id"
export API_CLIENT_SECRET="your-client-secret"


### Supported OAuth Grant Types

| Grant Type | Use Case | Required Config |
|------------|----------|-----------------|
| `client_credentials` | Server-to-server | clientId, clientSecret, tokenUrl |
| `password` | User credentials | + username, password |
| `refresh_token` | Token refresh | Automatic when refresh_token provided |

### Production OAuth Providers

#### Auth0 (Recommended for ease of setup)

1. Create an account at auth0.com
2. Create an API and Application
3. Configure:```json
{
  "oauth": {
    "clientId": "YOUR_AUTH0_CLIENT_ID",
    "clientSecret": "YOUR_AUTH0_CLIENT_SECRET",
    "tokenUrl": "https://YOUR_DOMAIN.auth0.com/oauth/token",
    "audience": "https://your-api.example.com",
    "grantType": "client_credentials"
  }
}

Keycloak (Self-hosted, free)```bash

Install with Docker

docker run -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=admin \
quay.io/keycloak/keycloak:latest start-dev

Access: http://localhost:8080

Create realm, client, and configure:

``````json
{
"oauth": {
"clientId": "mcp-gateway",
"clientSecret": "YOUR_CLIENT_SECRET",
"tokenUrl": "http://localhost:8080/realms/myrealm/protocol/openid-connect/token",
"grantType": "client_credentials"
}
}


#### AWS Cognito```json
{
  "oauth": {
    "clientId": "YOUR_COGNITO_CLIENT_ID",
    "clientSecret": "YOUR_COGNITO_CLIENT_SECRET",
    "tokenUrl": "https://YOUR_POOL.auth.REGION.amazoncognito.com/oauth2/token",
    "grantType": "client_credentials"
  }
}

OAuth Configuration Options

Option Type Required Description
clientId string Yes OAuth client ID (supports ${ENV_VAR} syntax)
clientSecret string Yes OAuth client secret (supports ${ENV_VAR} syntax)
tokenUrl string Yes Token endpoint URL
grantType string No client_credentials (default), password, refresh_token
scopes string[] No OAuth scopes to request
audience string No API audience (Auth0, etc.)
username string No Username (password grant only)
password string No Password (password grant only)
refreshBeforeExpiry number No Seconds before expiry to refresh (default: 60)

Example OAuth Configuration File

See config/gateway.oauth-example.json for a complete example with:
- Gateway-level OAuth for client authentication
- Remote server OAuth configuration
- Environment variable references

Domain Configuration```json

{
"domain": {
"domain": "mcp.example.com",
"publicUrl": "https://mcp.example.com",
"ssl": {
"enabled": true,
"email": "admin@example.com"
},
"proxy": {
"enabled": true,
"type": "caddy"
}
}
}


---

## Architecture```
┌─────────────────────────────────────────────────────────────────────────────┐
│                              MCP Gateway                                     │
│                                                                              │
│  ┌──────────────┐   ┌──────────────┐   ┌──────────────┐   ┌──────────────┐ │
│  │     Auth     │──▶│    Router    │──▶│   Registry   │──▶│   Adapters   │ │
│  │  Middleware  │   │  (Namespace) │   │ (Health/Pool)│   │ (Stdio/SSE)  │ │
│  └──────────────┘   └──────────────┘   └──────────────┘   └──────────────┘ │
│         │                                                         │          │
│         │              ┌──────────────────────────────────────────┤          │
│         │              │                                          │          │
│         ▼              ▼                                          ▼          │
│  ┌─────────────────────────────────────────────────────────────────────────┐│
│  │                        Production Features                               ││
│  │  • Circuit Breaker    • Retry w/ Backoff    • Request Correlation       ││
│  │  • Rate Limiting      • Health Checks       • Graceful Degradation      ││
│  │  • Config Persistence • Permission Mgmt    • Hot Reload                 ││
│  │  • OAuth Support      • Caddy Integration  • Claude App Ready           ││
│  └─────────────────────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────────────────────┘
                            │
          ┌─────────────────┼─────────────────┐
          │                 │                 │
          ▼                 ▼                 ▼
   ┌─────────────┐   ┌─────────────┐   ┌─────────────┐
   │   Caddy     │   │  Let's      │   │   Claude    │
   │   Proxy     │   │  Encrypt    │   │   Desktop   │
   │   (SSL)     │   │   (SSL)     │   │   (Client)  │
   └─────────────┘   └─────────────┘   └─────────────┘

API Reference

MCP Protocol Endpoints

Endpoint Method Description
/sse GET Server-Sent Events connection for MCP protocol
/message POST JSON-RPC message endpoint (requires X-Session-ID)
/rpc POST Direct JSON-RPC endpoint (stateless)

Admin Endpoints

Endpoint Method Description
/admin/health GET Health check with server status
/admin/status GET Detailed gateway status
/admin/servers GET List all registered servers
/admin/servers POST Register a new server (persisted to config)
/admin/servers/:id GET Get server details with circuit breaker status
/admin/servers/:id DELETE Unregister a server
/admin/servers/:id/restart POST Restart a server
/admin/tools GET List all 71 namespaced tools
/admin/metrics GET Gateway metrics and statistics

Client Configuration Endpoints

Endpoint Method Description
/admin/client-config GET Get full client configuration with instructions
/admin/client-config/claude GET Download Claude Desktop config file

Permission Management Endpoints

Endpoint Method Description
/admin/permissions GET Get current permission status (root/sudo)
/admin/permissions/set POST Set file/directory permissions
/admin/permissions/mkdir POST Create directory with secure 755 permissions
/admin/permissions/exec POST Execute command with elevated privileges

Authentication

All endpoints require Bearer token authentication:```bash
curl -H "Authorization: Bearer YOUR_TOKEN" https://your-domain.com/admin/health


---

## Configuration

### Full Configuration Example (`config/gateway.json`)```json
{
  "gateway": {
    "host": "0.0.0.0",
    "port": 3000,
    "name": "MCP Gateway",
    "version": "1.0.0"
  },
  "domain": {
    "domain": "mcp.example.com",
    "publicUrl": "https://mcp.example.com",
    "ssl": {
      "enabled": true,
      "email": "admin@example.com"
    },
    "proxy": {
      "enabled": true,
      "type": "caddy"
    }
  },
  "auth": {
    "enabled": true,
    "tokens": ["sk-your-secure-token-here"],
    "oauth": {
      "enabled": false,
      "clientId": null,
      "clientSecret": null
    }
  },
  "servers": [
    {
      "id": "filesystem",
      "transport": "stdio",
      "command": "node",
      "args": ["node_modules/@modelcontextprotocol/server-filesystem/dist/index.js", "/home", "/tmp"],
      "enabled": true,
      "timeout": 60000,
      "maxRetries": 3
    }
  ],
  "settings": {
    "requestTimeout": 120000,
    "enableHealthChecks": true,
    "healthCheckInterval": 30000,
    "enableRateLimiting": true,
    "rateLimit": {
      "windowMs": 60000,
      "maxRequests": 200
    }
  }
}

Server Configuration Options

Option Type Default Description
id string required Unique server ID (used as namespace prefix)
transport string required "stdio" or "sse"
command string - Command to spawn (stdio only)
args string[] [] Command arguments
url string - SSE endpoint URL (sse only)
env object {} Environment variables
enabled boolean true Whether server is enabled
lazyLoad boolean false Start on-demand
timeout number 60000 Request timeout (ms)
maxRetries number 3 Max restart attempts

Environment Variables```bash

Configuration file path

CONFIG_PATH=/path/to/gateway.json

Authentication tokens (comma-separated)

MCP_GATEWAY_TOKENS=token1,token2,token3

Single token

MCP_GATEWAY_TOKEN=your-token

Node environment

NODE_ENV=production

Domain (for non-interactive setup)

MCP_DOMAIN=mcp.example.com
MCP_SSL_EMAIL=admin@example.com

OAuth (for non-interactive setup)

MCP_OAUTH_ENABLED=true
MCP_OAUTH_CLIENT_ID=your-client-id
MCP_OAUTH_CLIENT_SECRET=your-client-secret
MCP_OAUTH_ISSUER=https://auth.example.com


---

## Tool Namespacing

All tools are automatically namespaced to prevent collisions:

| Server | Original Tool | Namespaced Tool |
|--------|--------------|-----------------|
| filesystem | `read_file` | `filesystem__read_file` |
| memory | `create_entities` | `memory__create_entities` |
| desktop-commander | `execute_command` | `desktop-commander__execute_command` |
| chrome-devtools | `navigate_page` | `chrome-devtools__navigate_page` |

### Example: Call a Namespaced Tool```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "filesystem__read_file",
    "arguments": {
      "path": "/home/user/document.txt"
    }
  }
}

Production Features

Circuit Breaker Pattern

Protects against cascading failures:```
States: CLOSED → OPEN → HALF_OPEN → CLOSED

  • Failure threshold: 5 consecutive failures
  • Recovery timeout: 30 seconds
  • Success threshold: 2 successes to close

Check circuit breaker status:```bash
curl -H "Authorization: Bearer $TOKEN" https://your-domain.com/admin/servers/filesystem | jq '.data.circuitBreaker'

Retry Logic with Exponential Backoff```

Retry 1: 1000ms + jitter
Retry 2: 2000ms + jitter
Retry 3: 4000ms + jitter
Max delay: 30000ms


### Request Correlation

Every request gets a unique ID for tracing:```bash
# Request
curl -H "Authorization: Bearer $TOKEN" https://your-domain.com/admin/health

# Response includes x-request-id header
# Logs include requestId for correlation

Persistent Configuration

Server changes via API are automatically saved to disk:```bash

Register server (automatically saved to gateway.json)

curl -X POST https://your-domain.com/admin/servers \

…(正文过长,页面只展示前面部分,完整内容见仓库)
```

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
MCP Gateway 75f126b1 怎么安装?

在客户端按下面的安装命令接入:docker run -p 8080:8080 \。装完在客户端配置里引用同一个包或端点。

MCP Gateway 75f126b1 怎么在 Claude Desktop、Claude 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

MCP Gateway 75f126b1 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

MCP Gateway 75f126b1 需要 API Key 吗?

资料标注需要OAuth 授权认证,使用前准备好对应凭据,并按最小权限配置。

MCP Gateway 75f126b1 支持哪些客户端?

资料标注支持 Claude Desktop、Claude;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

MCP Gateway 75f126b1 能提供哪些能力?

资料显示约 40 个工具;能力标签包括 TypeScript、Claude、生产就绪。具体工具清单以官方文档为准。

MCP Gateway 75f126b1 需要什么运行环境?

运行时为 Docker;属于本地进程,需要在本机装好运行环境。

MCP Gateway 75f126b1 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。