预算控制代理工具

一款用于在AI代理工具使用中实施硬性预算控制的代理服务,适用于个人和团队环境。

  • by SatGate-io
  • JavaScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 SatGate-io/satgate-proxy

使用说明

卫星门代理

预算强制的MCP代理——严格限制你的AI代理工具的支出。

MCP服务器是开放式的。每 tools/call 这需要花钱,而且没有内置的支出限制。 satgate-proxy 位于MCP客户端(Claude Desktop、Cursor)和服务器之间,强制执行硬预算上限。

零依赖。仅内置Node.js。 npx 然后走。

快速启动-本地模式(v0.3.0中的新功能)

没有服务器,没有API密钥,没有帐户。正在执行的预算:

npx satgate-proxy --local --budget 5.00 \
  --server @modelcontextprotocol/server-google-search

或者使用配置文件:

# satgate.yaml
server: @modelcontextprotocol/server-google-search
budget: 5.00

mcp_pricing:
  web_search: 5
  dalle_generate: 50
  '*': 1
npx satgate-proxy --local --config satgate.yaml

Claude桌面配置(本地模式):

{
  "mcpServers": {
    "google-search": {
      "command": "npx",
      "args": [
        "satgate-proxy",
        "--local", "--budget", "5.00",
        "--server", "@modelcontextprotocol/server-google-search"
      ]
    }
  }
}

不需要环境变量。没有账户。只是一个预算上限。

SaaS模式(团队和企业)

对于L402 macarons的服务器端执行:

{
  "mcpServers": {
    "google-search": {
      "command": "npx",
      "args": [
        "satgate-proxy",
        "--cap", "5.00",
        "--server", "@modelcontextprotocol/server-google-search"
      ],
      "env": {
        "SATGATE_API_KEY": "your_macaroon_here"
      }
    }
  }
}

获取API密钥: cloud.satgate.io.

运作原理

本地模式

┌──────────────┐     stdio      ┌────────────────┐     stdio      ┌──────────────┐
│ Claude       │ ──── JSON-RPC ──▶ satgate-proxy  │ ──── JSON-RPC ──▶ MCP Server  │
│ Desktop      │ ◀── JSON-RPC ── │ (budget gate)  │ ◀── JSON-RPC ── │ (child proc) │
│ / Cursor     │                 └────────────────┘                 └──────────────┘
└──────────────┘                  ↑ intercepts tools/call
                                  ↑ deducts from budget
                                  ↑ blocks when exhausted

代理将您的MCP服务器作为子进程生成,拦截每个 tools/call,根据每个工具的定价从预算中扣除,并在预算用完时阻止通话。

SaaS模式

┌──────────────┐     stdio      ┌────────────────┐     SSE/HTTP     ┌──────────────┐
│ Claude       │ ──── JSON-RPC ──▶ satgate-proxy  │ ──── JSON-RPC ──▶ SatGate      │
│ Desktop      │ ◀── JSON-RPC ── │ (this package) │ ◀── JSON-RPC ── │ MCP Proxy    │
│ / Cursor     │                 └────────────────┘                  │ + Budget     │
└──────────────┘                                                     │ Enforcement  │
                                                                     └──────┬───────┘
                                                                            │
                                                                     ┌──────▼───────┐
                                                                     │ MCP Server   │
                                                                     │ (hosted)     │
                                                                     └──────────────┘

配置文件(satgate.yaml)

您可以使用配置文件代替CLI标志:

# satgate.yaml
server: @modelcontextprotocol/server-google-search
budget: 5.00

mcp_pricing:
  web_search: 5        # 5 cents per search
  dalle_generate: 50   # 50 cents per image
  '*': 1               # 1 cent default for unlisted tools

定价在 分The '*' 通配符为任何未明确列出的工具设置默认成本。

CLI标志

标志 描述 默认值
--server <package> MCP服务器包到代理(必需) --
--local 在本地模式下运行(不需要SatGate服务器) 关闭
--budget <amount> 美元预算上限(本地模式) 无限制
--config <path> 通往 satgate.yaml 配置文件 --
--cap <amount> 预算上限(美元)(SaaS模式) --
--endpoint <url> SatGate代理端点 https://satgate-mcp-saas.fly.dev
--key <macaroon> API密钥(或 SATGATE_API_KEY env)
--verbose 调试日志记录到stderr off
-h, --help 显示帮助 --

为什么?

MCP允许AI代理直接访问付费API——搜索、代码执行、数据库,应有尽有。没有内置的支出限制。一个逃跑的特工可以在几分钟内烧掉数百美元。

卫星门代理 添加了一个硬帽:

  • 本地模式:设置 --budget 5.00 → 代理人最多可以花费5美元,在过程中强制执行
  • SaaS模式:设置 --cap 5.00 → 使用L402 macarons在服务器端强制执行
  • 零依赖-- npx 立即运行它

零依赖

此包仅使用Node.js内置(child_process, http, https, fs).不 node_modules,无安装步骤。 npx satgate-proxy 只是工作。

链接

许可证

麻省理工学院