原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

Agent MCP Gateway

作者:roddutra版本 0.2.5i★ –i在你的电脑上运行
注册名称io.github.roddutra/agent-mcp-gateway

安装

概览

作者提供的说明(英文原文)

On-demand tool discovery for all your MCPs and per-subagent MCP controls to preserve context window.

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: stdio
  • 分类: 其他

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 需要你自己填写: GATEWAY_MCP_CONFIG, GATEWAY_RULES, GATEWAY_DEFAULT_AGENT, GATEWAY_DEBUG

你需要

  • PyPI已安装 Python 的 uv(用于 uvx 命令)

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

{
  "mcpServers": {
    "agent-gateway": {
      "command": "uvx",
      "args": [
        "agent-mcp-gateway"
      ],
      "env": {
        "GATEWAY_MCP_CONFIG": "your-value",
        "GATEWAY_RULES": "your-value",
        "GATEWAY_DEFAULT_AGENT": "your-value",
        "GATEWAY_DEBUG": "your-value"
      }
    }
  }
}

在终端中运行这条命令

claude mcp add agent-gateway --env GATEWAY_MCP_CONFIG=your-value --env GATEWAY_RULES=your-value --env GATEWAY_DEFAULT_AGENT=your-value --env GATEWAY_DEBUG=your-value -- uvx agent-mcp-gateway

运行前请先填写空着的值。

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

{
  "mcpServers": {
    "agent-gateway": {
      "command": "uvx",
      "args": [
        "agent-mcp-gateway"
      ],
      "env": {
        "GATEWAY_MCP_CONFIG": "your-value",
        "GATEWAY_RULES": "your-value",
        "GATEWAY_DEFAULT_AGENT": "your-value",
        "GATEWAY_DEBUG": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "agent-gateway": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "agent-mcp-gateway"
      ],
      "env": {
        "GATEWAY_MCP_CONFIG": "your-value",
        "GATEWAY_RULES": "your-value",
        "GATEWAY_DEFAULT_AGENT": "your-value",
        "GATEWAY_DEBUG": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

需要你填写的值

  • GATEWAY_MCP_CONFIG env
    Path to MCP servers configuration file (default: .mcp.json)
  • GATEWAY_RULES env
    Path to gateway access control rules file (default: .mcp-gateway-rules.json)
  • GATEWAY_DEFAULT_AGENT env
    Default agent ID when not provided in tool calls
  • GATEWAY_DEBUG env
    Enable debug mode and expose diagnostic tools (default: false)

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月7日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 roddutra 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“其他”中的其他服务器比较i

  • 星标数多于此分类中其他 32727 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 32727 个服务器的 1% 更新
  • 基础检查结果等于或优于此分类中其他 32727 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Agent MCP Gateway 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(0.2.5)于11个月前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。

有什么可以替代它?

同一分类中有:Spec Driven Development, Remote Desktop Commander, Foliosio

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

Spec Driven Development

作者:formulahendry

MCP Server that facilitates spec-driven development workflows, not just Vibe Coding.

在你的电脑上运行★ 440MIT14个月前更新
安装

Remote Desktop Commander

作者:desktop-commander

Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.

在云端运行★ 211前天更新
安装

Foliosio

作者:foliosio.com

Read your support inbox, tag conversations and save draft replies from your AI agent. Never sends.

在云端运行今天更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

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
  • Installation
  • Quick Start
  • Command-Line Options
  • Configuration File Discovery
  • Configuration
  • Usage
  • Gateway Tools
  • Security Considerations
  • Troubleshooting
  • Testing
  • Development
  • Architecture
  • Future Features
  • Documentation
  • Contributing
  • License
  • Support
  • Acknowledgments

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.

[View detailed diagram with examples →](docs/diagram-full.png) (includes downstream servers, tools, and gateway rules examples)

Key Features
  • ✅ On-Demand Tool Discovery - Load tool definitions only when needed
  • ✅ Per-Agent Access Control - Configure which servers/tools each agent can access
  • ✅ Easy Agent Integration - Simple template to add gateway support to any agent (see guide)
  • ✅ Deny-Before-Allow Policies - Explicit deny rules take precedence
  • ✅ Wildcard Support - Pattern matching for tool names (get_*, *_user)
  • ✅ Session Isolation - Concurrent requests don't interfere
  • ✅ Transparent Proxying - Downstream servers unaware of gateway
  • ✅ Audit Logging - All operations logged for monitoring
  • ✅ Performance Metrics - Track latency and error rates per agent/operation
  • ✅ Hot Configuration Reload - Update rules/servers without restart
  • ✅ Thread-Safe Operations - Safe concurrent access during reloads
  • ✅ Diagnostic Tools - Health monitoring via get_gateway_status (debug mode only)

Installation

# Creates ~/.config/agent-mcp-gateway/ with template configuration files

uvx agent-mcp-gateway --init

This generates two template files ready to customize:

  • mcp.json - Your downstream MCP servers (Brave, Postgres, etc.)
  • mcp-gateway-rules.json - Per-agent access policies (who can use which servers/tools)

For local development: See Development section.

Quick Start

1. Configure Gateway Files

After running uvx agent-mcp-gateway --init (see Installation), edit the generated template files:

# Define your downstream MCP servers

nano ~/.config/agent-mcp-gateway/.mcp.json

Define agent access policies

nano ~/.config/agent-mcp-gateway/.mcp-gateway-rules.json

See Configuration section for detailed examples and Configuration File Discovery for alternative file locations.

2. Add Gateway to Your MCP Client

Claude Code CLI:

claude mcp add agent-mcp-gateway uvx agent-mcp-gateway

Manual configuration:

{

"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" } } } }

Note: The env variables are optional if using default config locations. See Environment Variables Reference for all options.

3. Configure Your Agents

The gateway's tool descriptions are self-documenting, but for proper access control you should configure how your agents identify themselves. Choose the approach that fits your use case:

Approach 1: Multi-Agent Mode (Recommended)

For different agents with different permissions, configure each agent to pass its identity.

Add this to your agent's system prompt (e.g., CLAUDE.md, .claude/agents/agent-name.md):

## MCP Gateway Access

Available Tools (via agent-mcp-gateway):

You have access to MCP servers through the agent-mcp-gateway. The specific servers and tools available to you are determined by the gateway's access control rules.

Tool Discovery Process:

When you need to use tools from downstream MCP servers:

  1. Use agent_id: "YOUR_AGENT_NAME" in ALL gateway tool calls for proper access control
  2. Call list_servers to discover which servers you have access to
  3. Call get_server_tools with the specific server name to discover available tools
  4. Use execute_tool to invoke tools with appropriate parameters
  5. If you cannot access a tool you need, immediately notify the user

Important: Always include agent_id: "YOUR_AGENT_NAME" in your gateway tool calls. This ensures proper access control and audit logging.

Replace YOUR_AGENT_NAME with your agent's identifier (e.g., "researcher", "backend", "admin").

Examples: See .claude/agents/researcher.md and .claude/agents/mcp-developer.md for complete configuration examples.

Approach 2: Single-Agent Mode

For simpler setups where all agents should have the same permissions, or when using MCP clients without system prompt configuration (e.g., Claude Desktop), configure a default agent using either method:

Option A: Environment Variable

# Set in your MCP client configuration

export GATEWAY_DEFAULT_AGENT=developer

**Note:** The agent specified (e.g., "developer") must exist in your `.mcp-gateway-rules.json` file with appropriate permissions.

Option B: "default" Agent in Rules

{

"agents": { "default": { "allow": { "servers": ["*"] } } }, "defaults": { "deny_on_missing_agent": false } }

**Note:** Allowing all servers (`"servers": ["*"]`) without specifying tool restrictions grants access to all tools on all servers.

With either approach, agents can omit agent_id in tool calls - the gateway uses your configured default agent automatically.

Command-Line Options

# Show version

agent-mcp-gateway --version

Initialize config directory (first-time setup)

agent-mcp-gateway --init

Enable debug mode (exposes get_gateway_status diagnostic tool)

agent-mcp-gateway --debug

Show help

agent-mcp-gateway --help

Configuration File Discovery

The gateway searches for configuration files in this order:

MCP Server Config (.mcp.json)
  1. GATEWAY_MCP_CONFIG environment variable (if set)
  2. .mcp.json in current directory
  3. ~/.config/agent-mcp-gateway/.mcp.json (home directory)
  4. ./config/.mcp.json (fallback)
Gateway Rules (.mcp-gateway-rules.json)
  1. GATEWAY_RULES environment variable (if set)
  2. .mcp-gateway-rules.json in current directory
  3. ~/.config/agent-mcp-gateway/.mcp-gateway-rules.json (home directory)
  4. ./config/.mcp-gateway-rules.json (fallback)

Tip: Use agent-mcp-gateway --init to create the home directory configs on first run.

Configuration

The gateway requires two configuration files:

1. MCP Servers Configuration

File: mcp.json (searched in multiple locations)

Defines the downstream MCP servers the gateway will proxy to. Uses the standard MCP config format compatible with Claude Code and other coding agents:

{

"mcpServers": { "brave-search": { "description": "Web search via Brave Search API", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-brave-search"], "env": { "BRAVE_API_KEY": "${BRAVE_API_KEY}" } }, "postgres": { "description": "PostgreSQL database access and query execution", "command": "uvx", "args": ["mcp-server-postgres"], "env": { "DATABASE_URL": "${DATABASE_URL}" } }, "remote-server": { "description": "Custom remote API integration", "url": "https://example.com/mcp", "transport": "http", "headers": { "Authorization": "Bearer ${API_TOKEN}" } } } }

Server Descriptions (Recommended): Adding a description field to each server helps AI agents understand what each server provides and when to use it. Descriptions are always returned by list_servers, enabling agents to make informed decisions about which servers to query for tools. While optional, descriptions significantly improve agent tool discovery and decision-making.

Supported Transports:

  • stdio - Local servers via npx/uvx (specified with command + args)
  • http - Remote HTTP servers (specified with url)

Environment Variables:

  • Use ${VAR_NAME} syntax for environment variable substitution
  • Set variables before running: export BRAVE_API_KEY=your-key

Important - GUI Applications (Claude Desktop, etc.): If you use ${VAR_NAME} syntax in .mcp.json, note that macOS GUI applications run in isolated environments without access to your shell's environment variables. For Claude Desktop and similar apps, add API keys to the gateway's env object in your MCP client configuration:

{

"mcpServers": { "agent-mcp-gateway": { "command": "uvx", "args": ["agent-mcp-gateway"], "env": { "BRAVE_API_KEY": "your-actual-key-here", "DATABASE_URL": "postgresql://...", "GATEWAY_DEFAULT_AGENT": "claude-desktop" } } } }

(If you hardcode values directly in .mcp.json without ${VAR_NAME} syntax, this is not necessary.)

2. Gateway Rules Configuration

File: mcp-gateway-rules.json (searched in multiple locations)

Defines per-agent access policies using deny-before-allow precedence:

{

"agents": { "researcher": { "allow": { "servers": ["brave-search", "context7"], "tools": {

只显示了开头部分;其余内容请在仓库中阅读

问 PopNx