/ 目录 / 演练场 / Agent Gateway
● 社区 agentgateway ⚡ 即开即用

Agent Gateway

作者 agentgateway · agentgateway/agentgateway

在所有 MCP server 前放一个代理——可插拔认证、请求整形、可观测性和熔断器,全部用 Rust 实现。

Agent Gateway 是专为 MCP 和 LLM 流量设计的高性能代理。它负责终止认证、应用逐路由策略、输出追踪,并提供熔断机制。当你拥有两个以上的 MCP server 并希望集中管控时,它非常有用。

为什么要用

核心特性

实时演示

实际使用效果

就绪

安装

选择你的客户端

~/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 server

👤 开发者 ⏱ ~15 min intermediate

何时使用: 你有 5 个以上的内部 MCP,把配置复制给每个开发者太麻烦了。

步骤
  1. 部署网关
    Run agentgateway behind your IdP.✓ 已复制
    → 登录正常
  2. 注册后端
    Add each MCP server with route and policy.✓ 已复制
    → 后端列表展示
  3. 指向客户端
    Devs point Claude at https://mcp.corp/.✓ 已复制
    → 单一配置入口

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

组合

与其他 MCP 搭配,撬动十倍杠杆

agentgateway + mcp-gateway-registry

用 registry 提供发现 UI,用此 gateway 做低延迟路由

Combine agentgateway with mcp-gateway-registry: Use registry for discovery UI; this for low-latency routing✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
gateway-passthrough (见文档) 转发至已注册的后端 MCP 1 次调用

成本与限制

运行它的成本

API 配额
受托管资源限制
每次调用 Token 数
透传,无额外消耗
费用
免费开源;自行承担托管费用
提示
开启熔断器——可避免级联故障带来的额外消耗

安全

权限、密钥、影响范围

凭据存储: 认证密钥存于 vault
数据出站: 你注册的后端服务

故障排查

常见错误与修复

p99 延迟偏高

禁用不必要的插件;agentgateway 本身很快,但插件会累积延迟

替代方案

Agent Gateway 对比其他方案

替代方案何时用它替代权衡
mcp-context-forge你想用 IBM 的替代方案运维模式不同

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills