Tryx402

io.github.crypto-yannso由 GitHub 账号 crypto-yannso 发布v0.2.0更新于 Oct 24, 2026

Budget router over x402: hard budget caps, idempotent paid calls, cost ledger, server-side pricing.

已验证STDIO仅桌面金融开发者工具

概览

AI 生成的概览

本地 MCP 服务器,让助手在硬性美元预算上限内搜索、询价并安全调用付费 x402 端点,具备幂等与成本账本。

可以做什么
在目录中搜索和发现 x402 端点与工具,无需付费,并可在花钱前估算多步工作流的成本。按单次价格和硬性预算上限调用任意 x402 端点,带幂等保护,并在收到支付要求后仅重试一次。通过成本账本查看支出,并获取签名收据作为付款凭证。托管版本还可管理托管账户:会话令牌、余额查询、额度充值和代理调用。
适用场景
当助手需要调用按次付费的 x402 或 AgentCash 端点,且你希望支出受硬性上限约束、避免重复扣费并保留付款记录时使用。也适合在真正花钱前为计划中的工作流询价。
运行要求
以 pip 安装的 Python 包在本地运行。付费调用需要兼容 x402 或 AgentCash 的加密钱包。托管版本需要托管账户和 TRYX402_API_KEY 密钥;预算上限通过 GATEWAY_MAX_BUDGET_USD 设置。需要访问目标端点和托管服务的网络连接。
安装前请注意
付费调用会从钱包实际支出 USDC,托管额度则通过 Stripe 另行充值;请谨慎设置预算上限。托管版本可充值额度并代理调用。首次导入时会发送一次可选的匿名遥测,可用 TRYX402_NO_TELEMETRY 或空的 TRYX402_TELEMETRY_URL 关闭。请妥善保管 TRYX402_API_KEY。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

tryx402 — the OpenRouter for agent payments

MIT licensed. Built in France. The first open-source payment governance layer for AI agents.

A safe, provider-agnostic wrapper over AgentCash / x402. Not limited to prospecting — it drives any endpoint, and adds what AgentCash itself lacks and we learned we need the hard way:

  • hard budget caps — stop before overspending
  • idempotency — never pay twice for the same call (the $0.83 double-charge lesson)
  • cost ledger — USD spent, reconciled, grouped by origin / account
  • plan estimation — price a multi-call workflow before spending a single cent
  • signed receipts — Ed25519 offline-verifiable proof of every payment
  • session tokens + circuit breaker — per-task spend caps with half-open cooldown
  • transparent 402→pay→retry — native httpx transport, exactly one retry, no loops
  • discovery pipeline — live x402 bazaar indexing (Onyx Bazaar, gold-402)

Open source, no fear

This repo is the open-source SDK: the safe caller, budget guard, idempotency, ledger, CLI and MCP server. MIT licensed.

We don't hide features behind paywalls. We don't split the SDK into "core" and "pro". Everything is here. Use it, fork it, build on it.

The hosted service (https://www.tryx402.app) is the commercial engine: multi-currency fiat billing, margins, FX, Stripe funding, the verified-tools catalogue and the provider portal. Pricing is decided server-side via /v1/quote — a client-side margin is a margin nobody pays.

Revenue model: commission on every pay-per-call transaction routed through the hosted service. The SDK is free. The service takes a cut. That's it.

Positionnement

tryx402 est le premier SDK open source de gouvernance de paiements pour agents IA dans l'écosystème x402. Conçu en France, distribué sous MIT, adopté par la communauté.

Face aux agrégateurs propriétaires (treg.to et consorts), tryx402 défend une position différente : pas de lock-in, pas de licence restrictive, pas de "commercial use only". Le code est libre. La confiance vient du service, pas de la licence.

| Face | Who | Where |\n|---|---|---|\n| Power-tool | you / an agent drive paid endpoints safely | this SDK (gateway.cli, gateway.client) |\n| Fiat gateway | end users pay in their currency, you resell x402 with margin | hosted service (closed) |

Embed it (for agents)

Python — one import:

python
from gateway import Gatewaygw = Gateway(max_budget_usd=1.0)               # safe by defaultdata = gw.call("https://stable-deepline.dev/api/email/validate",               body={"email": "[email protected]"}, price=0.03)print(gw.spent_usd)                            # 0.03

Terminal — one command (like agentcash), after pip install tryx402:

bash
gateway call https://stable-deepline.dev/api/email/validate \  --body '{"email":"[email protected]"}' --price 0.03 --max-budget 0.10

MCP — two modes (pick the one you need):

SDK MCP (pip install) — 6 tools, safe caller only

json
{  "command": "python3",  "args": ["-m", "tryx402.mcp_server"],  "env": { "TRYX402_MAX_BUDGET_USD": "1.00" }}

6 tools: gateway_search, gateway_discover, gateway_call, gateway_spent, gateway_plan, gateway_receipt. Works directly with your x402/AgentCash crypto wallet — no hosted account needed.

You will NOT see gateway_check_balance, gateway_recharge, gateway_lookup, or gateway_proxy_call from pip install tryx402. This is deliberate, not a bug. These tools manage your hosted account credits (funded via Stripe, separate from your crypto wallet). The SDK MCP is a safe x402 caller; the hosted gateway handles the fiat credit layer. For the full 10-tool MCP, see Option B below or connect to https://www.tryx402.app/api/mcp.

Gateway MCP (clone repo) — 10 tools, hosted account management

json
{  "mcpServers": {    "tryx402": {      "command": "python3",      "args": ["-m", "gateway.mcp_server"],      "env": {        "GATEWAY_MAX_BUDGET_USD": "1.00"      }    }  }}

All 6 SDK tools plus gateway_session, gateway_check_balance, gateway_recharge, gateway_proxy_call. No API key needed — anonymous session auth throughout. check_balance / recharge manage your hosted account credits (funded via Stripe in EUR/USD — not crypto).

Layout

gateway/├── client.py    # SafeClient: any endpoint + budget + idempotency + timeout + ledger├── ledger.py    # cost events, USD/EUR totals, by-origin├── catalog.py   # search(intent) / discover(origin) over the AgentCash catalogue├── api.py       # Gateway facade: one-import embed + quote() for server pricing├── cli.py       # search / discover / call / quote└── tests/       # offline: budget, idempotency, on_paid hook, quote client

Use

Discover (free — no payment):

bash
python3 -m gateway.cli search "find work email"python3 -m gateway.cli discover https://stable-deepline.dev

Call any endpoint safely (spends USDC — budget-capped, idempotent):

bash
python3 -m gateway.cli call https://stable-deepline.dev/api/email/validate \  --body '{"email":"[email protected]"}' --price 0.03 --max-budget 0.10

Ask the hosted service what a call costs your account (server-side FX + margin):

bash
export TRYX402_API_KEY="gw_..."        # from https://www.tryx402.appgateway quote 0.04#  -> {"account":"acme","currency":"EUR","charge_minor":5,"charge":"0.05 EUR"}

What's real vs hosted

  • Real (this SDK): the safe caller, budget cap, idempotency, cost ledger, catalogue search/discover.
  • Hosted: accounts, balances, fiat funding (Stripe), FX conversion, margins — all decided by the server; the SDK only asks with quote().
  • Deliberately off: auto-retry of paid calls (default max_retries=0) — retrying a possibly-paid call is what double-charged us; opt in only if the server honors the Idempotency-Key header.

Telemetry (optional)

tryx402 sends one anonymous ping on first import to help us understand usage: install-id (random, persisted locally), package version, Python version, platform.

No PII. No tracking across sites. No personal data.

Disable it anytime:

bash
export TRYX402_NO_TELEMETRY=1

Or set an empty URL to disable:

bash
export TRYX402_TELEMETRY_URL=""

来源:README.md,提交 29c9746

工具

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

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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