Gatefareio

io.github.gatefareio由 GitHub 账号 gatefareio 发布v1.1.0更新于 Oct 27, 2026

Marketplace of paid HTTP APIs. USDC micropayments via x402 on Base. Non-custodial.

概览

AI 生成的概览

将 AI 助手接入 Gatefare 付费 HTTP API 市场,可搜索目录并通过 x402 在 Base 上以 USDC 按次付费调用。

可以做什么
  • 搜索、查看和浏览 API 目录:支持按价格与分类筛选的全文搜索、单个 API 详情、分类列表、自动补全
  • 发起付费 API 调用并自动处理 402 与本地签名,查询钱包余额,预估多次调用的总成本
  • 发布和管理自己的付费 API、查看收入,并触发链上分账打款
  • 举报恶意或被盗用的 API
  • 工具按已配置的凭据自动注册,助手不会看到无法使用的工具
适用场景
适合希望让助手发现并按次购买 HTTP API、无需订阅或 API 密钥的场景;也适合在 Gatefare 发布付费 API 的用户,在聊天客户端中管理接口并查看收入。
运行要求
通过 npx 运行 npm 包 @gatefare/mcp 的本地 Node.js 进程,需在 Claude Desktop、Cursor 等 MCP 客户端中配置。买方工具需要 WALLET_PRIVATE_KEY(EVM 私钥),可选 WALLET_BUDGET_USD 与 WALLET_NETWORK;发布方工具需要 GATEFARE_PAT。自建部署可用 GATEFARE_BASE_URL 覆盖地址。需要访问 Gatefare 与 Base 的网络。
安装前请注意
WALLET_PRIVATE_KEY 是真实的 EVM 私钥,用于签署 USDC 付款,持有者即可控制该钱包,建议使用专用的低余额钱包。付费调用默认在 Base 主网花费真实 USDC,WALLET_BUDGET_USD 只是运行时上限而非硬性限制。发布方工具会修改上架信息,distribute 会触发被标注为破坏性的链上打款。GATEFARE_PAT 可访问你的发布方账户。请求与付款头会发送至 Gatefare。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Gatefareio,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@gatefare/mcp

[npm version] [npm downloads] [bundle size] [License: MIT] [CI] [MCP Registry] [mcp.so] [Glama] [Base]

Give your AI agent a wallet and a marketplace.

@gatefare/mcp is a Model Context Protocol server that connects Claude Desktop, Cursor, or any MCP-compatible agent to the Gatefare catalog of paid HTTP APIs. Payments settle as USDC on Base via the open x402 standard — no SaaS keys, no subscriptions, no escrow. Non-custodial: signing happens locally; the private key never leaves your machine.

[Demo: install, list tools, real call against gatefare.io]

┌─────────────┐                ┌──────────────┐                ┌─────────────────┐│ Claude /    │   MCP stdio    │ @gatefare/mcp│  HTTP + x402   │ gatefare.io     ││ Cursor /    │ ─────────────► │   (this repo)│ ─────────────► │ proxy +         ││ your agent  │                │              │                │ catalog         │└─────────────┘                └──────┬───────┘                └─────────────────┘                                      │                                      │ EIP-3009 sign                                      ▼                                ┌─────────────┐                                │  Base USDC  │                                └─────────────┘

Quick start

1. Drop into your client

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{  "mcpServers": {    "gatefare": {      "command": "npx",      "args": ["-y", "@gatefare/mcp"]    }  }}

Cursor — ~/.cursor/mcp.json or project-level .cursor/mcp.json:

json
{  "mcpServers": {    "gatefare": {      "command": "npx",      "args": ["-y", "@gatefare/mcp"]    }  }}

Restart the client. The agent now has 5 read-only tools — discovery + safety. Try:

"Search Gatefare for weather APIs."

2. Add a wallet to make paid calls

Add env to the same config:

json
{  "mcpServers": {    "gatefare": {      "command": "npx",      "args": ["-y", "@gatefare/mcp"],      "env": {        "WALLET_PRIVATE_KEY": "0xYOUR_KEY",        "WALLET_BUDGET_USD": "5.00"      }    }  }}

Buyer tools (call_api, get_wallet_balance, estimate_cost) become available. The WALLET_BUDGET_USD cap is a runtime safety net — for a hard cap, fund the wallet with only what you're willing to spend.

"What's London's weather right now? Spend up to $0.001."

3. (Optional) Publish your own APIs

Get a PAT at gatefare.io/dashboard/tokens and add:

json
"env": {  "GATEFARE_PAT": "gfpat_..."}

Publisher tools (register_api, list_my_apis, update_api, get_revenue, distribute) appear.

"Publish my API at https://api.example.com/sentiment for $0.001 per call."

Tools

13 tools across 4 domains. Tools auto-register based on which env vars are set — the agent never sees a tool it can't use.

Discovery — always available

ToolDescription
gatefare.search_apisFull-text search the catalog with filters (price, category, sort)
gatefare.get_apiFull details for one API by slug or handle/urlName
gatefare.list_categoriesAll categories with API counts
gatefare.suggestAutocomplete suggestions for a query string

Buyer — needs WALLET_PRIVATE_KEY

ToolDescription
gatefare.call_apiMake a paid call. Handles 402 → sign → retry automatically
gatefare.get_wallet_balanceUSDC + ETH on Base, plus remaining runtime budget
gatefare.estimate_costProject total cost for N planned calls

Publisher — needs GATEFARE_PAT

ToolDescription
gatefare.register_apiPublish a new paid API
gatefare.list_my_apisYour published APIs with stats
gatefare.update_apiEdit metadata, price, target URL
gatefare.get_revenueRevenue time series + totals
gatefare.distributeTrigger on-chain distribute() payout (destructive)

Safety — always available

ToolDescription
gatefare.report_abuseReport a malicious / stolen API (DMCA, fraud, malware…)

Configuration

VarDefaultRequired for
GATEFARE_BASE_URLhttps://gatefare.io— (override for self-hosted)
WALLET_PRIVATE_KEY—Any buyer tool
WALLET_BUDGET_USDunlimitedOptional spend cap
WALLET_NETWORKeip155:8453eip155:84532 for Sepolia testnet
GATEFARE_PAT—Any publisher tool
LOG_LEVELinfodebug for verbose stderr

Examples

Discover & buy in one breath (Claude Desktop)

You: Find me a sub-$0.001 weather API and call it for "Tokyo".

Claude: Calling gatefare.search_apis with max_price: 0.001…
Found demo-weather by @alice at $0.001/call.
Calling gatefare.call_api with slug: "demo-weather", query: {city: "Tokyo"}…
Tokyo is 22°C, partly cloudy. Paid 0.001 USDC. Receipt: settled-tx-0x9a…

Programmatic — Python agent

python
from mcp import ClientSession, StdioServerParametersfrom mcp.client.stdio import stdio_client
server = StdioServerParameters(    command="npx",    args=["-y", "@gatefare/mcp"],    env={"WALLET_PRIVATE_KEY": "0x...", "WALLET_BUDGET_USD": "1.00"},)
async with stdio_client(server) as (r, w):    async with ClientSession(r, w) as s:        await s.initialize()        result = await s.call_tool(            "gatefare.call_api",            arguments={"slug": "demo-weather", "query": {"city": "Tokyo"}},        )        print(result.content[0].text)

See examples/ for runnable variants: Claude Desktop, Cursor, Python, TypeScript, and a pure-discovery walkthrough.

Not building an AI agent? Picking the right tool

If you want to pay for x402 APIs from a backend (no agent), use Coinbase's official x402 SDKs — x402-python (PyPI), coinbase/x402/go, …/java, or @x402/fetch. They handle the payment flow; you don't need this MCP server.

If you want to browse the Gatefare catalog from any language, hit the REST API directly: gatefare.io/api/catalog (OpenAPI 3.1 spec).

Full breakdown of which tool fits which use case in docs/integrations.md.

Direct CLI (for debugging)

bash
# Run the server in foreground; talks JSON-RPC over stdio.npx -y @gatefare/mcp
# In another terminal, send a frame:echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | \  npx -y @gatefare/mcp

Errors

Tool results include isError: true and a structured body { error: <code>, message: <human>, details?: <any> }. Codes are stable — agents can switch on them for retry / surfacing logic.

CodeMeaning
INVALID_INPUTInput failed zod validation
WALLET_NOT_CONFIGUREDSet WALLET_PRIVATE_KEY for buyer tools
PAT_NOT_CONFIGUREDSet GATEFARE_PAT for publisher tools
BUDGET_EXHAUSTEDRuntime budget cap hit
INSUFFICIENT_BALANCEWallet doesn't have enough USDC
PRICE_TOO_HIGHServer's price exceeds your max_price
API_NOT_FOUNDSlug doesn't exist or is suspended
UPSTREAM_ERRORPaid API returned non-2xx, or its 402 was malformed
RATE_LIMITEDGatefare rate-limited the request
NETWORK_ERRORCould not reach Gatefare
GATEFARE_API_ERRORGatefare returned a 4xx / 5xx

How it works (the 30-second version)

  1. The agent calls gatefare.call_api { slug: "demo-weather", … }.
  2. We GET https://gatefare.io/p/demo-weather (no payment yet).
  3. The Gatefare proxy returns 402 Payment Required with accepts: [{network, payTo, maxAmountRequired, …}].
  4. We sign an EIP-3009 transferWithAuthorization for that exact amount and recipient on the configured network.
  5. We retry the request with the signed X-Payment header (base64-encoded JSON, x402 v2).
  6. Gatefare verifies the signature, settles the USDC transfer, and proxies the call to the upstream API.
  7. We hand the upstream response (and a payment receipt) back to the agent.

The signature is single-use, time-bounded, and never leaves your machine for any purpose other than this exact transfer to this exact payTo. The private key is never logged.

Security

  • Non-custodial. Private keys live in your env, signing happens locally, no Gatefare service ever sees them.
  • Network confusion-resistant. A malicious gateway returning Sepolia-only requirements to a mainnet user is rejected — we never sign for a chain the user didn't configure.
  • Cryptographically random nonces. No Date.now()-based collisions.
  • Validity window clamped to 1 hour even if the server requests more.
  • Strict input validation. Slugs are ^[a-z0-9_-]+$ and URL-encoded; no path traversal. targetUrl blocks file://, localhost, cloud metadata IPs, .local, and .internal hosts at registration time.
  • Secret hygiene. Tests assert that the private key and PAT never appear in stderr / stdout, ever.

Development

bash
git clone https://github.com/gatefareio/mcp-server.gitcd mcp-servernpm installnpm run typechecknpm test                  # 138 unit testsnpm run test:e2e          # 10 e2e tests against live gatefare.io (set GATEFARE_E2E=1)npm run build

To use a local checkout in your client config:

bash
npm link# in claude_desktop_config.json:#   "command": "gatefare-mcp"

Architecture

src/├── index.ts        # entry — wires stdio transport├── server.ts       # McpServer instance + tool registration├── config.ts       # env parsing, capability detection├── client.ts       # REST client (wraps fetch)├── x402.ts         # 402 parsing + EIP-3009 signing├── types.ts        # shared types + GatefareError└── tools/    ├── discovery.ts   # search_apis, get_api, list_categories, suggest    ├── buyer.ts       # call_api, get_wallet_balance, estimate_cost    ├── publisher.ts   # register_api, list_my_apis, update_api, get_revenue, distribute    └── safety.ts      # report_abuse

Test layout

tests/├── config.test.ts         # env parsing edges├── client.test.ts         # HTTP client error mapping├── x402.test.ts           # signing + parsing primitives├── x402-flow.test.ts      # full 402 → sign → retry handshake (mocked fetch)├── server.test.ts         # capability-driven tool registration├── init.test.ts           # subprocess: bootstrap, env crashes, secret leakage├── stdio-protocol.test.ts # stdout pollution + recovery from tool errors├── stability.test.ts      # 100 concurrent calls, memory baseline, ReDoS├── tools/│   ├── discovery.test.ts│   ├── buyer.test.ts│   ├── buyer-flow.test.ts│   ├── publisher.test.ts│   └── safety.test.ts└── integration/    └── e2e.test.ts        # real gatefare.io, gated by GATEFARE_E2E=1

Contributing

Issues and PRs welcome. See CONTRIBUTING.md for the workflow, style guide, and how to add a new tool.

Related packages

Gatefare ships three first-party packages. They share the same x402 protocol and the same backend, so a project can mix them as needed:

PackageWhereWhen to use
@gatefare/mcp (this one)npmDrop into Claude Desktop / Cursor / any MCP host to give the agent tools for catalog discovery + paid calls
@gatefare/clientnpmTypeScript / JavaScript agents that pay APIs in code, outside MCP
gatefarePyPIPython agents (LangChain, LlamaIndex, etc.)

License

MIT © Gatefare

Links

来源:README.md,提交 6e3a63d

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分