RA

roddutra/agent-mcp-gateway

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

42 stars 5 forks 质量 73 趋势 0MIT

roddutra/agent-mcp-gateway 是从 https://github.com/roddutra/agent-mcp-gateway. 导入的 MCP 服务器候选

概览

roddutra/agent-mcp-gateway 是从 https://github.com/roddutra/agent-mcp-gateway. 导入的 MCP 服务器候选

概述(AI 翻译)

一个模型上下文协议(MCP)网关,聚合多个MCP服务器,并为代理和子代理提供基于策略的访问控制。通过实现按需工具发现,而非一开始加载所有工具定义,解决了Claude Code的MCP上下文窗口浪费。

状态

  • ✅ M0:Foundation - 配置、策略引擎、审计日志、list_servers工具
  • ✅ M1:核心 - 代理基础设施、get_server_tools、execute_tool、中间件、指标、热重载、OAuth 支持
  • 🚧 M2:生产 - HTTP 传输,健康检查(计划中)
  • 🚧 M3:DX - 单代理模式、配置验证CLI、Docker(计划中)

当前版本: M1核心完整版(含OAuth)

目录

  • 概述
  • 安装
  • 快速入门
  • 命令行选项
  • 配置文件发现
  • 配置
  • 使用情况
  • 网关工具
  • 安全考量
  • 故障排除
  • 测试
  • 发展
  • 建筑学
  • 未来功能
  • 文档
  • 贡献
  • 许可证
  • 支持
  • 致谢

概述

问题

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Agent MCP Gateway

A Model Context Protocol (MCP) gateway that aggregates multiple MCP servers and provides policy-based access control for agents and subagents. Solves Claude Code’s MCP context window waste by enabling on-demand tool discovery instead of loading all tool definitions upfront.

Status

  • ✅ M0: Foundation - Configuration, policy engine, audit logging, list_servers tool
  • ✅ M1: Core - Proxy infrastructure, get_server_tools, execute_tool, middleware, metrics, hot reload, OAuth support
  • 🚧 M2: Production - HTTP transport, health checks (planned)
  • 🚧 M3: DX - Single-agent mode, config validation CLI, Docker (planned)

Current Version: M1-Core Complete (with OAuth)

Table of Contents

Overview

The Problem

When multiple MCP servers are configured in development environments (Claude Code, Cursor, VS Code), all tool definitions from all servers load into every agent’s and subagent’s context window at startup:

  • 5,000-50,000+ tokens consumed upfront
  • 80-95% of loaded tools never used by individual agents
  • Context needed for actual work gets wasted on unused tool definitions

The Solution

The Agent MCP Gateway acts as a single MCP server that proxies to multiple downstream MCP servers based on configurable per-agent rules:

  • 3 gateway tools load at startup (~2k tokens)
  • Agents discover and request specific tools on-demand
  • 90%+ context reduction
  • Policy-based access control per agent/subagent

How It Works

The gateway sits between agents and downstream MCP servers, exposing only 3 lightweight tools. When an agent needs specific functionality, it discovers available servers and tools through the gateway, which filters visibility based on policy rules - agents only see servers and tools they have access to. This reduces each agent’s context window to only relevant tools, while the gateway handles proxying authorized requests to downstream servers.

在 GitHub 查看完整 README

安装

uvx agent-mcp-gateway
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "agent-mcp-gateway": { "command": "uvx", "args": ["agent-mcp-gateway"], "env": { "GATEWAY_MCP_CONFIG": "~/.config/agent-mcp-gateway/.mcp.json", "GATEWAY_RULES": "~/.config/agent-mcp-gateway/.mcp-gateway-rules.json", "GATEWAY_DEFAULT_AGENT": "developer" } } } }