MCP网关聚合器

Porter是一个将多个MCP服务器聚合为统一接口的网关工具,支持STDIO和HTTP传输协议,适用于多工具集成场景。

  • by Layer-Prime-Solutions
  • Rust
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Layer-Prime-Solutions/nimbus-porter

使用说明

 ████████   ██████   ████████  ████████  ████████  ████████
 ██    ██  ██    ██  ██    ██     ██     ██        ██    ██
 ████████  ██    ██  ████████     ██     ██████    ████████
 ██        ██    ██  ██  ██       ██     ██        ██  ██
 ██         ██████   ██    ██     ██     ████████  ██    ██

Standalone MCP Gateway

Part of the Nimbus Ecosystem


Porter将多个MCP服务器聚合到一个统一的MCP端点中。单独使用 porter serve 或 porter stdio,或作为 雨云 平台。

波特是什么?

Porter是一个库和二进制文件,它在单个MCP接口后面聚合了多个MCP服务器:

  • MCP服务器:通过STDIO或流式HTTP传输管理外部MCP服务器,命名空间隔离其工具以防止名称冲突

无需任何Nimbus基础设施即可独立工作。直接连接任何MCP客户端。

安装

cargo install nimbus-porter-cli

从源代码构建:

git clone https://github.com/Layer-Prime-Solutions/porter
cd porter
cargo build --release
# Binary is at ./target/release/porter

快速开始

1.创建一个 porter.toml 配置文件 (或复制示例: cp porter.example.toml porter.toml):

# MCP servers (STDIO or HTTP transports)
[servers.github-mcp]
slug = "gh-mcp"
transport = "stdio"
command = "gh-mcp"

[servers.context7]
slug = "c7"
transport = "http"
url = "https://mcp.context7.com/mcp"

2.启动波特:

porter serve

输出:

Porter HTTP server listening host=127.0.0.1 port=3000
Connect your MCP client to http://127.0.0.1:3000/mcp

3.连接您的MCP客户端 到 http://127.0.0.1:3000/mcp

来自所有已配置服务器的所有工具都可以在该单一端点上使用。

配置

波特配置使用 porter.toml (或通过自定义路径 --config).

听

为设置默认绑定地址和端口 porter serve.CLI标志 --host 和 --port 在提供时覆盖这些。

[listen]
host = "127.0.0.1"    # Default: "127.0.0.1"
port = 3000            # Default: 3000

MCP 服务器

[servers.<name>]
slug = "unique-id"          # Required: identifier used as tool namespace prefix
transport = "stdio"         # "stdio" or "http"
enabled = true              # Optional: default true

# For stdio transport:
command = "my-mcp-server"   # Required for stdio
args = ["--verbose"]        # Optional extra args
env.MY_VAR = "${MY_VAR}"   # Optional env vars (must use ${VAR} syntax)
cwd = "/path/to/dir"       # Optional working directory

# For http transport:
url = "https://mcp.example.com/mcp"  # Required for http

# Tool access gate (optional, applies to any transport):
allow = ["get_*", "search_*"]   # If present, ONLY matching tools are exposed
deny  = ["*delete*", "merge_*"] # Matching tools are always blocked

工具检修门

每个服务器都接受可选 allow 和 deny 列出了那扇门 波特公开的工具。大门在 两者 方向:拒绝使用工具 在聚合工具列表中隐藏 和 在任何呼叫被拒绝之前 转发到下游服务器(波特从不代理然后过滤)。

匹配应用于下游(无命名空间)工具名称。每个条目都是 一个确切的名字或一个简单的glob:

模式 匹配 示例
name 完全匹配 merge_pull_request
prefix* 前缀匹配 jira_get_*
*suffix 后缀匹配 *_issue
*inner* 子字符串匹配 *delete*

这个 * 通配符受到尊重 仅 作为单一的领先和/或落后 字符(上述四种形式)。A. * 其他任何地方——像室内明星一样 delete*confirm,或加倍 **abc --将被视为字面意思 默默地什么都不匹配,所以波特 在启动时拒绝此类模式 相当 然后失败打开。

允许使用工具 当且仅当 (allow 省略 或 它匹配A allow 条目) 和 它匹配 不 deny 进入。 拒绝总是胜过允许 — 两者中列出的工具都被阻止(Porter在启动时记录警告)。没有 allow/deny 配置后,每个后端工具都被代理。一个明确的空 列表(allow = [])堵塞所有工具。光秃秃的 * 匹配一切。

被阻止的工具永远不会到达后端:对一个工具的调用被Porter拒绝 命名工具、服务器和原因时出现访问策略错误。

通用执行器:有些服务器将整个API放在单个API后面 “运行此命令”工具(例如。 awslabs.aws-api-mcp-servers call_aws). 波特的门匹配工具 名字,因此在以下情况下无法区分读和写 两者都包含在一个工具中——对于这些服务器,使用 服务器自己的交换机(例如。 READ_OPERATIONS_ONLY=true).

完整示例

[servers.filesystem]
slug = "fs"
transport = "stdio"
command = "mcp-server-filesystem"
args = ["/home/user/projects"]

[servers.github-mcp]
slug = "gh-mcp"
transport = "stdio"
command = "gh-mcp"
env.GITHUB_TOKEN = "${GITHUB_TOKEN}"

用法

搬运工服务

启动流式HTTP MCP服务器:

# Default: localhost:3000, config from porter.toml
porter serve

# Custom config, port, and host
porter serve --config my-tools.toml --port 8080 --host 0.0.0.0

选项:

  • --config / -c:配置文件的路径(默认值: ./porter.toml 或 ~/.config/porter/porter.toml)
  • --port / -p:HTTP端口(覆盖 [listen].port 从配置;违约: 3000)
  • --host:绑定地址(覆盖 [listen].host 从配置;违约: 127.0.0.1)

热重载:Porter会查看配置文件是否有更改。编辑时 porter.toml,Porter会自动重新加载工具表面并发送 tools/list_changed 通知所有连接的MCP客户端——无需重新启动。

MCP端点: http://<host>:<port>/mcp

波特标准

为Claude Desktop和其他基于STDIO的MCP客户端在STDIO上桥接所有配置的工具:

porter stdio
porter stdio --config /path/to/porter.toml

选项:

  • --config / -c:配置文件的路径(默认值: ./porter.toml 或 ~/.config/porter/porter.toml)

热重载:与 porter serve --Porter监视配置文件的更改,并发送 tools/list_changed 自动向连接的客户端发送通知。无需重新启动。

客户端配置

Porter按以下顺序搜索配置: ./porter.toml 然后 ~/.config/porter/porter.toml。如果您将配置放在 ~/.config/porter/porter.toml,以下示例在没有 --config.

Claude 代码

claude mcp add porter -- porter stdio

或者使用显式配置路径:

claude mcp add porter -- porter stdio --config ~/.config/porter/porter.toml

Claude 桌面版

增添 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "porter": {
      "command": "porter",
      "args": ["stdio"]
    }
  }
}

光标

添加到光标MCP设置(.cursor/mcp.json):

{
  "mcpServers": {
    "porter": {
      "command": "porter",
      "args": ["stdio"]
    }
  }
}

VS代码/副本

增添 .vscode/mcp.json:

{
  "servers": {
    "porter": {
      "type": "stdio",
      "command": "porter",
      "args": ["stdio"]
    }
  }
}

帆板运动

增添 ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "porter": {
      "command": "porter",
      "args": ["stdio"]
    }
  }
}

任何可流式传输的HTTP客户端

开始 porter serve 并连接到端点:

http://127.0.0.1:3000/mcp

用例食谱

porter.example.toml 包括用于通过MCP服务器将AI代理连接到流行的项目管理、代码审查和云基础设施平台的即开即用配置块。每个配方都按访问层记录了每个公开的工具,默认情况下都是只读的 deny 你可以放松的清单。

访问层

层级 默认值 描述 示例
阅读 启用 被动观察-无副作用 搜索、列表、获取、查看、差异
反馈 已启用 参与工作流而不会产生破坏性的副作用 创建问题、添加评论、更新标签/状态
破坏性的 拒绝 不可逆或高影响操作 删除、合并、关闭、存档
代码写入 拒绝 源代码发生重大突变 推送文件、创建分支、分叉仓库

每个食谱都有一个 deny 列表(参见 工具检修门)这阻碍了它 破坏性的 和 代码写入 开箱即用的工具,所以 阅读 和 反馈 默认情况下,工具是唯一公开的。要重新选择一个被阻止的工具,请从该服务器的行中删除它 deny 在审查了影响后列出。

可用食谱

平台 包装 运输 认证
GitHub @modelcontextprotocol/server-github 工作室 GITHUB_TOKEN
GitLab @modelcontextprotocol/server-gitlab 工作室 GITLAB_TOKEN (+可选 GITLAB_API_URL)
线性 mcp-remote → https://mcp.linear.app/sse STDIO(远程网桥) OAuth(浏览器流)
吉拉 mcp-atlassian (通过 uvx(工作室。 JIRA_URL + JIRA_USERNAME + JIRA_API_TOKEN
点击起来 clickup-mcp-server 工作室 CLICKUP_API_KEY + CLICKUP_TEAM_ID
AWS awslabs.aws-api-mcp-server (通过 uvx(工作室。 AWS_PROFILE (+ READ_OPERATIONS_ONLY=true 只读)

要使用配方:打开 porter.example.toml,找到平台块,取消注释,设置所需的环境变量,并将其复制到您的 porter.toml.

备注:这些是由各自社区维护的第三方MCP服务器。在将每台服务器暴露给生产环境中的AI代理之前,请先查看其文档和安全状况。

安全

  • 工具名称间距:每个服务器的工具都以其slug作为前缀,以防止名称冲突
  • 工具检修门:每台服务器 allow/deny 列表将被阻止的工具隐藏在列表中,并在它们到达下游服务器之前将其拒绝(详情)
  • 环境隔离:子STDIO服务器可以 不 继承波特的环境。每个孩子都从一个只有最低基线的干净环境开始(PATH, HOME, LANG)加上其声明中的变量 env 阻止——波特自己的秘密永远不会泄露到下游
  • 健康跟踪:不健康的服务器将自动从工具列表和调用中排除
  • 热重载:配置更改会自动获取,无需重新启动

许可证

根据您的选择,在MIT或Apache-2.0下获得许可。