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 整合