three.ws Agent Payments

io.github.nirholas由 GitHub 账号 nirholas 发布v0.1.5更新于 Nov 1, 2026

Governed x402 payment sessions: pay any endpoint with budget, allowlist & per-tx caps, no key.

发布方自己的服务:Payments Ai Mcp

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

概览

AI 生成的概览

为 AI 代理提供受管控的 x402 支付会话:创建带预算与白名单的会话,在不暴露钱包私钥的情况下支付付费 HTTP 端点。

可以做什么
  • 创建、列出、查看和取消由 three.ws 额度出资的支付会话,可设置预算、有效期、单笔上限和主机白名单。
  • 使用会话令牌支付 x402 HTTP 端点,由平台钱包签名并在服务端强制执行策略。
  • 查看某个会话的剩余预算、状态和近期支付记录,或列出全部会话及汇总统计。
  • 取消会话,将未花费的预算退回额度。
适用场景
当代理需要调用付费的 x402 API,而你希望用预算、单笔上限和主机白名单限制支出、而不是交出钱包私钥时使用。也适合事后审计或取消代理的支出。
运行要求
通过 npx 在本地运行(需要 Node.js)。需要带额度的 three.ws 账户来为会话注资。会话管理工具需要 THREE_WS_SESSION(浏览器 __Host-sid cookie 的值);pay_with_session 默认使用 PAYMENT_SESSION_TOKEN(pss_ 开头的 bearer 令牌)。可选 THREE_WS_BASE 和 THREE_WS_TIMEOUT_MS。需要访问 three.ws API 及链上结算的网络连接。
安装前请注意
该服务器会花费真实资金:创建会话会扣除额度,pay_with_session 会在链上以 USDC(Solana 或 Base)结算。PAYMENT_SESSION_TOKEN 和 THREE_WS_SESSION 属于机密,会话令牌只显示一次,应像消费卡一样保管,因为持有者可在白名单主机上花掉剩余预算。请谨慎设置 allowed_hosts 与 max_per_tx_usd,并及时取消不再需要的会话。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@three-ws/agentcore-payments-mcp

MCP server for three.ws Agent Payment Sessions — govern agent x402 spending without exposing private keys.

Concept

The agent does not hold a wallet. It proposes spend. Governance enforces policy.

A Payment Session is a budget envelope you fund once from your three.ws credits. You hand an agent the session bearer token; the agent calls paid x402 endpoints through this server. The platform's wallet signs every transaction. The session's allowlist, per-transaction ceiling, and total budget are enforced atomically on the server — the agent can never overspend.

Quick start

bash
# Configureexport THREE_WS_SESSION="<the value of your __Host-sid cookie>"export PAYMENT_SESSION_TOKEN="pss_<session-id>_<random>"
# Runnpx @three-ws/agentcore-payments-mcp

MCP client config (~/.cursor/mcp.json, Claude Desktop, etc.):

json
{  "mcpServers": {    "three-ws-payments": {      "command": "npx",      "args": ["-y", "@three-ws/agentcore-payments-mcp"],      "env": {        "THREE_WS_SESSION": "<the value of your __Host-sid cookie>",        "PAYMENT_SESSION_TOKEN": "pss_..."      }    }  }}

Environment variables

VariableRequiredDescription
THREE_WS_SESSIONFor session management toolsThe value of your __Host-sid browser cookie (no __Host-sid= prefix; the server sends the cookie for you) for creating/listing/cancelling sessions
PAYMENT_SESSION_TOKENFor pay_with_session defaultBearer token returned when you created a session; passed as the default when no inline token is provided
THREE_WS_BASENoBase URL (default: https://three.ws)
THREE_WS_TIMEOUT_MSNoRequest timeout in ms (default: 30000)

Tools

create_payment_session

Create a new session funded from your credits.

json
{  "budget_usd": 10.00,  "label": "Research agent — June sprint",  "expiry_seconds": 86400,  "max_per_tx_usd": 0.50,  "allowed_hosts": ["api.example.com", "data.provider.io"],  "network": "solana"}

Returns { session, token }. The token is shown once — store it immediately.

pay_with_session

Pay an x402 endpoint using a session token. The platform wallet signs; your session's policy is enforced.

json
{  "url": "https://api.example.com/data",  "method": "GET",  "session_token": "pss_...",  "idempotency_key": "run-42-fetch-data"}

Returns { ok, paid, result, payment, session } with the tx hash, explorer link, and updated budget.

If session_token is omitted, the PAYMENT_SESSION_TOKEN env var is used.

check_payment_session

Inspect a session's budget, status, and recent payments.

json
{ "session_id": "...", "include_executions": true }

list_payment_sessions

List all sessions for the authenticated user, with aggregate stats.

json
{ "status": "active", "limit": 20 }

cancel_payment_session

Cancel a session and refund the un-spent budget to your credits.

json
{ "session_id": "..." }

Network support

Session networkPlatform payerUSDC contract
solana (default)X402_AGENT_SOLANA_SECRET_BASE58Solana mainnet USDC
baseX402_EVM_AGENT_PRIVATE_KEYBase mainnet USDC (0x8335…)

Integrating with @three-ws/x402-mcp

The existing pay_and_call tool in @three-ws/x402-mcp now accepts session_token directly:

json
{  "url": "https://api.example.com/endpoint",  "session_token": "pss_...",  "confirm": true}

This routes the payment through /api/pay/execute instead of signing locally — the session's governance policy applies.

Examples

Runnable, no-payment examples live in examples/:

bash
node examples/list-tools.mjs       # every tool with its schema and safety annotationsnode examples/plan-a-session.mjs   # read live x402 prices, print the policy to authorize

Neither one holds a wallet, reads a credential, or calls pay_with_session, so nothing is signed and nothing is spent. plan-a-session.mjs is the habit worth copying: read what an endpoint actually charges before you decide what budget to authorize. See examples/README.md.

Session lifecycle

create (budget debited from credits)  └─ active → pay_with_session calls spend against budget       ├─ exhausted (budget fully consumed)       ├─ expired (TTL elapsed — cron refunds remaining budget)       └─ cancelled (manual — remaining budget refunded immediately)

Programmatic use

The package entry point exports TOOLS (every tool definition: name, title, description, inputSchema, annotations, handler) and buildServer(), which returns a fully-registered McpServer with no transport attached. Importing is side-effect free and needs no credential, so you can mount these tools inside a host of your own or inspect the surface offline; a credential is only required when a handler actually runs.

js
// run with: THREE_WS_SESSION=<your __Host-sid value> node this-file.mjsimport { TOOLS, buildServer } from '@three-ws/agentcore-payments-mcp';
for (const tool of TOOLS) {	const kind = tool.annotations.readOnlyHint ? 'read ' : 'write';	console.log(`${kind} ${tool.name}`);}
// A tool handler is a plain async function against the live API.const list = TOOLS.find((t) => t.name === 'list_payment_sessions');console.log(await list.handler({ limit: 3 }));
// Or hand the whole registered server to your own MCP transport.buildServer();

Security properties

  • No key exposure: the session token is a time-bounded, HMAC-signed grant. Compromising it lets an attacker spend up to the remaining budget at allowed hosts — nothing more.
  • Atomic budget enforcement: concurrent payments use a SQL UPDATE … WHERE remaining >= amount RETURNING — two simultaneous requests can never collectively overspend.
  • Allowlist: if allowed_hosts is set, the governor rejects any request to a host not on the list before signing.
  • Per-transaction cap: max_per_tx_usd prevents a single large payment draining the entire budget.
  • SSRF protection: all x402 target URLs are validated against a public-IP allowlist and DNS-resolved server-side before any payment is signed.

来源:packages/agentcore-payments-mcp/README.md,提交 c8f2cde

工具

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

版本历史

2
  1. v0.1.5最新Oct 10, 2026
  2. v0.1.4Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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

其他 Payments 集成