/ 目錄 / 演練場 / Agent Gateway
● 社群 agentgateway ⚡ 即開即用

Agent Gateway

作者 agentgateway · agentgateway/agentgateway

在所有 MCP 伺服器前部署一個代理——以 Rust 實作的可插拔驗證、請求塑形、可觀測性與熔斷器。

Agent Gateway 是一個專為 MCP 和 LLM 流量設計的高效能代理。它終止驗證、套用每條路由的政策、發出追蹤資料,並提供熔斷功能。當你有超過兩個 MCP 伺服器並希望集中管控時非常有用。

為什麼要用

核心特性

即時演示

實際使用效果

就緒

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "agentgateway": {
      "command": "docker",
      "args": [
        "run",
        "-p",
        "3000:3000",
        "ghcr.io/agentgateway/agentgateway:latest"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "agentgateway": {
      "command": "docker",
      "args": [
        "run",
        "-p",
        "3000:3000",
        "ghcr.io/agentgateway/agentgateway:latest"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "agentgateway": {
      "command": "docker",
      "args": [
        "run",
        "-p",
        "3000:3000",
        "ghcr.io/agentgateway/agentgateway:latest"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "agentgateway": {
      "command": "docker",
      "args": [
        "run",
        "-p",
        "3000:3000",
        "ghcr.io/agentgateway/agentgateway:latest"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "agentgateway",
      "command": "docker",
      "args": [
        "run",
        "-p",
        "3000:3000",
        "ghcr.io/agentgateway/agentgateway:latest"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "agentgateway": {
      "command": {
        "path": "docker",
        "args": [
          "run",
          "-p",
          "3000:3000",
          "ghcr.io/agentgateway/agentgateway:latest"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add agentgateway -- docker run -p 3000:3000 ghcr.io/agentgateway/agentgateway:latest

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: Agent Gateway

以單一驗證介面統一多個 MCP 伺服器

👤 開發者 ⏱ ~15 min intermediate

何時使用: 你有 5 個以上的內部 MCP,將設定複製給每位開發者非常痛苦。

步驟
  1. 部署閘道
    將 agentgateway 部署在你的 IdP 後方。✓ 已複製
    → 登入成功
  2. 註冊後端
    為每個 MCP 伺服器新增路由與政策。✓ 已複製
    → 後端列表顯示
  3. 指向客戶端
    開發者將 Claude 指向 https://mcp.corp/。✓ 已複製
    → 單一設定完成

結果: MCP 流量的集中控制平面。

組合

與其他 MCP 搭配,撬動十倍槓桿

agentgateway + mcp-gateway-registry

使用 registry 作為探索 UI;此閘道負責低延遲路由

結合 agentgateway 與 mcp-gateway-registry:使用 registry 作為探索 UI;此閘道負責低延遲路由✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
gateway-passthrough (詳見文件) 轉發至已註冊的後端 MCP 1 次呼叫

成本與限制

運行它的成本

API 配額
受限於主機
每次呼叫 Token 數
透傳
費用
免費開源;你的主機費用自付
提示
啟用熔斷器——可避免級聯故障帶來的損耗

安全

權限、密鑰、影響範圍

憑證儲存: 驗證金鑰存放在 vault
資料出站: 你註冊的後端

故障排查

常見錯誤與修復

p99 延遲過高

停用不必要的外掛;agentgateway 本身很快,但外掛會累積延遲

替代方案

Agent Gateway 對比其他方案

替代方案何時用它替代權衡
mcp-context-forge你想使用 IBM 的替代方案不同的維運模式

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills