Feature request: recognise pay-per-call x402 results from MCP tools (pending payment response)

未关闭
#8,218 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript
领域
api, backend, payments

调研方向

Start by reading apps/sim/lib/internal/mcp/execute-tool.ts and tracing the mcp-tool-selector result path to see how result.output reaches the canvas. Identify where a payment_required envelope can be represented without raw passthrough. Done means a parsed challenge exposes price, pay_to, and scheme, requires operator or approved payer approval, and supports payment and retry.

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

Sim wires external MCP servers into canvas workflows and executes their tools. In execute-tool.ts (apps/sim/lib/internal/mcp/execute-tool.ts), a successful tool call returns { success: true, data: { success: true, output: result.output } } — the MCP server's tool output is passed straight through to the workflow.

A pay-per-call x402 MCP server is a normal MCP server that answers a tool call with a pending-payment result instead of data: it returns HTTP 200 with result content of the form {"status":"payment_required", "payment_challenge": {"price_xno": 0.0001, ...}}. When a Sim workflow calls such a tool through mcp-tool-selector, result.output is that JSON blob, and the canvas shows raw JSON instead of a confirm-and-pay step. This has been verified against a live pay-per-call merchant MCP (Vend API Merchant at extract.paypercall.dev/mcp): initialize returns 200 with correct tools, but tools/call returns 200 whose result content is a payment_required envelope.

This is the one missing client-side behaviour for zero-signup pay-per-call tools to be usable from a Sim workflow — they already work at the MCP protocol level.

Describe the solution you'd like

In the MCP tool-call path, detect a payment_required / x402 payment_challenge result structurally (not as raw JSON passthrough) and:

  1. surface a per-call confirmable payment step — price, pay_to, scheme — so the operator can pay and retry from the canvas/UI, and/or
  2. support an optional per-credential "payer" config so admin-added pay-per-call tools settle automatically under approval control.

Security invariant: no money moves unless the challenge parses AND the operator (or a configured, approved payer) approves.

Describe alternatives you've considered
  • Keep raw JSON passthrough for paid tools. Works, but a workflow that dumps payment_challenge JSON to the user is not usable for pay-per-call tools.
  • Build a separate x402 proxy outside Sim. Adds ops overhead and defeats the purpose of a visual MCP workflow.
  • Use a custom extraction tool that pre-encodes the payment. Very platform-specific and doesn't leverage the growing x402 catalogue.
Additional context

A working reference:

  • Vend API Merchant MCP manifest: https://extract.paypercall.dev/.well-known/mcp
  • x402 settlement manifest: https://extract.paypercall.dev/.well-known/x402
  • 9 MCP tools (web extract, link check, geoip, web search, youtube transcript, etc.), single calls ~0.0001 XNO, no signup, no API keys, per-call settlement in Nano (XNO) via nano:mainnet.
  • A bare probe returns 402 with the full challenge: curl -i https://extract.paypercall.dev/api/v1/extract?url=https://example.com

This is a first — Sim had zero x402 / pay-per-call coverage before this issue (GitHub search confirmed).

主要语言
TypeScript
星标
29.8k
派生
3.9k
平均合并
1 小时 44 分钟
30 天内合并 PR
841

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

simstudioai/sim 的其他 Issue

查看 simstudioai/sim 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。