gate-pay-x402

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gate Pay x402 (gate-pay-x402)

Gate Pay x402 (gate-pay-x402)

General Rules

通用规则

⚠️ STOP — Follow any shared runtime rules your host applies before this skill (if the host provides them). Do NOT select or call tools until those rules are satisfied.
  • Only call MCP tools explicitly listed in this skill. Tools not documented here must NOT be called, even if they exist in the MCP server.
Allowlisted Gate Pay MCP tool names (exact names as exposed by the live server; skip tools the server does not list):
  • Read / orchestration (no on-chain debit by themselves; may perform HTTP or session setup per schema):
    x402_place_order
    .
    x402_request
    :
    only when the connected server lists it (some alternate single-tool builds); use for merchant HTTP, 402 handling, or MCP Wallet login per that tool’s
    inputSchema
    .
  • Session / auth:
    x402_quick_wallet_auth
    (MCP Wallet /
    quick_wallet
    ).
    x402_gate_pay_auth
    (Gate Pay OAuth for centralized_payment when listed—see that tool’s description and
    inputSchema
    ).
  • Write / sign / pay (irreversible or security-sensitive—require explicit user confirmation after a clear price for payment steps):
    x402_sign_payment
    ,
    x402_create_signature
    ,
    x402_submit_payment
    ,
    x402_centralized_payment
    (if listed by the server).
  • Merchant discovery (read-only): May live on a separate MCP server from
    gatepay-local-mcp
    (e.g. remote HTTP MCP). When any connected server lists it, call the catalog tool by its exact live name (often
    discoveryResource
    ; if the name differs, use the live name only). No payment from discovery. If no server lists it, use user URLs / context only—never invent tool names.
Do not use Gate Exchange MCP to substitute Gate Pay wallet binding or to finish a Gate Pay
x402_place_order
/ same-server 402 flow on a third-party x402 MCP. When the user chose the
gate_exchange
rail
, use only Gate Exchange MCP tools per Gate Exchange path.
No write without consent: Do not invoke any tool whose
inputSchema
performs signing, fund movement, or centralized settlement—including
x402_sign_payment
,
x402_create_signature
+
x402_submit_payment
,
x402_centralized_payment
, and (if listed) pay steps inside
x402_request
—until the user has seen a clear price (quote or 402 summary) and given explicit confirmation. One confirmation must cover all write steps in the current pay flow.

Gate Pay x402 layer — Merchant discovery (resource list only), wallet/env setup, and payment routing. Payment and wallet
x402_*
tools
normally run on local
gatepay-local-mcp
(stdio). Discovery may run on the same server or on a second MCP (e.g. remote URL)—use the host’s tool list to see which server exposes which tool. Tool argument names, types, required fields, and enums come from each tool’s
inputSchema
. If anything in this skill disagrees with
inputSchema
, follow
inputSchema
for that invocation.
User-facing language: Write all user-visible replies in the same language the user is using in the current conversation (e.g. Chinese if they write Chinese, English if they write English).
Trigger Scenarios: Use when the user wants to pay via x402, discover or pick a paid service, configure or add Gate Pay wallets, or choose a payment rail:
  • Wallet setup / add / switch: configure / set up / add / bind / change default payment method,
    PAYMENT_METHOD_PRIORITY
    , and semantically equivalent phrasing in any language
  • By rail (MCP Wallet /
    quick_wallet
    ):
    MCP Wallet, Quick Wallet, and the same product under localized or colloquial names in the user’s language, plugin wallet (including extension plus Open-API-token style setup), bind private key, local private key, private-key payment,
    EVM_PRIVATE_KEY
    ,
    PLUGIN_WALLET_TOKEN
  • Pay / buy: 402, payment required, help me pay / purchase, place order, sign payment,
    x402_sign_payment
    — and equivalent phrasing in any language
  • Paid service intent (examples, not literal only): book flights, order food, buy an API, “help me buy X”, which merchants exist, list of billable or paid services — and equivalent phrasing in any language the user writes
  • Exchange: Gate Exchange payment, pay via exchange
Recognize intents from meaning, not only exact English strings; users often mix languages or use vendor-specific terms.
NOT this skill (common misroutes):
  • Generic market/trade-only requests with no Gate Pay MCP, no x402, no merchant discovery for this product, no wallet/env setup for this product
  • Pure consultation or trade decisions with no Gate Pay / x402 / this MCP path
  • Payments that must be completed only on a non-Gate third-party x402 MCP for the same order as
    x402_place_order
    from Gate Pay MCP (violates same-server rule below)

⚠️ 停止操作 — 在执行本技能前,请遵循宿主应用的所有共享运行时规则(如果宿主提供了这些规则)。在满足这些规则之前,请勿选择或调用工具。
  • 仅调用本技能中明确列出的MCP工具。即使MCP服务器中存在未在此处记录的工具,也不得调用。
允许调用的Gate Pay MCP工具名称(需与服务器实际暴露的名称完全一致;跳过服务器未列出的工具):
  • 读取/编排类(本身不会触发链上扣款;可能根据Schema执行HTTP或会话设置):
    x402_place_order
    x402_request
    仅当已连接的服务器列出该工具时使用(部分单工具构建版本会包含);用于商户HTTP请求、402处理或MCP Wallet登录,需遵循该工具的
    inputSchema
  • 会话/认证类:
    x402_quick_wallet_auth
    (MCP Wallet /
    quick_wallet
    )。
    x402_gate_pay_auth
    (当服务器列出该工具时,用于centralized_payment的Gate Pay OAuth认证——请查看该工具的描述和
    inputSchema
    )。
  • 写入/签名/支付类(操作不可逆或涉及安全敏感内容——在执行支付步骤前,需向用户展示明确价格并获得用户明确确认):
    x402_sign_payment
    x402_create_signature
    x402_submit_payment
    x402_centralized_payment
    (若服务器列出该工具)。
  • 商户发现类(只读): 可能部署在与**
    gatepay-local-mcp
    分离的独立MCP服务器上(例如远程HTTP MCP)。当任意已连接服务器列出该工具时,需按其实际名称调用目录工具(通常为
    discoveryResource
    ;若名称不同,仅使用服务器实际列出的名称)。该工具不涉及支付操作。若无**服务器列出该工具,则仅使用用户提供的URL/上下文——绝对不能自行编造工具名称。
请勿使用Gate Exchange MCP替代Gate Pay钱包绑定,也请勿在第三方x402 MCP上完成Gate Pay的
x402_place_order
订单或同服务器的402流程。当用户选择**
gate_exchange
支付通道时,仅使用Gate Exchange路径**下的Gate Exchange MCP工具。
无用户同意不得执行写入操作: 在用户看到明确价格(报价或402摘要)并给出明确确认前,不得调用任何
inputSchema
涉及签名、资金转移或中心化结算的工具——包括
x402_sign_payment
x402_create_signature
+
x402_submit_payment
x402_centralized_payment
,以及(若列出)
x402_request
中的支付步骤。一次确认需覆盖当前支付流程中的所有写入步骤。

Gate Pay x402层 — 商户发现(仅返回资源列表)、钱包/环境设置及支付路由。支付和钱包相关的
x402_*
工具
通常运行在本地的**
gatepay-local-mcp
(标准输入输出)上。商户发现功能可能运行在同一服务器或另一台MCP服务器(例如远程URL)上——请通过宿主的工具列表查看哪个服务器暴露了哪个工具。工具的参数名称、类型、必填字段和枚举值均来自各工具的
inputSchema
**。若本技能中的内容与
inputSchema
存在冲突,以该工具调用时的
inputSchema
为准
用户可见语言: 所有用户可见的回复需使用用户当前对话中使用的语言(例如用户用中文则回复中文,用户用英文则回复英文)。
触发场景:当用户想要通过x402支付、发现或选择付费服务、配置或添加Gate Pay钱包,或选择支付通道时使用:
  • 钱包设置/添加/切换: 配置/设置/添加/绑定/更改默认支付方式、
    PAYMENT_METHOD_PRIORITY
    ,以及任何语言中的语义等价表述
  • 按支付通道(MCP Wallet /
    quick_wallet
    ):
    MCP Wallet、Quick Wallet,以及用户语言中的本地化或口语化名称,插件钱包(包括扩展程序+Open-API-token式设置)、绑定私钥、本地私钥、私钥支付、
    EVM_PRIVATE_KEY
    PLUGIN_WALLET_TOKEN
  • 支付/购买: 402、支付要求、帮我支付/购买、下单、签名支付、
    x402_sign_payment
    ——以及任何语言中的等价表述
  • 付费服务意图(示例,非仅字面表述): 预订机票、点餐、购买API、“帮我买X”、有哪些商户可付费服务列表——以及用户使用的任何语言中的等价表述
  • 交易所: Gate Exchange支付、通过交易所支付
需根据语义识别用户意图,而非仅匹配英文字符串;用户经常混合使用多种语言或使用供应商特定术语。
不属于本技能的场景(常见误判):
  • 仅涉及通用市场/交易的请求,且Gate Pay MCP、x402、针对本产品的商户发现、针对本产品的钱包/环境设置
  • 仅涉及咨询或交易决策,且Gate Pay/x402/本MCP路径
  • 必须在非Gate第三方x402 MCP上完成的支付,且该订单与Gate Pay MCP的
    x402_place_order
    为同一订单(违反下文的同服务器规则)

Domain Knowledge

领域知识

  • Product scope: Gate Pay x402: merchant HTTP and 402 handling via
    gatepay-local-mcp
    (
    x402_*
    tools); optional merchant discovery on the same or another MCP when a catalog tool is listed (see GatePay merchant discovery); wallet rails (
    quick_wallet
    ,
    plugin_wallet
    ,
    local_private_key
    ); optional Gate Exchange MCP when the user chose
    gate_exchange
    .
  • Schema-first: Build every MCP
    arguments
    object from the target tool’s
    inputSchema
    ; on conflict with this file,
    inputSchema
    wins
    (see Gate Pay x402 Module (MCP Tools)).
  • Consent: No signing, fund movement, or settlement tools until the user sees a clear price and gives explicit confirmation (GatePay merchant discovery & agent orchestration, Workflow).
  • Rails and env:
    PAYMENT_METHOD_PRIORITY
    and MCP
    env
    are covered in Wallet configuration procedure and Authentication State.

  • 产品范围: Gate Pay x402:通过**
    gatepay-local-mcp
    x402_*
    工具)处理商户HTTP请求和
    402**;当列出目录工具时,可在同一或另一台MCP服务器上进行可选的商户发现(请查看GatePay商户发现);钱包通道(
    quick_wallet
    plugin_wallet
    local_private_key
    );当用户选择**
    gate_exchange
    时,可使用可选的Gate Exchange** MCP。
  • Schema优先: 每个MCP的
    arguments
    对象需根据目标工具的**
    inputSchema
    构建;若与本文档存在冲突,
    inputSchema
    优先**(请查看Gate Pay x402模块(MCP工具))。
  • 用户同意: 在用户看到明确价格并给出明确确认前,不得调用签名、资金转移或结算工具(GatePay商户发现与Agent编排工作流)。
  • 通道与环境:
    PAYMENT_METHOD_PRIORITY
    和MCP
    env
    的相关内容请查看钱包配置流程
    认证状态

Routing Rules

路由规则

Route by user intent (procedural sections live in this file — wallet, discovery, workflow, Exchange; no procedural split to other files. QA scenarios are in
references/scenarios.md
; that file is not a runtime routing submodule):
User IntentKeywords / signalsTarget
Wallet / env configurationWallet setup, add rail, MCP Wallet, Quick Wallet, 快捷钱包, gate/Gate钱包, localized names, plugin wallet / 插件钱包, private key,
PAYMENT_METHOD_PRIORITY
, MCP host env — match intent in any language
This file — Wallet configuration procedure then Authentication State
Merchant discovery / selection / quoteWhich merchants, 有哪些商户, paid service list, 能付费的服务列表, pick a service, quote / dynamic price, discovery before pay — and non-English equivalentsThis file — GatePay merchant discovery & agent orchestration then Workflow
x402 payment (Gate Pay MCP)pay, 402, place order,
x402_place_order
,
x402_sign_payment
, and (if listed)
x402_request
— and non-English equivalents
This file — Workflow
Gate Exchange paymentexchange, Gate Exchange — and non-English equivalentsThis file — Gate Exchange path
MCP connectivityMCP missing, tools not found, need to add discovery or local pay serverThis file — MCP host setup (discovery + payment) then MCP Server Connection Detection

根据用户意图进行路由(流程部分位于本文档中——钱包、发现、工作流、交易所路径;无需拆分到其他文件)。QA场景位于**
references/scenarios.md
;该文件不是**运行时路由子模块:
用户意图关键词/信号目标
钱包/环境配置钱包设置、添加支付通道、MCP Wallet、Quick Wallet、快捷钱包、gate/Gate钱包、本地化名称、插件钱包/插件钱包、私钥、
PAYMENT_METHOD_PRIORITY
、MCP宿主环境——匹配任意语言中的意图
本文档——钱包配置流程,然后是认证状态
商户发现/选择/报价有哪些商户、有哪些商户、付费服务列表、能付费的服务列表、选择服务、报价/动态价格、支付前发现——以及非英文等价表述本文档——GatePay商户发现与Agent编排,然后是工作流
x402支付(Gate Pay MCP)支付、402、下单、
x402_place_order
x402_sign_payment
,以及(若列出)
x402_request
——以及非英文等价表述
本文档——工作流
Gate Exchange支付交易所、Gate Exchange——以及非英文等价表述本文档——Gate Exchange路径
MCP连接性MCP缺失、工具未找到、需要添加发现或本地支付服务器本文档——MCP宿主设置(发现+支付),然后是MCP服务器连接检测

GatePay merchant discovery & agent orchestration

GatePay商户发现与Agent编排

One-line intent: When the user states what paid service they want in natural language, the agent discovers merchantsselects a resource by rules → quotes when the merchant supports it → fills required call parametersinvokes the service → after a clear price is visible, asks for explicit pay consent → only then runs signing / payment tools. Wallet rails (
quick_wallet
,
plugin_wallet
,
local_private_key
,
gate_exchange
) follow Wallet configuration procedure and Authentication State.
核心意图: 当用户用自然语言表述想要的付费服务时,Agent需发现商户按规则选择资源 → 若商户支持则报价填充所需调用参数调用服务 → 在用户看到明确价格后,请求明确的支付同意 → 仅在获得同意后运行签名/支付工具。钱包通道(
quick_wallet
plugin_wallet
local_private_key
gate_exchange
)需遵循钱包配置流程认证状态

Scope and boundaries

范围与边界

  • Merchant discovery layer returns an invokable resource list only. It does not take payment, does not place orders, and does not settle on-chain.
  • Order / HTTP / 402 use
    x402_place_order
    and/or
    x402_request
    (and related
    x402_*
    ) on the payment MCP — typically
    gatepay-local-mcp
    . Every argument comes from that tool’s
    inputSchema
    .
  • Two MCPs (common): (1) Discovery MCP — remote or separate process exposing the catalog tool only. (2) Payment MCP
    npx -y gatepay-local-mcp
    (stdio) exposing
    x402_*
    . The agent must invoke each tool on the server that lists it; do not assume discovery and pay share one connection.
  • Registry / Discovery HTTP API (if present behind MCP) is implementation detail: use MCP tools and responses; do not duplicate discovery payload field tables here — treat list item shape as whatever the MCP returns, validated against
    inputSchema
    .
  • 商户发现层仅返回可调用的资源列表。该层处理支付、下单、进行链上结算。
  • 订单/HTTP/402处理需使用支付MCP上的**
    x402_place_order
    和/或
    x402_request
    (及相关
    x402_*
    工具)——通常为
    gatepay-local-mcp
    所有参数需来自该工具的
    inputSchema
    **。
  • 双MCP架构(常见): (1) 发现MCP — 仅暴露目录工具的远程或独立进程。(2) 支付MCP
    npx -y gatepay-local-mcp
    (标准输入输出),暴露**
    x402_*
    工具。Agent必须**在工具所在的服务器上调用该工具;不得假设发现和支付服务共享同一连接。
  • 注册/发现HTTP API(若在MCP后方存在)属于实现细节:需使用MCP工具和响应不得在此处复制发现负载字段表——需将列表项结构视为MCP返回的任意结构,并根据**
    inputSchema
    **进行验证。

Merchant discovery MCP tool (when listed)

商户发现MCP工具(当服务器列出时)

  • Which server: Scan all configured MCP servers. The catalog tool may appear only on the discovery server (not on
    gatepay-local-mcp
    ).
  • Tool name (expected):
    discoveryResource
    must match the live tool list on the server that exposes discovery. If the shipped name differs, use the live name only.
  • Behavior: Returns a paginated invokable resource list only (HTTP and/or MCP-type entries with
    accepts
    , optional quote metadata). No payment, no order placement from this tool.
  • Arguments (logical field names — assemble values per live
    inputSchema
    ; on any mismatch,
    inputSchema
    wins):
    FieldRequiredNotes
    resourceDes
    YesUser intent / service description for fuzzy catalog match (natural language or keywords).
    resourceType
    Yes
    http
    or
    mcp
    (design default
    mcp
    ).
    pageNum
    NoPage index; design default
    1
    .
    pageSize
    NoPage size; design default
    10
    .
    tenantId
    NoTenant id; design default
    GATE_PAY
    ; omit if schema does not expose it.
  • Response mapping: Items typically include endpoint identity and
    accepts
    (with
    outputSchema
    /
    input
    for HTTP method, headers, body, or MCP
    tool
    +
    inputSchema
    +
    transport
    ). Optional
    metadata
    :
    quote_endpoint
    ,
    quote_method
    ,
    pricing_mode
    ,
    quote_inputSchema
    /
    inputSchema
    for dynamic pricing — use for Quote vs main call order above. Field names may appear as
    resourceUrl
    or
    resource
    depending on layer; always follow the actual tool response and map into
    x402_place_order
    /
    x402_request
    per their
    inputSchema
    .
  • If the tool is not listed: Skip discovery calls; rely on user-provided URLs and conversation context.
  • 所在服务器: 扫描所有已配置的MCP服务器。目录工具可能仅出现在发现服务器上(而非
    gatepay-local-mcp
    )。
  • 工具名称(预期):
    discoveryResource
    必须与暴露发现功能的服务器上的实际工具列表匹配。若实际名称不同,仅使用实际名称。
  • 行为: 仅返回分页的可调用资源列表(包含
    accepts
    的HTTP和/或MCP类型条目,可选报价元数据)。该工具处理支付、下单。
  • 参数(逻辑字段名称——需根据实际
    inputSchema
    组装值;若存在任何不一致,以
    inputSchema
    为准):
    字段必填说明
    resourceDes
    用于模糊目录匹配的用户意图/服务描述(自然语言或关键词)。
    resourceType
    http
    mcp
    (默认值为**
    mcp
    **)。
    pageNum
    页码;默认值为**
    1
    **。
    pageSize
    每页数量;默认值为**
    10
    **。
    tenantId
    租户ID;默认值为**
    GATE_PAY
    **;若Schema未暴露该字段则省略。
  • 响应映射: 条目通常包含端点标识和**
    accepts
    (包含HTTP方法、头部、Body或MCP
    tool
    +
    inputSchema
    +
    transport
    outputSchema
    /
    input
    )。可选
    metadata
    quote_endpoint
    quote_method
    pricing_mode
    、用于动态定价的
    quote_inputSchema
    /
    inputSchema
    ——用于上述
    报价与主调用顺序**。字段名称可能为
    resourceUrl
    resource
    ,具体取决于层级;始终遵循工具的实际响应,并根据**
    inputSchema
    **将其映射到
    x402_place_order
    /
    x402_request
  • 若工具未列出: 跳过发现调用;依赖用户提供的URL和对话上下文。

When
discoveryResource
is mandatory (before merchant HTTP)

强制调用
discoveryResource
的场景(商户HTTP请求前)

When some connected MCP server lists the discovery catalog tool (often
discoveryResource
— use the exact name from that server’s tool list), and all of the following hold:
  1. The user expresses purchase or order intent for a good or service in natural language (e.g. “帮我买一双鞋”, “订一杯咖啡”, “买一个查天气的 API”) — including the same intent in other languages or colloquial phrasing.
  2. The user message plus conversation context do not supply enough information to satisfy the merchant HTTP tool’s
    inputSchema
    on the payment MCP for
    x402_place_order
    or
    x402_request
    (typically missing or incomplete
    url
    /
    method
    /
    body
    or equivalent required fields) without inventing endpoints or parameters.
Then the agent MUST call the discovery tool first on the server that lists it — build
arguments
only from that tool’s
inputSchema
(commonly map the user’s wording into
resourceDes
, set
resourceType
per schema, e.g. design default
mcp
). Then apply Selection rules, then continue Workflow from Step 3–4 on the payment MCP with the chosen resource. Do not skip discovery by guessing merchant URLs or calling
x402_place_order
/
x402_request
with empty, placeholder, or hallucinated merchant targets.
Do not apply this mandatory catalog step when: no connected server lists a discovery tool (use user URLs/context only); the user already provides a concrete merchant endpoint and parameters adequate for the HTTP tool’s schema; the session is wallet / rail setup only with no purchase flow; or the user chose
gate_exchange
only (Gate Exchange path).
部分已连接的MCP服务器列出发现目录工具(通常为**
discoveryResource
——需使用该服务器工具列表中的准确**名称),且同时满足以下所有条件时:
  1. 用户用自然语言表达了购买或订购商品或服务的意图(例如“帮我买一双鞋”、“订一杯咖啡”、“买一个查天气的API”)——包括其他语言或口语化表述的相同意图。
  2. 用户消息加上对话上下文无法提供足够信息,以满足支付MCP上商户HTTP工具(
    x402_place_order
    x402_request
    )的**
    inputSchema
    要求(通常缺少或不完整的
    url
    /
    method
    /
    body
    或等价必填字段),且无法**自行编造端点或参数。
此时Agent必须先在工具所在的服务器上调用发现工具——仅根据该工具的
inputSchema
构建**
arguments
(通常将用户表述映射到
resourceDes
,根据Schema设置
resourceType
,例如默认值
mcp
)。然后应用选择规则**,接着在支付MCP上从步骤3-4开始继续执行工作流不得通过猜测商户URL或使用空值、占位符或虚构商户目标调用**
x402_place_order
/
x402_request
**来跳过发现步骤。
当以下情况时,无需执行该强制目录步骤:已连接服务器列出发现工具(仅使用用户URL/上下文);用户提供足够的商户端点和参数以满足HTTP工具的Schema要求;会话涉及钱包/支付通道设置,购买流程;或用户仅选择**
gate_exchange
**(Gate Exchange路径)。

Selection rules (filter → rank → tie-break)

选择规则(过滤→排序→平局处理)

Apply in order; filter first, then sort what remains; if several options remain close, ask the user — do not silently choose.
  1. Intent match:
    description
    , type, and capabilities align with the user goal (e.g. flights vs food vs API).
  2. Constraints: Network, currency,
    maxPrice
    , user-stated budget — drop resources that violate them.
  3. Callability: Current environment can satisfy required MCP transport and/or HTTP; if not, drop or explain limitation.
  4. Parameter feasibility: Given what the user already said, can required inputs (per merchant
    inputSchema
    ) be filled? If a resource needs unknown critical fields and there is no safe default, do not select it or pick the easiest-to-complete option and ask for missing fields.
  5. Price path: If the user insists on knowing price before deciding, prefer resources that expose quote / dynamic metadata; otherwise, among equally good options, prefer fixed-price or simpler paths.
  6. Tie-break: If multiple resources remain similarly suitable, present differences (price band, latency, limits) and ask the user to pick (e.g. by number). Never auto-pick without user choice.
按顺序应用规则;先过滤,然后对剩余选项排序;若多个选项相似度较高,询问用户——不得自行静默选择。
  1. 意图匹配:
    description
    、类型和能力与用户目标一致(例如机票、餐饮、API)。
  2. 约束条件: 网络、货币、
    maxPrice
    、用户声明的预算——排除违反这些约束的资源。
  3. 可调用性: 当前环境可满足所需的MCP传输和/或HTTP要求;若不能,则排除或说明限制。
  4. 参数可行性: 根据用户已提供的信息,是否能填充商户**
    inputSchema
    要求的必填输入?若某资源需要未知的关键字段且无安全默认值,不得选择该资源,或选择最易完成的选项并询问**用户补充缺失字段。
  5. 价格路径: 若用户坚持在决定前了解价格,优先选择暴露报价/动态元数据的资源;否则,在同等条件下优先选择固定价格或流程更简单的路径。
  6. 平局处理: 若多个资源仍同样合适,展示差异(价格区间、延迟、限额)并让用户选择(例如按编号选择)。绝对不能在无用户选择的情况下自动选择。

Quote vs main call order

报价与主调用顺序

  • If the discovery item or schema/metadata indicates quote / dynamic pricing (e.g.
    dynamic
    ,
    quote_endpoint
    , or equivalent per MCP docs): quote first → show the user currency, amount, and conditions → ask whether to continue with that merchantafter yes, call the main service with parameters.
  • If there is no quote path: do not invent a separate quote step; call the main service per contract. If cost appears only in 402, parse 402 then run mandatory pay confirmation below.
  • No quote path does not mean skipping pay confirmation.
  • 发现条目或Schema/元数据表明存在报价/动态定价(例如
    dynamic
    quote_endpoint
    或MCP文档中的等价表述):先报价→向用户展示货币、金额和条件→询问用户是否继续使用该商户获得同意后,调用带参数的主服务。
  • 无报价路径:不得自行添加单独的报价步骤;按合约调用主服务。若成本仅出现在402响应中,则解析402响应后执行强制支付确认步骤。
  • 无报价路径不代表可以跳过支付确认。

Parameters, price visibility, and mandatory pay confirmation

参数、价格可见性与强制支付确认

  • Parameters: Before any merchant /
    x402_place_order
    call (or
    x402_request
    if that is the tool the payment MCP lists for HTTP/402), list required fields from the relevant
    inputSchema
    . If the user has not provided them, complete via dialogue. Do not call with empty or guessed values to “probe” the API.
  • Price visibility: On a quote path, show currency, amount, and applicability. Without quote, after 402 or an explicit price from the merchant, summarize the payment requirement in the user’s language.
  • Pay confirmation (mandatory): The user must see a clear price (quote result or 402 summary) first. Then the agent must ask again; the message should cover how much, which asset/chain (if known), and which payment method (if known). Only after explicit consent (e.g. “confirm pay”, “go ahead and pay”) invoke
    x402_sign_payment
    , split signature tools, or further steps in
    x402_request
    only if that tool is listed on the payment MCP. If the user refuses or is unsure, stop payment; offer another merchant or end.
  • Step 1 (Workflow) “balance / intent” checks may be merged with this see-price-then-confirm step to avoid double-asking; prefer one clear confirmation after price is visible.
  • 参数: 在调用任何商户/
    x402_place_order
    (或**
    x402_request
    ,若支付MCP列出该工具用于HTTP/402处理)之前,列出相关
    inputSchema
    **中的必填字段。若用户未提供这些字段,通过对话补充完整不得使用空值或猜测值调用工具以“探测”API。
  • 价格可见性: 在报价路径中,展示货币、金额和适用条件。若无报价,则在402响应或商户明确给出价格后,用用户的语言总结支付要求
  • 支付确认(强制): 用户必须先看到明确价格(报价结果或402摘要)。然后Agent必须再次询问;消息需涵盖金额资产/链(若已知)支付方式(若已知)仅在获得明确同意(例如“确认支付”、“继续支付”)后,才调用
    x402_sign_payment
    、拆分签名工具,或仅当支付MCP列出该工具时调用
    x402_request
    中的后续步骤。若用户拒绝不确定停止支付;提供其他商户选项或结束流程。
  • 工作流步骤1的“余额/意图”检查可与该“先看价格再确认”步骤合并,以避免重复询问;优先在价格可见并获得同意后进行一次明确确认。

Mapping discovery to Step 4

发现结果到步骤4的映射

  • url
    /
    method
    /
    body
    for
    x402_place_order
    (or
    x402_request
    when that is the HTTP tool on the server) come from the user message, conversation context, or upstream discovery (resource identity,
    outputSchema
    , or equivalent in the MCP response). Map field names to whatever the tool
    inputSchema
    requires.
  • x402_place_order
    (或服务器上用于HTTP处理的**
    x402_request
    )的
    url
    /
    method
    /
    body
    来自用户消息**、对话上下文上游发现结果(资源标识、
    outputSchema
    或MCP响应中的等价内容)。需将字段名称映射到工具
    inputSchema
    要求的名称。

Alignment with Workflow

与工作流的对齐

  • Step 4 remains merchant HTTP + 402 handling via
    x402_place_order
    or, when listed,
    x402_request
    (per server).
  • Steps 5–6 (MCP Wallet login if needed, sign / pay tools): run only after mandatory pay confirmation above (or immediately before first charge/sign, if merged with confirmation — not before the user has a clear price and agrees).
  • Same-server rule (payment): For one merchant order / one 402 challenge, all
    x402_*
    steps (place order, sign, submit, auth for pay) use the same payment MCP server id (typically
    gatepay-local-mcp
    ). Discovery may be invoked on a different server id; that does not break this rule—only
    x402_*
    must stay on one pay server for the order.
  • 步骤4仍通过
    x402_place_order
    或(当服务器列出时)
    x402_request
    (根据服务器情况)处理商户HTTP + 402请求。
  • 步骤5-6(必要时进行MCP Wallet登录、签名/支付工具):仅在上述强制支付确认之后运行(或在首次扣费/签名前立即运行,若与确认步骤合并——不得在用户看到明确价格并同意之前运行)。
  • 同服务器规则(支付): 对于一个商户订单/一个402挑战,所有**
    x402_*
    步骤(下单、签名、提交、支付认证)需使用同一支付MCP服务器ID**(通常为**
    gatepay-local-mcp
    )。发现功能可在不同服务器ID上调用;这违反该规则——仅
    x402_*
    **工具需在同一支付服务器上完成整个订单流程。

Wallet and rails (product rules)

钱包与通道(产品规则)

These override older wording elsewhere in this file where they conflict, except where a tool’s
inputSchema
requires a field (e.g. a URL argument): then
inputSchema
wins
— supply values per schema and vendor docs.
  1. plugin_wallet
    :
    User configures
    PLUGIN_WALLET_TOKEN
    in MCP
    env
    only (full token never in chat). Do not require
    PLUGIN_WALLET_SERVER_URL
    in user env as a default rule; implementation may use a built-in endpoint. If
    inputSchema
    still requires a URL (or similar) for a call, fill it per schema/docs — not by contradicting required fields.
  2. quick_wallet
    (MCP Wallet):
    Do not require
    MCP_WALLET_API_KEY
    ,
    MCP_WALLET_URL
    , or similar “quick wallet API URL” env vars. Session comes from tool-driven login (
    x402_quick_wallet_auth
    , or
    x402_request
    when that build uses it for login, per schema); after success, update
    PAYMENT_METHOD_PRIORITY
    as in Section 1 (MCP Wallet).
  3. Payment failure and rail switching: Use only rails that are actually configured and available (
    PAYMENT_METHOD_PRIORITY
    + env + login state). If only
    plugin_wallet
    is configured and it fails: do not start
    quick_wallet
    login/auth unless
    quick_wallet
    is already configured and the user explicitly agrees to switch. If there is no next rail, explain the failure, suggest checking token/plugin setup, and do not invent other payment methods. With multiple rails, you may try the next configured rail on failure; prefer a brief user check before switching rails (unless product defines a pure technical retry exception).
若以下规则与本文档其他内容存在冲突,优先遵循以下规则除非工具的**
inputSchema
要求特定字段(例如URL参数):此时
inputSchema
优先**——需根据Schema和供应商文档提供值。
  1. plugin_wallet
    用户仅需在MCP
    env
    中配置
    PLUGIN_WALLET_TOKEN
    (完整令牌绝对不能出现在聊天中)。不得要求用户在环境中配置**
    PLUGIN_WALLET_SERVER_URL
    作为默认规则;实现可使用内置端点。若
    inputSchema
    **仍要求调用时提供URL(或类似字段),需根据Schema/文档填充——不得违反必填字段要求。
  2. quick_wallet
    (MCP Wallet):
    不得要求用户提供
    MCP_WALLET_API_KEY
    MCP_WALLET_URL
    或类似的“快速钱包API URL”环境变量。会话通过工具驱动的登录
    x402_quick_wallet_auth
    ,或当构建版本使用该工具登录时的**
    x402_request
    ,需遵循Schema)建立;登录成功后,按第1节**(MCP Wallet)更新**
    PAYMENT_METHOD_PRIORITY
    **。
  3. 支付失败与通道切换: 仅使用已实际配置且可用的支付通道(
    PAYMENT_METHOD_PRIORITY
    + 环境 + 登录状态)。若配置了
    plugin_wallet
    且支付失败:不得启动未配置
    quick_wallet
    登录/认证,除非
    quick_wallet
    已配置且用户明确同意切换。若无下一个可用通道,需说明失败原因,建议用户检查令牌/插件设置,不得自行创建其他支付方式。若存在多个通道,可在失败时尝试下一个已配置的通道;优先在切换通道前向用户简要确认(除非产品定义了纯技术重试例外)。

Hard stops (non-exhaustive)

强制终止场景(非 exhaustive)

  • Discovery returns nothing usable and constraints cannot be relaxed → stop or relax and retry; do not fake merchants.
  • Required parameters missingdo not call the merchant or pay tools.
  • User has not explicitly agreed to pay after seeing price → do not call signature or payment tools.
  • Plugin-only config and plugin call faileddo not auto-launch unconfigured
    quick_wallet
    .

  • 发现结果可用资源且无法放宽约束→停止或放宽约束后重试;不得虚构商户。
  • 必填参数缺失不得调用商户或支付工具。
  • 用户在看到价格后明确同意支付→不得调用签名或支付工具。
  • 仅配置插件通道且插件调用失败不得自动启动未配置
    quick_wallet

MCP host setup (discovery + payment)

MCP宿主设置(发现+支付)

Many deployments use two MCP entries:
RoleTypical transportPurpose
Payment MCPstdio
npx -y gatepay-local-mcp
x402_place_order
,
x402_request
,
x402_sign_payment
,
x402_quick_wallet_auth
, other
x402_*
; wallet
env
(
PAYMENT_METHOD_PRIORITY
,
EVM_PRIVATE_KEY
,
PLUGIN_WALLET_TOKEN
, …) goes here.
Discovery MCP (optional)HTTP remote URL (host-specific)Payable-merchant catalog only (often tool name
discoveryResource
— confirm in the live tool list). No substitute for payment tools.
Merge both into the host’s MCP server map without removing unrelated MCPs. Reload MCP or restart the app after edits.
许多部署使用两个MCP条目:
角色典型传输方式用途
支付MCP标准输入输出
npx -y gatepay-local-mcp
x402_place_order
x402_request
x402_sign_payment
x402_quick_wallet_auth
、其他**
x402_*
工具;钱包
env
**(
PAYMENT_METHOD_PRIORITY
EVM_PRIVATE_KEY
PLUGIN_WALLET_TOKEN
等)配置在此处。
发现MCP(可选)HTTP远程URL(宿主特定)仅用于可付费商户的目录(通常工具名称为**
discoveryResource
**——需在实际工具列表中确认)。不能替代支付工具。
将两者合并到宿主的MCP服务器映射中,不得移除无关的MCP。编辑后需重新加载MCP或重启应用。

Example:
mcp.json
fragment (Cursor-style hosts)

示例:
mcp.json
片段(Cursor风格宿主)

Project:
<project>/.cursor/mcp.json
. User-wide:
~/.cursor/mcp.json
. Under
mcpServers
:
json
{
  "gatepay-merchant-discovery": {
    "url": "https://openplatform.gateapi.io/pay-mcp-server/mcp"
  },
  "gatepay-local-mcp": {
    "command": "npx",
    "args": ["-y", "gatepay-local-mcp"],
    "env": {}
  }
}
  • Keys (
    gatepay-merchant-discovery
    ,
    gatepay-local-mcp
    ) may be renamed; keep them stable for the session so the agent targets the correct server for each tool.
  • If your host requires a different shape for remote MCP (headers,
    transport
    , SSE), follow current host docs—the important part is registering both endpoints when your product uses split discovery + local pay.
  • Secrets belong only in
    gatepay-local-mcp
    ’s
    env
    (never in chat).

项目级:
<project>/.cursor/mcp.json
。用户级:
~/.cursor/mcp.json
。在
mcpServers
下:
json
{
  "gatepay-merchant-discovery": {
    "url": "https://openplatform.gateapi.io/pay-mcp-server/mcp"
  },
  "gatepay-local-mcp": {
    "command": "npx",
    "args": ["-y", "gatepay-local-mcp"],
    "env": {}
  }
}
  • 键名
    gatepay-merchant-discovery
    gatepay-local-mcp
    )可重命名;需在会话中保持稳定,以便Agent针对正确的服务器调用工具。
  • 若宿主对远程MCP要求不同的结构(头部、
    transport
    、SSE),需遵循当前宿主文档——重要的是当产品使用分离的发现+本地支付架构时,注册两个端点。
  • 机密信息仅能放在**
    gatepay-local-mcp
    env
    **中(绝对不能出现在聊天中)。

MCP Server Connection Detection

MCP服务器连接检测

Before the first Gate Pay
x402_*
tool call for payment or MCP Wallet auth, and before mandatory merchant discovery when the flow needs a catalog, run the probes below (skip when the user has only received Section 0.A and has not yet chosen a rail).
在首次调用Gate Pay
x402_*
工具(用于支付或MCP Wallet认证)之前,以及当流程需要目录服务时的强制商户发现之前,需运行以下探测步骤(当用户仅查看第0.A节
且尚未选择支付通道时,可跳过)。

A. Payment MCP (required for x402 pay / wallet auth)

A. 支付MCP(x402支付/钱包认证必需)

  1. Scan configured servers for at least one tool whose name starts with
    x402_
    (e.g.
    x402_place_order
    ,
    x402_sign_payment
    ,
    x402_quick_wallet_auth
    ). Some builds expose
    x402_request
    as the main HTTP/login tool instead of or alongside
    x402_place_order
    .
  2. Record that host’s server key as the payment server id (e.g.
    gatepay-local-mcp
    ).
  3. Verify the tool list includes
    x402_place_order
    or
    x402_request
    or another documented
    x402_*
    entry for merchant HTTP/402.
ResultAction
SuccessUse this payment server id for all
x402_*
calls this session for one order flow.
FailureShow Setup guide — payment MCP below; do not guess pay parameters.
  1. 扫描已配置的服务器,查找至少一个名称以**
    x402_
    开头的工具(例如
    x402_place_order
    x402_sign_payment
    x402_quick_wallet_auth
    )。部分构建版本会暴露
    x402_request
    **作为主要的HTTP/登录工具,替代或配合
    x402_place_order
    使用。
  2. 记录该宿主的服务器键作为支付服务器ID(例如
    gatepay-local-mcp
    )。
  3. 验证工具列表包含**
    x402_place_order
    **
    x402_request
    其他已记录的用于商户HTTP/402处理的**
    x402_*
    **条目。
结果操作
成功本次会话中,所有**
x402_*
调用均使用该支付服务器ID**完成一个订单流程。
失败展示下方的设置指南——支付MCP;不得猜测支付参数。

B. Discovery MCP (required only if mandatory discovery applies)

B. 发现MCP(仅当强制发现适用时必需)

  1. Scan all configured servers (including not the payment server) for the catalog tool — often
    discoveryResource
    ; use the exact name from the live list.
  2. Record that server key as the discovery server id (e.g.
    gatepay-merchant-discovery
    ) when present.
  3. If the user’s buy flow needs a catalog (When
    discoveryResource
    is mandatory
    ) and no server lists a discovery tool → show Setup guide — discovery MCP below.
ResultAction
Catalog tool foundCall discovery only on discovery server id; map results into
x402_place_order
/
x402_request
on payment server id.
Catalog missing but mandatoryUser must add discovery MCP or supply merchant URL/params manually.
Catalog not neededSkip; user gave sufficient merchant fields or session is wallet-only / Exchange-only.
Setup guide — payment MCP (show at most once per session when A fails):
Payment MCP (gatepay-local-mcp)
  - Add a stdio server: command "npx", args ["-y", "gatepay-local-mcp"], env { } (add PAYMENT_METHOD_PRIORITY / EVM_PRIVATE_KEY / PLUGIN_WALLET_TOKEN only when that rail is used — full secrets never in chat).
  - Cursor-style: merge into .cursor/mcp.json under mcpServers; reload MCP or restart the IDE.
  - Other hosts: register the same stdio command per product docs (VS Code MCP, Claude Code, OpenClaw, etc.).
Setup guide — discovery MCP (show at most once per session when B is required but missing):
Discovery MCP (example id: gatepay-merchant-discovery)
  - Add a remote MCP entry with your vendor URL, e.g. "url": "https://openplatform.gateapi.io/pay-mcp-server/mcp" (confirm exact URL and transport with your deployment).
  - Merge into the same mcpServers object as the payment MCP; reload MCP.
  - After reload, confirm the catalog tool appears (name may be discoveryResource or differ — use the live tool list).

  1. 扫描所有已配置的服务器(包括支付服务器),查找目录工具——通常为**
    discoveryResource
    ;需使用实际列表中的准确**名称。
  2. 当存在该工具时,记录服务器键作为发现服务器ID(例如
    gatepay-merchant-discovery
    )。
  3. 若用户的购买流程需要目录服务(强制调用
    discoveryResource
    的场景
    )且服务器列出发现工具→展示下方的设置指南——发现MCP
结果操作
找到目录工具仅在发现服务器ID上调用发现工具;将结果映射到支付服务器ID上的**
x402_place_order
/
x402_request
**。
需要目录服务但未找到用户必须添加发现MCP或手动提供商户URL/参数。
无需目录服务跳过;用户已提供足够的商户字段或会话仅涉及钱包/交易所支付。
设置指南——支付MCP(当A失败时,每个会话最多展示一次):
支付MCP(gatepay-local-mcp)
  - 添加标准输入输出服务器:命令为"npx",参数为["-y", "gatepay-local-mcp"],env为{}(仅当使用该通道时添加PAYMENT_METHOD_PRIORITY/EVM_PRIVATE_KEY/PLUGIN_WALLET_TOKEN——完整机密信息绝不能出现在聊天中)。
  - Cursor风格:合并到.cursor/mcp.json的mcpServers下;重新加载MCP或重启IDE。
  - 其他宿主:根据产品文档注册相同的标准输入输出命令(VS Code MCP、Claude Code、OpenClaw等)。
设置指南——发现MCP(当B需要但未找到时,每个会话最多展示一次):
发现MCP(示例ID:gatepay-merchant-discovery)
  - 添加远程MCP条目,使用供应商URL,例如"url": "https://openplatform.gateapi.io/pay-mcp-server/mcp"(请确认部署的准确URL和传输方式)。
  - 合并到与支付MCP相同的mcpServers对象中;重新加载MCP。
  - 重新加载后,确认目录工具已出现(名称可能为discoveryResource或其他——需使用实际工具列表中的名称)。

Wallet configuration procedure

钱包配置流程

When the user wants to configure, add, or change a payment wallet for Gate Pay MCP, follow this flow. Arguments for any MCP tool come from that tool’s
inputSchema
.
当用户想要为Gate Pay MCP配置、添加或更改支付钱包时,遵循以下流程。任何MCP工具的参数均来自该工具的**
inputSchema
**。

0. Entry

0. 入口

0.A Vague intent — first reply only (user-facing)

0.A 模糊意图 — 仅首次回复(面向用户)

If the user only asks to configure or add a wallet (e.g. “help me set up my wallet”, “configure wallet”) without naming a specific rail, this turn must be short and plain-language. Use the same language as the user (see User-facing language above).
  1. Give three options — for each, in plain language: what it is, who it suits, roughly what they will doone or two sentences total per option. Contrast the three clearly (browser/device login vs extension/Open API style vs holding a key on the machine):
    • MCP Wallet (localized: Quick Wallet, 快捷钱包, gate钱包 / Gate钱包): Sign in with Gate in a browser or device flow (like logging into an app); best for users who want no extension install and are fine with hosted login. After they pick, you’ll drive MCP tools to complete login and then payment order.
    • Plugin wallet: Uses the Gate browser extension and an Open API–style token you keep in local app settings — good for users who already use the Gate extension and want payments authorized from the plugin. After they pick, you’ll point them to get a token from the plugin side and paste it only into local config, not into random sites.
    • Private key (local signing): They put their own EVM private key in local config and the MCP signs on this machine — for advanced users who fully control a key and accept handling raw key material. After they pick, you’ll tell them to fill only local config, never type the key into chat.
  2. In this first message, do not include:
    env
    key names
    (e.g.
    EVM_PRIVATE_KEY
    ,
    PLUGIN_WALLET_*
    ,
    PAYMENT_METHOD_PRIORITY
    ), MCP tool names (e.g.
    x402_quick_wallet_auth
    ,
    x402_place_order
    ), enum tokens (
    quick_wallet
    ,
    plugin_wallet
    ), how to edit
    mcp.json
    (or other paths), or step-by-step technical procedures. Defer all of that until after they choose (Section 0.B → Sections 1–3).
  3. Tone: No long checklist, no env audit, no long security lecture. At most one short line, e.g. “After you choose, I’ll walk you through the next steps step by step.”
  4. Optionally one line for Gate Exchange pay if that MCP applies.
  5. Close by asking them to pick one (name or number). Wait for their choice (unless they already named a rail in the same first message).
若用户询问配置或添加钱包(例如“帮我设置钱包”、“配置钱包”)且指定具体支付通道,本次回复必须简短且使用通俗语言。需使用与用户相同的语言(请查看上文的用户可见语言)。
  1. 提供三个选项——每个选项需用通俗语言说明是什么适合谁大致操作步骤——每个选项最多1-2句话。需清晰区分三个选项(浏览器/设备登录 vs 扩展程序/Open API风格 vs 本地密钥存储):
    • MCP Wallet(本地化名称:Quick Wallet、快捷钱包gate钱包/Gate钱包):通过浏览器或设备流程使用Gate登录(类似登录应用);最适合不想安装扩展程序且接受托管登录的用户。用户选择后,将引导其使用MCP工具完成登录和支付订单。
    • 插件钱包: 使用Gate浏览器扩展程序和存储在本地应用设置中的Open API风格令牌——适合已在使用Gate扩展程序且希望通过插件授权支付的用户。用户选择后,将指导其从插件端获取令牌仅粘贴到本地配置中,而非随意网站。
    • 私钥(本地签名): 用户将自己的EVM私钥放入本地配置,MCP在本机完成签名——适合完全控制密钥且接受处理原始密钥材料高级用户。用户选择后,将指导其仅在本地配置中填写密钥,绝对不能在聊天中输入密钥。
  2. 首次回复中不得包含:
    env
    键名
    (例如
    EVM_PRIVATE_KEY
    PLUGIN_WALLET_*
    PAYMENT_METHOD_PRIORITY
    )、MCP工具名称(例如
    x402_quick_wallet_auth
    x402_place_order
    )、枚举令牌
    quick_wallet
    plugin_wallet
    )、编辑**
    mcp.json
    的方法(或其他路径),或分步技术流程。所有这些内容需推迟到用户选择后**(第0.B节→第1-3节)再提供。
  3. 语气: 不要使用冗长的清单、不要进行环境审计、不要进行冗长的安全说教。最多添加一句简短说明,例如“你选择后,我会一步步引导你完成后续操作。”
  4. 若适用,可添加一行关于Gate Exchange支付的说明。
  5. 结尾请用户选择一个选项(名称或编号)。等待用户选择(除非用户在同一条首次消息中已指定支付通道)。

0.B After the user chooses (or already named a rail)

0.B 用户选择后(或已指定支付通道)

Continue with Sections 1–3 / Section 5 — here you may use env keys, tool names,
PAYMENT_METHOD_PRIORITY
, and file edits per those sections. For MCP Wallet, run MCP Server Connection Detection and record the server identifier.
继续执行第1-3节/第5节——此处可使用环境键、工具名称、
PAYMENT_METHOD_PRIORITY
和文件编辑操作。对于MCP Wallet,需运行MCP服务器连接检测并记录服务器标识符。

1. MCP Wallet (
quick_wallet
)

1. MCP Wallet(
quick_wallet

MCP Wallet is one product channel; localized names (e.g. “Quick Wallet”) refer to the same rail. The MCP enum / env token remains
quick_wallet
— use that value in
PAYMENT_METHOD_PRIORITY
and in
sign_mode
(or equivalent fields) per
inputSchema
.
No user API key for this rail: MCP Wallet does not use
MCP_WALLET_API_KEY
, does not ask users to apply for or paste a “quick wallet API key”, and is not the same as the plugin wallet’s Open API token. Credentials come from the tool-driven login (device / OAuth flow); the implementation may persist session data locally (e.g. under
~/.gate-pay/
) — follow the tool response, not chat guesses.
Order: tool auth first, then
PAYMENT_METHOD_PRIORITY
only on success.
Do not write or merge
PAYMENT_METHOD_PRIORITY
until MCP Wallet login has succeeded per the tool you actually have (see below).
Wrong flows (MCP Wallet): Do not instruct users to set
MCP_WALLET_API_KEY
,
MCP_WALLET_URL
as a prerequisite, generic API keys, or
EVM_PRIVATE_KEY
for this rail. Do not conflate MCP Wallet with plugin_wallet token setup.
Which tool to call (read the live MCP tool list):
  • If
    x402_quick_wallet_auth
    exists → use it first;
    arguments
    from
    inputSchema
    (e.g. optional
    wallet_login_provider
    :
    gate
    |
    google
    ).
  • If
    x402_quick_wallet_auth
    is absent but
    x402_request
    is listed and its
    inputSchema
    supports MCP Wallet login → trigger login via
    x402_request
    using fields for
    quick_wallet
    (e.g.
    sign_mode
    :
    quick_wallet
    , and any required
    wallet_login_provider
    / URL params). Still no user API key — same auth-first rule; then update
    PAYMENT_METHOD_PRIORITY
    only after success. (Common npm
    gatepay-local-mcp
    single-tool builds often list only
    x402_request
    for both HTTP and MCP Wallet login—still only if listed.)
  • If the user chose centralized_payment and
    x402_gate_pay_auth
    is listed → follow that tool’s description and
    inputSchema
    for Gate Pay OAuth (separate from MCP Wallet login).
Definition — configured: MCP Wallet is fully configured only after login / device flow completes successfully (tool response success / ready). Failed or abandoned login → do not update
PAYMENT_METHOD_PRIORITY
.
  1. First — MCP tool: Per Which tool to call above, invoke
    x402_quick_wallet_auth
    , or
    x402_request
    when listed and used for
    quick_wallet
    login per schema, on the payment MCP (see MCP Server Connection Detection §A). Guide the user through MCP Wallet login until the tool indicates success / ready.
  2. If login succeeds (session established per tool response): then edit MCP
    env
    :
    • Add
      quick_wallet
      to
      PAYMENT_METHOD_PRIORITY
      (merge with existing list if any).
    • If no other rail was in
      PAYMENT_METHOD_PRIORITY
      before, you may set
      quick_wallet
      as the only or first entry per user’s stated intent at Section 0.B.
    • If one or more other rails were already in
      PAYMENT_METHOD_PRIORITY
      , ask the user explicitly: whether to make
      quick_wallet
      the new default (move to front). Only if the user says yes move it to the first position; if no, append
      quick_wallet
      without changing the current first token (do not reorder without confirmation — see Section 4).
  3. If auth / login fails (error, timeout, user cancelled, non-ready): do not change
    PAYMENT_METHOD_PRIORITY
    or add
    quick_wallet
    . Explain next steps; user may retry.
  4. After successful config writes, remind reload MCP / restart the host if needed.
  5. Disclose tool output after MCP Wallet login:
    • Private key / seed / exported signing secret: Never paste the full value in chat. Print it to the integrated terminal (stdout) so it works on macOS, Windows, and Linux: prefer
      node -e
      /
      node -p
      or
      python -c
      to print a JSON-safe or plain-text line; if neither runtime is on
      PATH
      , write a temporary file under the project (gitignored path) and run a command that prints its path or contents to the terminal, then tell the user in chat (in their language) to open the Terminal panel and copy from there — still do not put the secret in chat.
    • Public deposit / wallet addresses (non-secret identifiers): may show in chat in full or summarized, in the user’s language, plus any short context the user needs.
    • Other bulky or mixed responses: Strip or redact secrets for chat; put full private material only in terminal/temp file as above; addresses stay chat-eligible.
  6. Apply Safety Rules.
MCP Wallet是产品的一个通道;本地化名称(例如“Quick Wallet”)指同一通道。MCP枚举/环境令牌仍为**
quick_wallet
——需在
PAYMENT_METHOD_PRIORITY
sign_mode
(或等价字段)中使用该值,需遵循
inputSchema
**。
该通道无需用户API密钥: MCP Wallet使用**
MCP_WALLET_API_KEY
,不要求用户申请或粘贴“快速钱包API密钥”,且与插件钱包的Open API令牌不同**。凭证来自工具驱动的登录(设备/OAuth流程);实现可能在本地存储会话数据(例如**
~/.gate-pay/
**下)——需遵循工具响应,而非聊天猜测。
顺序: 先进行工具认证,仅在成功后更新
PAYMENT_METHOD_PRIORITY
不得在MCP Wallet登录成功前写入或合并**
PAYMENT_METHOD_PRIORITY
**(需根据实际使用的工具判断,见下文)。
错误流程(MCP Wallet): 不得指示用户设置**
MCP_WALLET_API_KEY
MCP_WALLET_URL
作为前提条件,不得使用通用API密钥或
EVM_PRIVATE_KEY
用于通道。不得混淆MCP Wallet与plugin_wallet**令牌设置。
需调用的工具(查看实际MCP工具列表):
  • 若存在**
    x402_quick_wallet_auth
    →优先使用该工具;
    arguments
    来自
    inputSchema
    **(例如可选的
    wallet_login_provider
    :
    gate
    |
    google
    )。
  • 若**
    x402_quick_wallet_auth
    不存在
    x402_request
    已列出且其
    inputSchema
    支持MCP Wallet登录→通过
    x402_request
    使用
    quick_wallet
    相关字段触发登录(例如
    sign_mode
    :
    quick_wallet
    ,以及任何必填的
    wallet_login_provider
    /URL参数)。仍无需用户API密钥——遵循相同的先认证规则;仅在成功后更新
    PAYMENT_METHOD_PRIORITY
    **。
    (常见的
    npm
    gatepay-local-mcp
    单工具构建版本通常仅列出
    x402_request
    用于HTTP和MCP Wallet登录——仍需仅当列出时**使用。)
  • 若用户选择centralized_payment且**
    x402_gate_pay_auth
    已列出→遵循该工具的描述和
    inputSchema
    **进行Gate Pay OAuth认证(与MCP Wallet登录分离)。
已配置定义: 仅当登录/设备流程成功完成(工具响应为success/ready)时,MCP Wallet才被视为完全配置。登录失败或中断→不得更新**
PAYMENT_METHOD_PRIORITY
**。
  1. 第一步——MCP工具: 根据上述需调用的工具说明,在支付MCP上调用**
    x402_quick_wallet_auth
    ,或当
    x402_request
    已列出且用于
    quick_wallet
    登录时调用该工具(请查看MCP服务器连接检测**§A)。引导用户完成MCP Wallet登录,直到工具指示success/ready
  2. 若登录成功(根据工具响应已建立会话):然后编辑MCP
    env
    • 将**
      quick_wallet
      添加到
      PAYMENT_METHOD_PRIORITY
      **(若已有列表则合并)。
    • 之前
      PAYMENT_METHOD_PRIORITY
      其他通道,可根据用户在第0.B节中表述的意图将**
      quick_wallet
      **设置为唯一或第一个条目。
    • 已有一个或多个其他通道在
      PAYMENT_METHOD_PRIORITY
      中,需明确询问用户:是否将**
      quick_wallet
      设为新默认**(移至列表首位)。仅当用户同意时将其移至首位;若用户不同意,则将**
      quick_wallet
      追加到列表末尾,不得更改当前首位令牌(不得未经确认重新排序——请查看第4节**)。
  3. 若认证/登录失败(错误、超时、用户取消、未就绪):不得更改**
    PAYMENT_METHOD_PRIORITY
    或添加
    quick_wallet
    **。说明后续步骤;用户可重试。
  4. 成功写入配置后,提醒用户重新加载MCP/重启宿主应用(若需要)。
  5. MCP Wallet登录后披露工具输出:
    • 私钥/助记词/导出的签名机密: 绝对不能聊天中粘贴完整值。需打印到集成终端(标准输出),以确保在macOS、Windows和Linux上均可使用:优先使用**
      node -e
      /
      node -p
      python -c
      打印JSON安全或纯文本内容;若PATH中无上述运行时,可在项目下创建临时文件**(已加入git忽略的路径),并运行命令将文件路径或内容打印到终端,然后在聊天中用用户的语言告知用户打开终端面板并从那里复制——仍不得将机密信息放入聊天。
    • 公开存款/钱包地址(非机密标识符):完整或摘要展示在聊天中,使用用户的语言,并添加用户所需的简短上下文。
    • 其他 bulky 或混合响应: 在聊天中剥离或编辑机密信息;仅将完整私密内容放入终端/临时文件(如上所述);地址可在聊天中展示。
  6. 遵循安全规则

2. Plugin wallet (
plugin_wallet
)

2. 插件钱包(
plugin_wallet

  1. PLUGIN_WALLET_TOKEN
    :
    Same
    plugin_wallet
    rules as Wallet and rails in GatePay merchant discovery & agent orchestration (token in
    env
    only
    , never full token in chat).
    PLUGIN_WALLET_SERVER_URL
    :
    optional per product defaults; if
    inputSchema
    requires a URL for a tool call, set it per schema/vendor docs.
  2. PAYMENT_METHOD_PRIORITY
    :
    Add
    plugin_wallet
    . If this is the second or later rail, ask whether
    plugin_wallet
    should become the default (first in list). Only reorder to put it first if the user confirms yes; otherwise append without changing the current default.
  3. No
    x402_quick_wallet_auth
    for this rail.
  4. Remind reload MCP after
    env
    changes.
  1. PLUGIN_WALLET_TOKEN
    遵循GatePay商户发现与Agent编排钱包与通道的**
    plugin_wallet
    规则(令牌仅存于
    env
    中,完整令牌绝不能出现在聊天中)。
    PLUGIN_WALLET_SERVER_URL
    :** 根据产品默认值可选;若**
    inputSchema
    **要求工具调用时提供URL,需根据Schema/供应商文档设置。
  2. PAYMENT_METHOD_PRIORITY
    添加**
    plugin_wallet
    。若这是第二个或后续通道,询问用户是否将
    plugin_wallet
    设为默认**(列表首位)。仅当用户确认同意时将其移至首位;否则追加到列表末尾,不得更改当前默认通道。
  3. 该通道无需调用**
    x402_quick_wallet_auth
    **。
  4. 提醒用户在更改
    env
    重新加载MCP

3. Private key / local signing (
local_private_key
)

3. 私钥/本地签名(
local_private_key

  1. In
    env
    , ensure
    EVM_PRIVATE_KEY
    exists for local signing. Use a placeholder in shared repos; the user fills the real value only in their local MCP config. Never collect or repeat a private key in chat.
  2. Add any
    RPC_URL
    (or equivalent) variables required by the MCP package docs.
  3. PAYMENT_METHOD_PRIORITY
    :
    Add
    local_private_key
    . If this is the second or later rail, ask whether
    local_private_key
    should become the default. Only move it first if the user confirms yes.
  4. No
    x402_quick_wallet_auth
    for this rail unless the user also uses MCP Wallet (
    quick_wallet
    ).
  5. Remind reload MCP after
    env
    changes.
  1. 在**
    env
    中,确保
    EVM_PRIVATE_KEY
    已配置用于本地签名。在共享仓库中使用占位符**;用户仅需在本地MCP配置中填写真实值。绝对不能在聊天中收集或重复私钥。
  2. 添加MCP包文档要求的任何**
    RPC_URL
    **(或等价)变量。
  3. PAYMENT_METHOD_PRIORITY
    添加**
    local_private_key
    。若这是第二个或后续通道,询问用户是否将
    local_private_key
    设为默认**。仅当用户确认同意时将其移至首位。
  4. 该通道无需调用**
    x402_quick_wallet_auth
    ,除非用户同时使用MCP Wallet**(
    quick_wallet
    )。
  5. 提醒用户在更改
    env
    重新加载MCP

4. Adding a second rail or changing default

4. 添加第二个通道或更改默认通道

  1. When the user binds a second or additional payment rail, never change the first token of
    PAYMENT_METHOD_PRIORITY
    (the current default) without an explicit user choice.
  2. Always ask a clear yes/no (or pick-one) question in the user’s language, e.g. “Should <rail> become the default payment method?” Only if the user answers yes, move that rail’s token to the front. If no, append the new rail or keep existing order as appropriate without promoting it to default.
  3. MCP Wallet (
    quick_wallet
    ):
    Auth (Section 1) still comes before any
    PAYMENT_METHOD_PRIORITY
    change that adds
    quick_wallet
    ; after successful login, apply the same user-confirmed rule for whether
    quick_wallet
    becomes default when other rails already exist.
  4. Reordering among rails already listed (user wants to switch default only): still require explicit confirmation before editing which token is first.
  1. 当用户绑定第二个或更多支付通道时,绝对不能无用户明确选择的情况下更改**
    PAYMENT_METHOD_PRIORITY
    首个**令牌(当前默认通道)。
  2. 始终用户的语言提出清晰的是/否(或选择)问题,例如“是否将**<通道>设为默认支付方式?”仅当用户回答时,才将该通道的令牌移至首位**。若用户回答,则追加新通道或保持现有顺序,不得将其设为默认。
  3. MCP Wallet(
    quick_wallet
    ):
    添加
    quick_wallet
    PAYMENT_METHOD_PRIORITY
    之前,仍需先完成认证(第1节);登录成功后,当已有其他通道时,遵循相同的用户确认规则决定是否将
    quick_wallet
    设为默认。
  4. 若用户仅想在已列出的通道间重新排序(仅切换默认通道):仍需在编辑首位令牌前获得明确确认

5. Gate Exchange (
gate_exchange
)

5. Gate Exchange(
gate_exchange

If the user configures exchange-only pay: ensure Gate Exchange MCP is registered separately; set
PAYMENT_METHOD_PRIORITY
to include
gate_exchange
when that is the intended rail. Payment tools are only on the Exchange MCP — read each tool’s
inputSchema
there.

若用户配置仅交易所支付:需确保Gate Exchange MCP已单独注册;当该通道为预期支付方式时,将**
gate_exchange
添加到
PAYMENT_METHOD_PRIORITY
。支付工具存在于Exchange MCP上——需查看该服务器上每个工具的
inputSchema
**。

Authentication State

认证状态

Payment and signing use whichever wallet rail the user has actually configured. Gate Pay MCP
env
is read from the host’s MCP config (path and format depend on Cursor, VS Code, Claude Code, etc. — not hardcoded here).
  • PAYMENT_METHOD_PRIORITY
    : If set in
    env
    , comma-separated; first token = default. Tokens:
    quick_wallet
    ,
    plugin_wallet
    ,
    local_private_key
    ,
    gate_exchange
    . If unset, infer rails only from non-empty env keys / MCP session, or ask the user.
  • local_private_key
    : Only when the user chose this rail:
    EVM_PRIVATE_KEY
    (and any RPC vars your MCP documents) must be set in
    env
    — never collect private keys in chat. If empty, this rail is unavailable.
  • quick_wallet
    (MCP Wallet):
    Setup = login success via tool auth (Section 1:
    x402_quick_wallet_auth
    if present, else
    x402_request
    when listed and schema supports MCP Wallet login). No
    MCP_WALLET_API_KEY
    for users. Auth before writing
    PAYMENT_METHOD_PRIORITY
    ; on failure, do not change that
    env
    . Pay: Workflow Step 5; on expiry, auth once then retry sign once.
  • plugin_wallet
    :
    PLUGIN_WALLET_TOKEN
    in
    env
    ;
    PLUGIN_WALLET_SERVER_URL
    not user-mandatory by default (see Wallet and rails). If
    inputSchema
    requires a URL argument, comply with schema. If the token is missing, this rail is unavailable.
  • gate_exchange
    : Gate Exchange MCP configured separately; route there only when that MCP exists and user selects this rail.
When a second or additional payment rail is added, ask whether the default should switch to the newly bound rail. Do not reorder
PAYMENT_METHOD_PRIORITY
until the user explicitly agrees to change the default.

支付和签名使用用户实际配置的钱包通道。Gate Pay MCP
env
宿主的MCP配置
中读取(路径和格式取决于Cursor、VS Code、Claude Code等——此处未硬编码)。
  • PAYMENT_METHOD_PRIORITY
    :若在**
    env
    中设置,为逗号分隔的字符串;首个令牌为默认通道。令牌包括:
    quick_wallet
    plugin_wallet
    local_private_key
    gate_exchange
    。若
    未设置**,仅根据非空环境键/MCP会话推断通道,或询问用户。
  • local_private_key
    :仅当用户选择该通道时,
    EVM_PRIVATE_KEY
    (及MCP文档要求的任何RPC变量)需在**
    env
    **中设置——绝对不能在聊天中收集私钥。若为空,该通道不可用。
  • quick_wallet
    (MCP Wallet):
    已设置 = 通过工具认证成功登录(第1节:若存在则使用**
    x402_quick_wallet_auth
    ,否则当
    x402_request
    已列出且Schema支持MCP Wallet登录时使用该工具)。无需用户提供
    MCP_WALLET_API_KEY
    。在写入
    PAYMENT_METHOD_PRIORITY
    之前需先完成认证;认证失败时不得更改该
    env
    **。支付: 工作流步骤5;会话过期时,重新认证一次后重试签名一次。
  • plugin_wallet
    PLUGIN_WALLET_TOKEN
    需在
    env
    中;
    PLUGIN_WALLET_SERVER_URL
    默认无需用户配置(请查看钱包与通道
    )。若**
    inputSchema
    **要求URL参数,需遵循Schema。若令牌缺失,该通道不可用。
  • gate_exchange
    :Gate Exchange MCP已单独配置;仅当该MCP存在且用户选择该通道时路由到此处。
当添加第二个或更多支付通道时,询问用户是否将新绑定的通道设为默认不得在用户明确同意更改默认通道前重新排序**
PAYMENT_METHOD_PRIORITY
**。

Gate Pay x402 Module (MCP Tools)

Gate Pay x402模块(MCP工具)

How to build
arguments
(mandatory)

如何构建
arguments
(强制要求)

Before every MCP tool call in this flow:
  1. Locate the tool by exact name on the correct server: discovery tools on the discovery server id (if any); all
    x402_*
    on the payment server id (see MCP Server Connection Detection).
  2. Read that tool's
    inputSchema
    :
    properties
    ,
    required
    ,
    enum
    ,
    description
    .
  3. Assemble
    arguments
    only from that schema and from allowed runtime values (user message, context, prior tool outputs).
Do not copy parameter tables from this Skill; the MCP
inputSchema
is the source of truth
. Any conflict between this file and
inputSchema
→ follow
inputSchema
.
If the MCP is not connected and schema is unavailable, complete MCP setup first or use vendor docs.
在本流程中每次调用MCP工具前:
  1. 正确的服务器上按准确名称找到工具:发现工具在发现服务器ID上(若存在);所有**
    x402_*
    工具在支付服务器ID上(请查看MCP服务器连接检测**)。
  2. 读取该工具的**
    inputSchema
    **:
    properties
    required
    enum
    description
  3. 仅根据该Schema和允许的运行时值(用户消息、上下文、之前的工具输出)组装
    arguments
不得复制本技能中的参数表;MCP
inputSchema
是唯一权威来源
若本文档与
inputSchema
存在冲突→遵循
inputSchema
。若MCP未连接且Schema不可用,需先完成MCP设置或使用供应商文档。

Tools (names to look up in MCP)

工具(需在MCP中查找的名称)

Merchant discovery: When listed on any server, use
discoveryResource
(or the exact name on that server) and its
inputSchema
. Invoke on the discovery server, not on the payment server unless both tools are co-listed there. If absent everywhere, skip discovery calls.
ToolClassificationSide-effect levelPurposeParameters
discoveryResource
Read (list)None (no pay)GatePay catalog search — invokable resources + metadata only (no pay/order)
resourceDes
,
resourceType
(
http
|
mcp
), optional
pageNum
,
pageSize
,
tenantId
see live
inputSchema
x402_place_order
Read / HTTPMerchant I/O only; no sign until later toolsSend merchant HTTP request; read status, headers, bodySee MCP
inputSchema
for
x402_place_order
x402_request
MixedLow when used for HTTP/login; High when schema drives combined sign/pay—still requires consent before any payOnly if listed — some builds use this for HTTP + 402 + optional sign, and/or MCP Wallet login via
quick_wallet
/
sign_mode
See MCP
inputSchema
for
x402_request
x402_quick_wallet_auth
Write (session)Establishes wallet sessionMCP Wallet device/OAuth auth (
quick_wallet
rail)
See MCP
inputSchema
for
x402_quick_wallet_auth
x402_gate_pay_auth
Write (session)OAuth session for centralized payGate Pay OAuth when user uses centralized_payment (Bearer token for submit per tool docs)See MCP
inputSchema
for
x402_gate_pay_auth
x402_sign_payment
Write (pay)High — signs and submits paymentParse 402, sign, submit payment (all-in-one)See MCP
inputSchema
for
x402_sign_payment
x402_create_signature
Write (sign)High — produces signing materialCreate signed payload / encoded signature onlySee MCP
inputSchema
for
x402_create_signature
x402_submit_payment
Write (pay)High — submits paymentSubmit payment with signature (split path)See MCP
inputSchema
for
x402_submit_payment
x402_centralized_payment
Write (pay)High — centralized settlement when server exposes itAccount-center / centralized pay path per MCP (if listed)See MCP
inputSchema
for
x402_centralized_payment
Merchant
url
/
method
/
body
come from the user message, conversation context, or upstream discovery (resource /
outputSchema
/ MCP discovery response — map per
inputSchema
); map field names to whatever the schema requires (
x402_place_order
and/or
x402_request
, only as listed on the connected server).
商户发现: 当任何服务器列出该工具时,使用**
discoveryResource
(或该服务器上的准确名称)及其
inputSchema
。仅在发现**服务器上调用,除非工具同时在支付服务器上列出。若所有服务器均未列出,跳过发现调用。
工具分类副作用级别用途参数
discoveryResource
读取(列表)无(无支付操作)GatePay目录搜索——仅返回可调用资源+元数据(无支付/下单
resourceDes
resourceType
http
|
mcp
)、可选**
pageNum
pageSize
tenantId
**——查看实际
inputSchema
x402_place_order
读取/HTTP仅商户I/O;后续工具才会签名发送商户HTTP请求;读取状态、头部、Body查看MCP
x402_place_order
inputSchema
x402_request
混合用于HTTP/登录时;当Schema驱动签名/支付结合时——仍需在支付前获得同意仅当列出时使用——部分构建版本用其处理HTTP+402+可选签名,和/或通过
quick_wallet
/
sign_mode
进行MCP Wallet登录
查看MCP
x402_request
inputSchema
x402_quick_wallet_auth
写入(会话)建立钱包会话MCP Wallet设备/OAuth认证(
quick_wallet
通道)
查看MCP
x402_quick_wallet_auth
inputSchema
x402_gate_pay_auth
写入(会话)用于中心化支付的OAuth会话当用户使用centralized_payment时的Gate Pay OAuth认证(根据工具文档使用Bearer令牌提交)查看MCP
x402_gate_pay_auth
inputSchema
x402_sign_payment
写入(支付)——签名并提交支付解析402、签名、提交支付(一站式)查看MCP
x402_sign_payment
inputSchema
x402_create_signature
写入(签名)——生成签名材料仅创建已签名的负载/编码签名查看MCP
x402_create_signature
inputSchema
x402_submit_payment
写入(支付)——提交支付使用签名提交支付(拆分路径)查看MCP
x402_submit_payment
inputSchema
x402_centralized_payment
写入(支付)——当服务器暴露时进行中心化结算根据MCP进行账户中心/中心化支付(若列出)查看MCP
x402_centralized_payment
inputSchema
商户的**
url
/
method
/
body
来自用户消息**、对话上下文上游发现结果(资源/
outputSchema
/MCP发现响应——需根据**
inputSchema
**映射);需将字段名称映射到Schema要求的名称(
x402_place_order
和/或
x402_request
仅当已连接服务器列出时使用)。

Execution workflow

执行工作流

Map user intent to parameter extraction → MCP connection probe (Step 0) → preflight (
inputSchema
required fields, env rails) → tool calls → user-visible summary
:
  1. Extract merchant URL/method/body or discovery constraints from the user and context. If When
    discoveryResource
    is mandatory
    applies, call the discovery tool on the discovery MCP before any
    x402_place_order
    /
    x402_request
    on the payment MCP, then derive Step 4 fields from the selected catalog item.
  2. Preflight per MCP Server Connection Detection and Authentication State; complete Wallet configuration procedure if the user is setting up a rail.
  3. Invoke tools in Workflow order; before each call, rebuild
    arguments
    from that tool’s
    inputSchema
    .
  4. Output per Report Template; on failures use Error handling.
将用户意图映射到参数提取→MCP连接探测(步骤0)→预检(
inputSchema
必填字段、环境通道)→工具调用→用户可见摘要
  1. 提取商户URL/方法/Body或发现约束(来自用户和上下文)。若强制调用
    discoveryResource
    的场景
    适用,需在支付MCP上调用**
    x402_place_order
    /
    x402_request
    之前,先在发现MCP**上调用发现工具,然后从所选目录项中导出步骤4的字段。
  2. 根据MCP服务器连接检测认证状态进行预检;若用户正在设置通道,完成钱包配置流程
  3. 工作流顺序调用工具;每次调用前,根据该工具的**
    inputSchema
    **重新构建
    arguments
  4. 根据报告模板输出结果;失败时使用错误处理

Workflow

工作流

x402 Payment Flow

x402支付流程

text
Step 0: MCP detection (once per session) — payment MCP (§A) + discovery MCP (§B) when catalog is required — see **MCP Server Connection Detection**
  |
Step 1: Payment intent checks — PAYMENT_METHOD_PRIORITY + env + user balance acknowledgment (user-confirmed)
  |
Step 2: Choose rail
  |- gate_exchange -> Gate Exchange MCP tools only (read each tool's inputSchema there)
  +- Gate Pay x402 -> Continue
  |
Step 3: Before each **`x402_*`** tool call on the **payment MCP** -> read that tool's inputSchema and build arguments
  |
Step 4: Merchant HTTP + 402 on **payment MCP**: `x402_place_order` **or** (if listed) `x402_request` — per live tool list and schema
  |- Non-402 -> handle per merchant rules
  +- 402 -> extract payment challenge from response per MCP/tool docs (e.g. headers); keep url/method/body for retry
  |
Step 5: If MCP Wallet (`quick_wallet`) -> before sign: `x402_quick_wallet_auth` **if listed**, else (if listed) satisfy login via `x402_request` per schema (e.g. `sign_mode`); on expiry -> same auth once then retry sign once (per product limits)
  |
Step 6: x402_sign_payment (default) OR x402_create_signature -> x402_submit_payment (split); **or** if `x402_request` is listed: further `x402_request` calls per schema for sign/pay
         For each step: arguments strictly from that tool's inputSchema; wire outputs only as schema/response shapes allow
  |
Step 7: Summarize success to the user in their language; **addresses** may be in chat; **private keys** only via terminal/temp-file flow per **Safety Rules** and **Wallet configuration procedure** Section 1 step 5
Discovery and pay confirmation: Catalog: If When
discoveryResource
is mandatory
applies, call the catalog tool on the discovery server first → select resource → continue from Step 3–4 on the payment MCP. If the user already supplies sufficient merchant HTTP fields per schema, skip catalog. If no server lists a discovery tool, skip catalog (user URLs/context only) unless the user must add discovery MCP per Setup guide — discovery MCP. Pay consent: After the user sees a clear price (quote or 402 summary), obtain explicit pay consent before Step 5–6 (merge with Step 1 if needed to avoid asking twice). Full rules: GatePay merchant discovery & agent orchestration.
Same-server rule: All
x402_*
steps for one merchant order / 402 challenge use the same payment MCP server id. Discovery may use a different server id.
text
步骤0:MCP检测(每个会话一次)——支付MCP(§A)+ 当需要目录服务时的发现MCP(§B)——请查看**MCP服务器连接检测**
  |
步骤1:支付意图检查——PAYMENT_METHOD_PRIORITY + 环境 + 用户余额确认(用户已确认)
  |
步骤2:选择通道
  |- gate_exchange -> 仅使用Gate Exchange MCP工具(查看该服务器上每个工具的inputSchema)
  +- Gate Pay x402 -> 继续
  |
步骤3:在**支付MCP**上调用每个**`x402_*`**工具前→读取该工具的inputSchema并构建参数
  |
步骤4:在**支付MCP**上处理商户HTTP + 402:`x402_place_order` **或**(若列出)`x402_request`——根据实际工具列表和Schema
  |- 非402响应 -> 根据商户规则处理
  +- 402响应 -> 根据MCP/工具文档从响应中提取支付挑战(例如头部);保留url/method/Body用于重试
  |
步骤5:若使用MCP Wallet(`quick_wallet`)→签名前:若列出则调用`x402_quick_wallet_auth`,否则(若列出)根据Schema通过`x402_request`完成登录(例如`sign_mode`);会话过期时→重新认证一次后重试签名一次(根据产品限制)
  |
步骤6:x402_sign_payment(默认)或x402_create_signature -> x402_submit_payment(拆分路径);**或**若列出`x402_request`:根据Schema进行后续`x402_request`调用以完成签名/支付
         每个步骤:参数严格来自该工具的inputSchema;仅根据Schema/响应结构传递输出
  |
步骤7:用用户的语言向用户总结成功结果;**地址**可在聊天中展示;**私钥**仅通过终端/临时文件流程传递(根据**安全规则**和**钱包配置流程**第1节步骤5)
发现与支付确认: 目录服务:强制调用
discoveryResource
的场景
适用,先在发现服务器上调用目录工具→选择资源→在支付MCP上从步骤3-4开始继续。若用户已提供足够的商户HTTP字段以满足Schema要求,跳过目录服务。若服务器列出发现工具,跳过目录服务(仅使用用户URL/上下文),除非用户需根据设置指南——发现MCP添加发现MCP。支付同意: 用户看到明确价格(报价或402摘要)后,需在步骤5-6之前获得明确支付同意(可与步骤1合并以避免重复询问)。完整规则请查看GatePay商户发现与Agent编排
同服务器规则: 对于一个商户订单/402挑战,所有**
x402_*
步骤需使用同一支付MCP服务器ID**。发现功能可使用不同服务器ID。

Judgment Logic Summary

判断逻辑摘要

  • Use Routing Rules to pick the subsection in this file (wallet setup, discovery, x402 pay, Exchange, MCP connectivity).
  • Discovery first when mandatory: If a discovery catalog tool is listed (on any server) and the user buys/orders without merchant HTTP parameters sufficient for
    inputSchema
    , call that tool on its server before
    x402_place_order
    /
    x402_request
    on the payment server — see When
    discoveryResource
    is mandatory
    .
  • Schema-first: Every MCP
    arguments
    object must match the target tool’s
    inputSchema
    ; on conflict,
    inputSchema
    wins
    .
  • Consent before writes: No signing, submission, or centralized payment tools until clear price + explicit user confirmation; confirmation covers all write steps in the flow (General Rules and Safety Rules).
  • Same-server (pay): One 402 challenge → one payment MCP server id for all related
    x402_*
    calls (discovery may be elsewhere).
  • Rails: Only switch or add default
    PAYMENT_METHOD_PRIORITY
    per Section 4 (explicit user choice).
  • 使用路由规则选择本文档中的小节(钱包设置、发现、x402支付、交易所、MCP连接性)。
  • 强制先发现: 若发现目录工具已列出(在任何服务器上)且用户购买/下单时未提供足够的商户HTTP参数以满足**
    inputSchema
    ,需在支付服务器上调用
    x402_place_order
    /
    x402_request
    之前,先在该工具所在服务器上调用发现工具——请查看强制调用
    discoveryResource
    的场景**。
  • Schema优先: 每个MCP
    arguments
    对象必须匹配目标工具的**
    inputSchema
    ;若存在冲突,
    inputSchema
    优先**。
  • 写入前需同意: 在用户看到明确价格并给出明确确认前,不得调用签名、提交或中心化支付工具;确认需覆盖流程中的所有写入步骤(通用规则安全规则)。
  • 同服务器(支付): 一个402挑战→所有相关**
    x402_*
    调用使用一个**支付MCP服务器ID(发现功能可在其他服务器)。
  • 通道规则: 仅根据第4节(用户明确选择)切换或添加默认**
    PAYMENT_METHOD_PRIORITY
    **。

Report Template

报告模板

After wallet setup or payment, respond in the user’s language with:
  • Outcome: success, failed, cancelled, or blocked (with reason).
  • Amounts / assets / chain when the MCP or merchant returned them; never invent values.
  • References from tool output (ids, hashes) only when present.
  • Next steps: retry, change rail, reload MCP, or end—without fabricating order or payment status.
钱包设置或支付完成后,用用户的语言回复:
  • 结果: 成功、失败、取消或阻止(含原因)。
  • 金额/资产/链: 仅当MCP或商户返回时展示;绝对不能自行编造值。
  • 参考信息: 仅展示工具输出中的引用(ID、哈希)(若存在)。
  • 下一步: 重试、更改通道、重新加载MCP或结束——不得编造订单或支付状态。

Scenarios

场景

QA-oriented Context / Prompt Examples / Expected Behavior templates live in
references/scenarios.md
.
面向QA的上下文/示例提示/预期行为模板位于**
references/scenarios.md
**。

Error handling

错误处理

SituationSuggested action
MCP timeout / transport errorRetry once; if it persists, suggest restarting the MCP host or checking network; re-run MCP Server Connection Detection.
Auth expired /
quick_wallet
not ready
Run
x402_quick_wallet_auth
, or
x402_request
when listed for login, per schema; then retry sign once before escalating.
User declines pay after seeing priceStop; do not call sign/pay tools; offer another merchant or end.
402 / insufficient balanceSurface MCP error text; suggest another configured rail only if available and the user agrees (Wallet and rails).
402 challenge missing or unparsableDo not invent payment params; re-run the HTTP tool your server lists (
x402_place_order
and/or
x402_request
) per schema or ask the user for merchant context; never fake a successful pay.
Missing tool / no
inputSchema
Finish install from the setup guide; do not guess parameters.
discoveryResource
errors or empty
items
Widen search text, check
resourceType
(
http
vs
mcp
); if still empty, fall back to user-provided merchant URL or end — do not invent catalog entries.
场景建议操作
MCP超时/传输错误重试一次;若仍失败,建议重启MCP宿主或检查网络;重新运行MCP服务器连接检测
认证过期/
quick_wallet
未就绪
根据Schema调用**
x402_quick_wallet_auth
,或当
x402_request
已列出用于登录时调用该工具;然后重试签名
一次**,若仍失败则升级处理。
用户看到价格后拒绝支付停止;不得调用签名/支付工具;提供其他商户选项或结束流程。
402/余额不足展示MCP错误文本;仅当其他通道可用用户同意时,建议使用其他已配置通道(钱包与通道)。
402挑战缺失或无法解析不得自行编造支付参数;重新运行服务器列出的HTTP工具(
x402_place_order
和/或
x402_request
)(根据Schema),或询问用户商户上下文;绝对不能伪造支付成功。
工具缺失/无
inputSchema
根据设置指南完成安装;不得猜测参数。
**
discoveryResource
**错误或
items
为空
放宽搜索文本、检查
resourceType
http
vs
mcp
);若仍为空,回退到用户提供的商户URL或结束流程——不得编造目录条目。

Data handling & eligibility

数据处理与合规性

  • Data flow: Payment traffic and wallet
    env
    go to the payment MCP (
    gatepay-local-mcp
    ). Discovery queries go to whichever server lists the catalog tool (possibly a remote URL MCP). Secrets (
    EVM_PRIVATE_KEY
    , full
    PLUGIN_WALLET_TOKEN
    , private keys from tool output) stay in payment MCP env or integrated terminal flows—not in chat (Safety Rules).
  • Age: Payment and account-linked flows assume the user is 18+ and complies with applicable Gate user agreements; do not proceed with payment setup if the user cannot meet those requirements.

  • 数据流: 支付流量和钱包**
    env
    发送到支付MCP**(
    gatepay-local-mcp
    )。发现查询发送到列出目录工具的服务器(可能是远程URL MCP)。机密信息
    EVM_PRIVATE_KEY
    、完整
    PLUGIN_WALLET_TOKEN
    、工具输出中的私钥)仅存于支付MCP env集成终端流程中——不得出现在聊天中(安全规则)。
  • 年龄要求: 支付和账户关联流程假设用户年满18岁且遵守适用的Gate用户协议;若用户无法满足这些要求,不得继续支付设置。

Sub-Modules

子模块

This skill uses single-file routing for procedural logic: wallet setup, discovery, workflow, and Exchange path all live in this
SKILL.md
. Use Routing Rules to jump to those sections.
references/scenarios.md
holds QA-oriented scenarios (prompt shapes and expected behavior); it is not a runtime routing submodule. Human-oriented docs:
README.md
,
CHANGELOG.md
.

本技能使用单文件路由处理流程逻辑:钱包设置、发现、工作流和交易所路径均位于本
SKILL.md
文件中。使用路由规则跳转到相应小节。
references/scenarios.md
包含面向QA的场景(提示格式和预期行为);它不是
运行时路由子模块。面向用户的文档:
README.md
CHANGELOG.md

Gate Exchange path

Gate Exchange路径

When
gate_exchange
is selected and Gate Exchange MCP is available: use only Exchange MCP tools for order/pay. Before each call, read that tool's
inputSchema
on the Exchange server. Do not complete the same Gate Pay
x402_place_order
order using a third-party x402 MCP.

当选择
gate_exchange
且Gate Exchange MCP可用时:仅使用Exchange MCP工具进行下单/支付。每次调用前,查看Exchange服务器上该工具的**
inputSchema
**。不得在第三方x402 MCP上完成同一Gate Pay
x402_place_order
订单。

Follow-up Routing

后续路由

User Intent After FlowTarget
Change default payment / add second walletThis file — Wallet configuration procedure Section 4
Retry after MCP Wallet (
quick_wallet
) expiry
This file — Workflow Step 5–6
Merchant params missingAsk user or upstream; then Step 4 with the HTTP tool the server lists (
x402_place_order
and/or
x402_request
) per schema
Discovery empty / cannot selectGatePay merchant discovery & agent orchestration — relax
resourceDes
/ filters or stop; retry the catalog tool on the discovery MCP with broader terms if listed
User declines pay after seeing priceStop pay tools; offer another merchant or end
Plugin rail failed, no other configured railGatePay merchant discovery & agent orchestration — do not auto-start unconfigured
quick_wallet

流程后用户意图目标
更改默认支付方式/添加第二个钱包本文档——钱包配置流程第4节
MCP Wallet(
quick_wallet
)过期后重试
本文档——工作流步骤5-6
商户参数缺失询问用户或上游;然后使用服务器列出的HTTP工具(
x402_place_order
和/或
x402_request
)(根据Schema)执行步骤4
发现结果为空/无法选择GatePay商户发现与Agent编排——放宽
resourceDes
/过滤条件或停止;若列出目录工具,在发现MCP上使用更宽泛的术语重试
用户看到价格后拒绝支付停止支付工具;提供其他商户选项或结束流程
插件通道失败,无其他已配置通道GatePay商户发现与Agent编排——不得自动启动未配置的
quick_wallet

Cross-Skill Collaboration

跨技能协作

Other skills or upstream layers may supply merchant
url
/
method
/
body
or discovery context. This skill orchestrates discovery (on discovery MCP when present) → selection → optional quote → pay confirmation →
x402_*
on the payment MCP (and optionally Gate Exchange MCP), using
inputSchema
for each tool call. It does not replace full merchant catalogs outside the MCP surface.

其他技能或上游层可能提供商户**
url
/
method
/
body
或发现上下文。本技能编排发现(当存在时在发现MCP上)→选择→可选报价→支付确认→支付MCP上的
x402_*
工具(及可选Gate Exchange MCP),每次工具调用均使用
inputSchema
**。它不替代MCP之外的完整商户目录。

Supported networks & assets

支持的网络与资产

Networks, tokens, and amounts are defined by the merchant 402 / payment-required payload and MCP behavior — not enumerated here. Follow tool responses and merchant rules.

网络、代币和金额由商户402/支付要求负载和MCP行为定义——未在此处枚举。需遵循工具响应和商户规则。

Safety Rules

安全规则

  1. Schema-first calls: Always align
    arguments
    with the target tool's
    inputSchema
    before invoking MCP. Skill vs
    inputSchema
    inputSchema
    wins
    (same as top Gate Pay x402 layer note and How to build
    arguments
    ).
  2. Sensitive payloads — MCP Wallet (
    quick_wallet
    ):
    Private keys, seeds, and exported signing secrets from the tool go only to the integrated terminal (or gitignored temp file + terminal pointer), never the agent chat — see Wallet configuration procedure Section 1 step 5; works on Windows, macOS, Linux via
    node
    /
    python
    or file fallback. Public deposit / wallet addresses may appear in chat. Do not dump huge raw JSON into chat; redact secrets in chat.
  3. Private keys — rails and user paste:
    local_private_key
    :
    User sets
    EVM_PRIVATE_KEY
    only in local MCP
    env
    never collect or repeat that key in chat (Section 3). MCP Wallet: Tool-returned secrets → terminal only (Section 1 step 5). If the user pastes any private key in chat: do not echo it, store it from chat, or sign from chat; tell them to put it only in
    env
    and to stop sending keys in chat. Signing uses env as MCP reads it.
  4. Open API tokens: Store in
    env
    ; mask or confirm in chat without exposing full values.
  5. Same-server / no cross-vendor mix for one Gate
    x402_place_order
    order: see Workflow.
  6. Session vs chat: Do not rely on chat memory for MCP Wallet login state; use
    x402_quick_wallet_auth
    and/or (when listed)
    x402_request
    for MCP Wallet login per schema; use
    x402_gate_pay_auth
    when listed and the user uses centralized_payment (see Wallet configuration procedure Section 1); rely on MCP responses as documented.
  1. Schema优先调用: 调用MCP前,始终确保
    arguments
    与目标工具的**
    inputSchema
    一致。技能与
    inputSchema
    冲突→
    inputSchema
    优先
    (与顶部
    Gate Pay x402层说明和如何构建
    arguments
    **一致)。
  2. 敏感负载——MCP Wallet(
    quick_wallet
    ):
    工具返回的私钥、助记词和导出的签名机密仅发送到集成终端(或已加入git忽略的临时文件+终端指引),绝对不能发送到Agent聊天——请查看钱包配置流程第1节步骤5;通过
    node
    /
    python
    或文件回退方式支持Windows、macOS、Linux公开存款/钱包地址可在聊天中展示。不得将庞大的原始JSON转储到聊天中;在聊天中编辑机密信息。
  3. 私钥——通道与用户粘贴:
    local_private_key
    用户仅在本地MCP
    env
    中设置
    EVM_PRIVATE_KEY
    ——绝对不能在聊天中收集或重复该密钥(第3节)。MCP Wallet: 工具返回的机密→仅发送到终端(第1节步骤5)。若用户在聊天中粘贴任何私钥: 不得回显、从聊天中存储或从聊天中签名;告知用户仅在**
    env
    中设置密钥,并停止在聊天中发送密钥。签名使用MCP读取的env**中的密钥。
  4. Open API令牌: 存储在**
    env
    **中;在聊天中屏蔽或确认,不得暴露完整值。
  5. 同服务器/禁止跨供应商混合处理一个Gate
    x402_place_order
    订单:请查看工作流
  6. 会话与聊天: 不得依赖聊天记忆存储MCP Wallet登录状态;使用**
    x402_quick_wallet_auth
    和/或(当列出时)
    x402_request
    根据Schema完成MCP Wallet登录;当用户使用centralized_payment
    x402_gate_pay_auth
    已列出时,使用该工具(请查看
    钱包配置流程**第1节);需遵循MCP文档依赖工具响应。