Skip to main content
Glama
gatefareio

gatefareio/mcp-server

Official
by gatefareio

@gatefare/mcp

npm version npm downloads bundle size License: MIT CI MCP Registry Base

AIエージェントにウォレットとマーケットプレイスを持たせましょう。

@gatefare/mcp は、Claude Desktop、Cursor、またはMCP互換エージェントをGatefareの有料HTTP APIカタログに接続するModel Context Protocolサーバーです。支払いはオープンなx402標準に基づき、Base上のUSDCで決済されます。SaaSキーやサブスクリプション、エスクローは不要です。ノンカストディアル方式のため、署名はローカルで行われ、秘密鍵がマシンから出ることはありません。

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  │
                                └─────────────┘

クイックスタート

1. クライアントへの導入

Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json (macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows):

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

Cursor~/.cursor/mcp.json またはプロジェクトレベルの .cursor/mcp.json:

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

クライアントを再起動します。これでエージェントは5つの読み取り専用ツール(検索と安全性)を利用できるようになります。試してみましょう:

"Search Gatefare for weather APIs." (Gatefareで天気APIを検索して)

2. ウォレットを追加して有料コールを行う

同じ設定ファイルに env を追加します:

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

購入者用ツール(call_apiget_wallet_balanceestimate_cost)が利用可能になります。WALLET_BUDGET_USD の上限は実行時のセーフティネットです。厳密な上限を設定したい場合は、使っても良い金額だけをウォレットに入金してください。

"What's London's weather right now? Spend up to $0.001." (今のロンドンの天気は?0.001ドルまで使って)

3. (オプション) 自分のAPIを公開する

gatefare.io/dashboard/tokens でPATを取得し、以下を追加します:

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

公開者用ツール(register_apilist_my_apisupdate_apiget_revenuedistribute)が表示されます。

"Publish my API at https://api.example.com/sentiment for $0.001 per call." (私のAPI https://api.example.com/sentiment を1コール0.001ドルで公開して)

Related MCP server: GoldBean

ツール

4つのドメインにわたる13のツール。ツールは設定された環境変数に基づいて自動的に登録されるため、エージェントが使えないツールを見ることはありません。

検索 — 常に利用可能

ツール

説明

gatefare.search_apis

フィルター(価格、カテゴリ、並び替え)を使用したカタログの全文検索

gatefare.get_api

スラッグまたは handle/urlName によるAPIの詳細情報

gatefare.list_categories

API数を含む全カテゴリ

gatefare.suggest

クエリ文字列のオートコンプリート候補

購入者 — WALLET_PRIVATE_KEY が必要

ツール

説明

gatefare.call_api

有料コールを実行。402 → 署名 → 再試行を自動的に処理

gatefare.get_wallet_balance

Base上のUSDC + ETH、および残りの実行予算

gatefare.estimate_cost

N回のコール計画に対する合計コストの見積もり

公開者 — GATEFARE_PAT が必要

ツール

説明

gatefare.register_api

新しい有料APIの公開

gatefare.list_my_apis

統計情報を含む公開済みAPIの一覧

gatefare.update_api

メタデータ、価格、ターゲットURLの編集

gatefare.get_revenue

収益の時系列データと合計

gatefare.distribute

オンチェーンの distribute() 支払い(破壊的)のトリガー

安全性 — 常に利用可能

ツール

説明

gatefare.report_abuse

悪意のある/盗用されたAPIの報告(DMCA、詐欺、マルウェアなど)

設定

変数

デフォルト

必須条件

GATEFARE_BASE_URL

https://gatefare.io

— (セルフホスト時に上書き)

WALLET_PRIVATE_KEY

購入者用ツール全般

WALLET_BUDGET_USD

無制限

オプションの支出上限

WALLET_NETWORK

eip155:8453

Sepoliaテストネットの場合は eip155:84532

GATEFARE_PAT

公開者用ツール全般

LOG_LEVEL

info

詳細なstderr出力には debug

検索と購入を一度に行う (Claude Desktop)

あなた: Find me a sub-$0.001 weather API and call it for "Tokyo". (0.001ドル以下の天気APIを探して、「東京」でコールして)

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… (東京は22度、曇り時々晴れ。0.001 USDCを支払いました。領収書: settled-tx-0x9a…)

プログラムによる利用 — Pythonエージェント

from mcp import ClientSession, StdioServerParameters
from 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)

実行可能なバリエーション(Claude Desktop、Cursor、Python、TypeScript、および純粋な検索のチュートリアル)については examples/ を参照してください。

AIエージェントを構築していない場合 — 適切なツールの選択

バックエンドからx402 APIの支払いを行いたい場合(エージェントなし)、Coinbaseの公式x402 SDK(x402-python (PyPI)、coinbase/x402/go…/java、または @x402/fetch)を使用してください。これらは支払いフローを処理するため、このMCPサーバーは不要です。

任意の言語からGatefareカタログを閲覧したい場合は、REST APIを直接叩いてください: gatefare.io/api/catalog (OpenAPI 3.1仕様)。

どのツールがどのユースケースに適しているかの詳細な内訳は docs/integrations.md を参照してください。

直接CLI (デバッグ用)

# 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

エラー

ツールの結果には isError: true と構造化されたボディ { error: <code>, message: <human>, details?: <any> } が含まれます。コードは固定されているため、エージェントはそれに基づいて再試行や表示ロジックを切り替えることができます。

コード

意味

INVALID_INPUT

入力がzodバリデーションに失敗

WALLET_NOT_CONFIGURED

購入者用ツールには WALLET_PRIVATE_KEY を設定してください

PAT_NOT_CONFIGURED

公開者用ツールには GATEFARE_PAT を設定してください

BUDGET_EXHAUSTED

実行時の予算上限に達しました

INSUFFICIENT_BALANCE

ウォレットのUSDC残高が不足しています

PRICE_TOO_HIGH

サーバーの価格が設定した max_price を超えています

API_NOT_FOUND

スラッグが存在しないか、停止されています

UPSTREAM_ERROR

有料APIが2xx以外のレスポンスを返したか、402が不正でした

RATE_LIMITED

Gatefareがリクエストをレート制限しました

NETWORK_ERROR

Gatefareに到達できませんでした

GATEFARE_API_ERROR

Gatefareが4xx / 5xxを返しました

仕組み (30秒解説)

  1. エージェントが gatefare.call_api { slug: "demo-weather", … } を呼び出します。

  2. GET https://gatefare.io/p/demo-weather を実行します(まだ支払いは発生しません)。

  3. Gatefareプロキシが accepts: [{network, payTo, maxAmountRequired, …}] を含む 402 Payment Required を返します。

  4. 設定されたネットワーク上で、その正確な金額と受取人に対して EIP-3009 transferWithAuthorization に署名します。

  5. 署名済みの X-Payment ヘッダー(base64エンコードされたJSON、x402 v2)を付けてリクエストを再試行します。

  6. Gatefareが署名を検証し、USDC送金を決済し、アップストリームAPIへリクエストをプロキシします。

  7. アップストリームのレスポンス(および支払い領収書)をエージェントに返します。

署名は使い捨てで時間制限があり、この特定の payTo への送金以外の目的でマシンから出ることはありません。秘密鍵がログに記録されることもありません。

セキュリティ

  • ノンカストディアル。 秘密鍵は環境変数内に存在し、署名はローカルで行われるため、Gatefareサービスが鍵を見ることはありません。

  • ネットワーク混同への耐性。 Sepolia専用の要件をメインネットユーザーに返す悪意のあるゲートウェイは拒否されます。ユーザーが設定していないチェーンに対して署名することはありません。

  • 暗号学的にランダムなナンス。 Date.now() ベースの衝突はありません。

  • 有効期限は最大1時間。 サーバーがそれ以上を要求しても制限されます。

  • 厳格な入力バリデーション。 スラッグは ^[a-z0-9_-]+$ に制限され、URLエンコードされます。パス・トラバーサルは発生しません。targetUrl は登録時に file://localhost、クラウドメタデータIP、.local.internal ホストをブロックします。

  • シークレットの保護。 テストにより、秘密鍵とPATがstderr/stdoutに決して表示されないことが保証されています。

開発

git clone https://github.com/gatefareio/mcp-server.git
cd mcp-server
npm install
npm run typecheck
npm test                  # 138 unit tests
npm run test:e2e          # 10 e2e tests against live gatefare.io (set GATEFARE_E2E=1)
npm run build

クライアント設定でローカルのチェックアウトを使用する場合:

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

アーキテクチャ

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

テスト構成

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

貢献

IssueやPRを歓迎します。ワークフロー、スタイルガイド、新しいツールの追加方法については CONTRIBUTING.md を参照してください。

ライセンス

MIT © Gatefare

リンク

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
15dResponse time
1wRelease cycle
4Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    MCP server for pay-per-call DeFi and crypto data via x402 micropayments on Base. 8 endpoints: token prices, TVL, funding rates, token security, gas tracker, whale monitoring, wallet profiling, and yield scanning.
    8
    46
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    55+ pay-per-call tools for AI agents over MCP: live telemetry, blockchain/on-chain checks, environmental, transit, finance, and network utilities. No API key or signup — agents pay per request with x402 USDC micropayments (Base and Solana).
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    MCP server exposing 1,000+ pay-per-call API endpoints across agent infrastructure (memory, coordination, secrets, verification), data, compute, finance, weather, geography, and reference categories — payments via x402 protocol in USDC on Base.

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gatefareio/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server