gatepay-local-mcp 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/Readme.md +360 -65
  2. package/dist/src/config/env-config.d.ts +32 -0
  3. package/dist/src/config/env-config.d.ts.map +1 -0
  4. package/dist/src/config/env-config.js +98 -0
  5. package/dist/src/config/env-config.js.map +1 -0
  6. package/dist/src/gate-pay/auth.d.ts +18 -0
  7. package/dist/src/gate-pay/auth.d.ts.map +1 -0
  8. package/dist/src/gate-pay/auth.js +38 -0
  9. package/dist/src/gate-pay/auth.js.map +1 -0
  10. package/dist/src/gate-pay/centralized-payment/index.d.ts +6 -0
  11. package/dist/src/gate-pay/centralized-payment/index.d.ts.map +1 -0
  12. package/dist/src/gate-pay/centralized-payment/index.js +6 -0
  13. package/dist/src/gate-pay/centralized-payment/index.js.map +1 -0
  14. package/dist/src/gate-pay/centralized-payment/parser.d.ts +50 -0
  15. package/dist/src/gate-pay/centralized-payment/parser.d.ts.map +1 -0
  16. package/dist/src/gate-pay/centralized-payment/parser.js +59 -0
  17. package/dist/src/gate-pay/centralized-payment/parser.js.map +1 -0
  18. package/dist/src/gate-pay/centralized-payment/payment-client.d.ts +28 -0
  19. package/dist/src/gate-pay/centralized-payment/payment-client.d.ts.map +1 -0
  20. package/dist/src/gate-pay/centralized-payment/payment-client.js +84 -0
  21. package/dist/src/gate-pay/centralized-payment/payment-client.js.map +1 -0
  22. package/dist/src/gate-pay/device-flow.d.ts +25 -0
  23. package/dist/src/gate-pay/device-flow.d.ts.map +1 -0
  24. package/dist/src/gate-pay/device-flow.js +49 -0
  25. package/dist/src/gate-pay/device-flow.js.map +1 -0
  26. package/dist/src/gate-pay/gate-oauth-class.d.ts +21 -0
  27. package/dist/src/gate-pay/gate-oauth-class.d.ts.map +1 -0
  28. package/dist/src/gate-pay/gate-oauth-class.js +229 -0
  29. package/dist/src/gate-pay/gate-oauth-class.js.map +1 -0
  30. package/dist/src/gate-pay/gate-oauth-config.d.ts +7 -0
  31. package/dist/src/gate-pay/gate-oauth-config.d.ts.map +1 -0
  32. package/dist/src/gate-pay/gate-oauth-config.js +107 -0
  33. package/dist/src/gate-pay/gate-oauth-config.js.map +1 -0
  34. package/dist/src/gate-pay/gate-oauth.d.ts +6 -0
  35. package/dist/src/gate-pay/gate-oauth.d.ts.map +1 -0
  36. package/dist/src/gate-pay/gate-oauth.js +6 -0
  37. package/dist/src/gate-pay/gate-oauth.js.map +1 -0
  38. package/dist/src/gate-pay/local-oauth-base.d.ts +25 -0
  39. package/dist/src/gate-pay/local-oauth-base.d.ts.map +1 -0
  40. package/dist/src/gate-pay/local-oauth-base.js +193 -0
  41. package/dist/src/gate-pay/local-oauth-base.js.map +1 -0
  42. package/dist/src/gate-pay/oauth-browser.d.ts +2 -0
  43. package/dist/src/gate-pay/oauth-browser.d.ts.map +1 -0
  44. package/dist/src/gate-pay/oauth-browser.js +32 -0
  45. package/dist/src/gate-pay/oauth-browser.js.map +1 -0
  46. package/dist/src/gate-pay/oauth-html.d.ts +3 -0
  47. package/dist/src/gate-pay/oauth-html.d.ts.map +1 -0
  48. package/dist/src/gate-pay/oauth-html.js +43 -0
  49. package/dist/src/gate-pay/oauth-html.js.map +1 -0
  50. package/dist/src/gate-pay/oauth-log.d.ts +2 -0
  51. package/dist/src/gate-pay/oauth-log.d.ts.map +1 -0
  52. package/dist/src/gate-pay/oauth-log.js +10 -0
  53. package/dist/src/gate-pay/oauth-log.js.map +1 -0
  54. package/dist/src/gate-pay/oauth-token-exchange.d.ts +19 -0
  55. package/dist/src/gate-pay/oauth-token-exchange.d.ts.map +1 -0
  56. package/dist/src/gate-pay/oauth-token-exchange.js +49 -0
  57. package/dist/src/gate-pay/oauth-token-exchange.js.map +1 -0
  58. package/dist/src/gate-pay/oauth-types.d.ts +33 -0
  59. package/dist/src/gate-pay/oauth-types.d.ts.map +1 -0
  60. package/dist/src/gate-pay/oauth-types.js +2 -0
  61. package/dist/src/gate-pay/oauth-types.js.map +1 -0
  62. package/dist/src/gate-pay/pay-token-store.d.ts +18 -0
  63. package/dist/src/gate-pay/pay-token-store.d.ts.map +1 -0
  64. package/dist/src/gate-pay/pay-token-store.js +134 -0
  65. package/dist/src/gate-pay/pay-token-store.js.map +1 -0
  66. package/dist/src/index.js +18 -631
  67. package/dist/src/index.js.map +1 -1
  68. package/dist/src/modes/build-pay-fetch.d.ts +3 -2
  69. package/dist/src/modes/build-pay-fetch.d.ts.map +1 -1
  70. package/dist/src/modes/build-pay-fetch.js +7 -14
  71. package/dist/src/modes/build-pay-fetch.js.map +1 -1
  72. package/dist/src/modes/local-private-key.d.ts.map +1 -1
  73. package/dist/src/modes/local-private-key.js +31 -10
  74. package/dist/src/modes/local-private-key.js.map +1 -1
  75. package/dist/src/modes/plugin-wallet.d.ts +12 -0
  76. package/dist/src/modes/plugin-wallet.d.ts.map +1 -1
  77. package/dist/src/modes/plugin-wallet.js +222 -20
  78. package/dist/src/modes/plugin-wallet.js.map +1 -1
  79. package/dist/src/modes/quick-wallet.d.ts.map +1 -1
  80. package/dist/src/modes/quick-wallet.js +13 -2
  81. package/dist/src/modes/quick-wallet.js.map +1 -1
  82. package/dist/src/modes/registry.d.ts.map +1 -1
  83. package/dist/src/modes/registry.js +4 -1
  84. package/dist/src/modes/registry.js.map +1 -1
  85. package/dist/src/modes/signers/index.d.ts +4 -0
  86. package/dist/src/modes/signers/index.d.ts.map +1 -0
  87. package/dist/src/modes/signers/index.js +4 -0
  88. package/dist/src/modes/signers/index.js.map +1 -0
  89. package/dist/src/modes/signers/local-private-key.d.ts +12 -0
  90. package/dist/src/modes/signers/local-private-key.d.ts.map +1 -0
  91. package/dist/src/modes/signers/local-private-key.js +44 -0
  92. package/dist/src/modes/signers/local-private-key.js.map +1 -0
  93. package/dist/src/modes/signers/plugin-wallet.d.ts +12 -0
  94. package/dist/src/modes/signers/plugin-wallet.d.ts.map +1 -0
  95. package/dist/src/modes/signers/plugin-wallet.js +114 -0
  96. package/dist/src/modes/signers/plugin-wallet.js.map +1 -0
  97. package/dist/src/modes/signers/quick-wallet.d.ts +16 -0
  98. package/dist/src/modes/signers/quick-wallet.d.ts.map +1 -0
  99. package/dist/src/modes/signers/quick-wallet.js +130 -0
  100. package/dist/src/modes/signers/quick-wallet.js.map +1 -0
  101. package/dist/src/modes/signers/shared-utils.d.ts +27 -0
  102. package/dist/src/modes/signers/shared-utils.d.ts.map +1 -0
  103. package/dist/src/modes/signers/shared-utils.js +230 -0
  104. package/dist/src/modes/signers/shared-utils.js.map +1 -0
  105. package/dist/src/modes/types.d.ts +16 -1
  106. package/dist/src/modes/types.d.ts.map +1 -1
  107. package/dist/src/tools/centralized-payment.d.ts +7 -0
  108. package/dist/src/tools/centralized-payment.d.ts.map +1 -0
  109. package/dist/src/tools/centralized-payment.js +76 -0
  110. package/dist/src/tools/centralized-payment.js.map +1 -0
  111. package/dist/src/tools/create-signature.d.ts +4 -0
  112. package/dist/src/tools/create-signature.d.ts.map +1 -0
  113. package/dist/src/tools/create-signature.js +82 -0
  114. package/dist/src/tools/create-signature.js.map +1 -0
  115. package/dist/src/tools/gate-pay-auth.d.ts +3 -0
  116. package/dist/src/tools/gate-pay-auth.d.ts.map +1 -0
  117. package/dist/src/tools/gate-pay-auth.js +40 -0
  118. package/dist/src/tools/gate-pay-auth.js.map +1 -0
  119. package/dist/src/tools/index.d.ts +10 -0
  120. package/dist/src/tools/index.d.ts.map +1 -0
  121. package/dist/src/tools/index.js +10 -0
  122. package/dist/src/tools/index.js.map +1 -0
  123. package/dist/src/tools/place-order.d.ts +3 -0
  124. package/dist/src/tools/place-order.d.ts.map +1 -0
  125. package/dist/src/tools/place-order.js +36 -0
  126. package/dist/src/tools/place-order.js.map +1 -0
  127. package/dist/src/tools/quick-wallet-auth.d.ts +6 -0
  128. package/dist/src/tools/quick-wallet-auth.d.ts.map +1 -0
  129. package/dist/src/tools/quick-wallet-auth.js +32 -0
  130. package/dist/src/tools/quick-wallet-auth.js.map +1 -0
  131. package/dist/src/tools/schemas.d.ts +225 -0
  132. package/dist/src/tools/schemas.d.ts.map +1 -0
  133. package/dist/src/tools/schemas.js +274 -0
  134. package/dist/src/tools/schemas.js.map +1 -0
  135. package/dist/src/tools/sign-payment.d.ts +4 -0
  136. package/dist/src/tools/sign-payment.d.ts.map +1 -0
  137. package/dist/src/tools/sign-payment.js +94 -0
  138. package/dist/src/tools/sign-payment.js.map +1 -0
  139. package/dist/src/tools/submit-payment.d.ts +3 -0
  140. package/dist/src/tools/submit-payment.d.ts.map +1 -0
  141. package/dist/src/tools/submit-payment.js +43 -0
  142. package/dist/src/tools/submit-payment.js.map +1 -0
  143. package/dist/src/tools/x402-request.d.ts +8 -0
  144. package/dist/src/tools/x402-request.d.ts.map +1 -0
  145. package/dist/src/tools/x402-request.js +65 -0
  146. package/dist/src/tools/x402-request.js.map +1 -0
  147. package/dist/src/utils/balance-check.d.ts +3 -0
  148. package/dist/src/utils/balance-check.d.ts.map +1 -0
  149. package/dist/src/utils/balance-check.js +40 -0
  150. package/dist/src/utils/balance-check.js.map +1 -0
  151. package/dist/src/utils/client-registry.d.ts +7 -0
  152. package/dist/src/utils/client-registry.d.ts.map +1 -0
  153. package/dist/src/utils/client-registry.js +34 -0
  154. package/dist/src/utils/client-registry.js.map +1 -0
  155. package/dist/src/utils/response-helpers.d.ts +8 -0
  156. package/dist/src/utils/response-helpers.d.ts.map +1 -0
  157. package/dist/src/utils/response-helpers.js +56 -0
  158. package/dist/src/utils/response-helpers.js.map +1 -0
  159. package/dist/src/utils/validation.d.ts +3 -0
  160. package/dist/src/utils/validation.d.ts.map +1 -0
  161. package/dist/src/utils/validation.js +34 -0
  162. package/dist/src/utils/validation.js.map +1 -0
  163. package/dist/src/wallets/device-flow-login.d.ts.map +1 -1
  164. package/dist/src/wallets/device-flow-login.js +1 -0
  165. package/dist/src/wallets/device-flow-login.js.map +1 -1
  166. package/dist/src/wallets/plugin-wallet-client.d.ts +8 -0
  167. package/dist/src/wallets/plugin-wallet-client.d.ts.map +1 -1
  168. package/dist/src/wallets/plugin-wallet-client.js +17 -0
  169. package/dist/src/wallets/plugin-wallet-client.js.map +1 -1
  170. package/dist/src/x402/exactSvmScheme.d.ts +20 -0
  171. package/dist/src/x402/exactSvmScheme.d.ts.map +1 -0
  172. package/dist/src/x402/exactSvmScheme.js +38 -0
  173. package/dist/src/x402/exactSvmScheme.js.map +1 -0
  174. package/dist/src/x402/fetch.d.ts.map +1 -1
  175. package/dist/src/x402/fetch.js +2 -0
  176. package/dist/src/x402/fetch.js.map +1 -1
  177. package/dist/src/x402/types.d.ts +5 -0
  178. package/dist/src/x402/types.d.ts.map +1 -1
  179. package/dist/src/x402/types.js +0 -3
  180. package/dist/src/x402/types.js.map +1 -1
  181. package/package.json +21 -8
  182. package/dist/src/modes/signers.d.ts +0 -40
  183. package/dist/src/modes/signers.d.ts.map +0 -1
  184. package/dist/src/modes/signers.js +0 -293
  185. package/dist/src/modes/signers.js.map +0 -1
package/Readme.md CHANGED
@@ -1,32 +1,258 @@
1
1
  # gatepay-local-mcp
2
2
 
3
- `gatepay-local-mcp` is a local `stdio` MCP server for calling **x402 payment-protected** HTTP endpoints. It exposes a single MCP tool, `x402_request`. When the upstream service returns `402 Payment Required`, the server parses the payment requirements, prepares the payment payload, signs it with the selected signer, and retries the request automatically.
3
+ `gatepay-local-mcp` is a local `stdio` MCP server for calling **X402 payment-protected** HTTP endpoints. It provides a suite of MCP tools to handle the complete X402 payment workflow, from placing orders to signing payments and submitting them to merchants.
4
4
 
5
5
  ## Features
6
6
 
7
- - One MCP tool: `x402_request`
8
- - Built-in x402 payment flow under `src/x402-standalone/`
9
- - Multiple signing modes via `sign_mode`
7
+ - **7 MCP Tools** covering order placement, signature flows, quick wallet / Gate Pay auth, and centralized payment retries
8
+ - Built-in X402 payment flow under `src/x402/`
9
+ - **Multiple signing modes**: `local_private_key`, `quick_wallet`, `plugin_wallet`
10
+ - **Multi-chain support**: EVM (Ethereum, Base, Polygon, etc.) and Solana
10
11
  - Works with Cursor, Claude Desktop, and other MCP clients
11
- - Supports auto-selecting the first ready signing mode
12
+ - Auto-selects the first ready signing mode if not specified
13
+ - Gate Pay centralized payment (`sign_mode: centralized_payment`) and `x402_centralized_payment` helper for merchant-side settlement
14
+
15
+ ## Available Tools
16
+
17
+ ### 1. `x402_place_order`
18
+
19
+ Send an HTTP request and return complete response information including headers, body, and the original request details.
20
+
21
+ **Use case**: Initial request to a payment-protected endpoint that returns `402 Payment Required`.
22
+
23
+ **Parameters**:
24
+ ```typescript
25
+ {
26
+ url: string; // Target URL (required)
27
+ method?: string; // HTTP method: GET, POST, PUT, PATCH (default: POST)
28
+ body?: string; // JSON string request body (optional)
29
+ sign_mode?: string; // Signing mode: local_private_key, quick_wallet, plugin_wallet (auto-select if omitted)
30
+ wallet_login_provider?: string; // OAuth provider: google, gate (default: gate)
31
+ }
32
+ ```
33
+
34
+ **Returns**: Complete response with status code, headers (including `PAYMENT-REQUIRED`), body, and original request details.
35
+
36
+ ---
37
+
38
+ ### 2. `x402_sign_payment`
39
+
40
+ Parse X402 payment requirements, create a signed payment authorization, and submit the payment to complete a 402-protected request (all-in-one workflow).
41
+
42
+ **Use case**: Single-step payment flow - parse, sign, and submit in one call.
43
+
44
+ **Parameters**:
45
+ ```typescript
46
+ {
47
+ url: string; // Target URL (required)
48
+ method?: string; // HTTP method (default: POST)
49
+ body?: string; // JSON request body (optional)
50
+ payment_required_header?: string; // Base64-encoded PAYMENT-REQUIRED header
51
+ response_body?: string; // Response body from 402 response (alternative to header)
52
+ sign_mode?: string; // Signing mode (auto-select if omitted)
53
+ wallet_login_provider?: string; // OAuth provider (default: gate)
54
+ }
55
+ ```
56
+
57
+ **Returns**: Final response from the merchant after successful payment.
58
+
59
+ ---
60
+
61
+ ### 3. `x402_create_signature`
62
+
63
+ Parse X402 payment requirements and create a signed payment authorization.
64
+
65
+ **Use case**: Two-step workflow - create signature first, then submit separately.
66
+
67
+ **Parameters**:
68
+ ```typescript
69
+ {
70
+ payment_required_header?: string; // Base64-encoded PAYMENT-REQUIRED header
71
+ response_body?: string; // Response body from 402 response (alternative to header)
72
+ sign_mode?: string; // Signing mode (auto-select if omitted)
73
+ wallet_login_provider?: string; // OAuth provider (default: gate)
74
+ }
75
+ ```
76
+
77
+ **Returns**: Payment payload and base64-encoded `PAYMENT-SIGNATURE` header value.
78
+
79
+ ---
80
+
81
+ ### 4. `x402_submit_payment`
82
+
83
+ Submit a signed payment to complete a 402-protected request.
84
+
85
+ **Use case**: Second step of two-step workflow - submit the signature created by `x402_create_signature`.
86
+
87
+ **Parameters**:
88
+ ```typescript
89
+ {
90
+ url: string; // Target URL (required)
91
+ method?: string; // HTTP method (default: POST)
92
+ body?: string; // JSON request body (optional)
93
+ payment_signature: string; // Base64-encoded PAYMENT-SIGNATURE from x402_create_signature (required)
94
+ }
95
+ ```
96
+
97
+ **Returns**: Final response from the merchant.
98
+
99
+ ---
100
+
101
+ ### 5. `x402_quick_wallet_auth`
102
+
103
+ Pre-authorize with Quick Wallet using device-flow OAuth (Google or Gate account).
104
+
105
+ **Use case**: When using `sign_mode: quick_wallet`, run this first to complete the device-flow login before making payment requests.
106
+
107
+ **Parameters**:
108
+ ```typescript
109
+ {
110
+ wallet_login_provider?: string; // OAuth provider: google, gate (default: gate)
111
+ }
112
+ ```
113
+
114
+ **Returns**: Authorization status and wallet addresses (EVM and Solana).
115
+
116
+ ---
117
+
118
+ ### 6. `x402_gate_pay_auth`
119
+
120
+ Complete the Gate Pay OAuth device flow (browser authorize URL + localhost callback + remote token exchange) and cache the resulting access token/UID for centralized payments.
121
+
122
+ **Use case**: Required before calling `x402_submit_payment` with `sign_mode: centralized_payment` or when preparing to use `x402_centralized_payment`.
123
+
124
+ **Parameters**: _None_
125
+
126
+ **Returns**: Current authorization status with masked Gate Pay UID and access token indicators.
127
+
128
+ ---
129
+
130
+ ### 7. `x402_centralized_payment`
131
+
132
+ Parse the Base64-encoded `PAYMENT-REQUIRED` header and complete the Gate Pay centralized payment flow without submitting a `PAYMENT-SIGNATURE`.
133
+
134
+ **Use case**: When a merchant expects Gate Pay centralized settlement (e.g., OTA or off-chain marketplace) and you prefer an all-in-one helper instead of crafting `PAYMENT-SIGNATURE`.
135
+
136
+ **Parameters**:
137
+ ```typescript
138
+ {
139
+ payment_required_header: string; // Base64-encoded PAYMENT-REQUIRED header (required)
140
+ }
141
+ ```
142
+
143
+ **Returns**: Payment confirmation including `prepayId`, `merchantTradeNo`, currency, amount, and the raw API response.
144
+
145
+ ---
146
+
147
+ ## Workflow Examples
148
+
149
+ ### Single-Step Workflow (Recommended)
150
+
151
+ ```
152
+ 1. x402_place_order → Get payment requirements
153
+ 2. x402_sign_payment → Sign and submit payment (all-in-one)
154
+ ```
155
+
156
+ ### Two-Step Workflow (Advanced)
157
+
158
+ ```
159
+ 1. x402_place_order → Get payment requirements
160
+ 2. x402_create_signature → Create signed payment
161
+ 3. x402_submit_payment → Submit signed payment
162
+ ```
163
+
164
+ ### Quick Wallet Pre-Auth
165
+
166
+ ```
167
+ 1. x402_quick_wallet_auth → Authorize with Google/Gate
168
+ 2. x402_place_order → Get payment requirements
169
+ 3. x402_sign_payment → Sign and submit (using quick_wallet)
170
+ ```
171
+
172
+ ### Centralized Payment (Gate Pay)
173
+
174
+ ```
175
+ 1. x402_gate_pay_auth → Browser OAuth + token exchange (repeat when token expires)
176
+ 2. x402_place_order → Receive PAYMENT-REQUIRED header that encodes Gate Pay order info
177
+ 3. x402_submit_payment → Use payment_signature + sign_mode: "centralized_payment" to call the merchant with Authorization: Bearer
178
+
179
+ 3. x402_centralized_payment → Pass payment_required_header directly for all-in-one centralized settlement
180
+ ```
12
181
 
13
182
  ## Signing Modes
14
183
 
15
- The server currently registers these signing modes:
184
+ The server supports three automatic signing modes plus a dedicated Gate Pay centralized mode:
16
185
 
17
- | `sign_mode` | Status | Description |
18
- | ------------------- | ------------------------------------------------ | ------------------------------------------------------------------------ |
19
- | `local_private_key` | Ready when `EVM_PRIVATE_KEY` is set | Signs locally with your EVM private key |
20
- | `quick_wallet` | Ready after login | Uses the remote MCP wallet and can trigger device-flow login when needed |
21
- | `plugin_wallet` | Ready when `PLUGIN_WALLET_TOKEN` is set | Signs via browser extension wallet (e.g., Gate Wallet) |
186
+ | `sign_mode` | Status | Networks / Scope | Description |
187
+ | ----------------------- | --------------------------------------------- | ---------------- | ----------------------------------------------------------------------------------------------- |
188
+ | `local_private_key` | Ready when `EVM_PRIVATE_KEY` / `SVM_PRIVATE_KEY` set | EVM, Solana | Signs locally with your private keys (no external dependencies) |
189
+ | `quick_wallet` | Ready after OAuth login | EVM, Solana | Custodial MCP wallet with device-flow login (Google/Gate account) |
190
+ | `plugin_wallet` | Ready when `PLUGIN_WALLET_TOKEN` set | EVM, Solana | Browser extension wallet (e.g., Gate Wallet) via MCP bridge |
191
+ | `centralized_payment` | Ready after `x402_gate_pay_auth` completes | Gate Pay | Adds `Authorization: Bearer <Gate Pay access_token>` when calling `x402_submit_payment` or use `x402_centralized_payment` |
22
192
 
23
- If `sign_mode` is omitted, the server auto-selects the highest-priority ready mode.
193
+ **Priority Order** (auto-selection applies to the first three rows when `sign_mode` is omitted):
194
+ 1. `plugin_wallet` (priority: 30) - if token configured
195
+ 2. `quick_wallet` (priority: 20) - if MCP endpoint configured
196
+ 3. `local_private_key` (priority: 10) - if private keys configured
197
+
198
+ The server automatically selects the highest-priority ready mode.
199
+
200
+ ### Network Support
201
+
202
+ - **EVM Networks**: Ethereum, Base, Polygon, Arbitrum One, GateChain, GateLayer
203
+ - **Solana Networks**: Solana Mainnet, Solana Devnet
24
204
 
25
205
  ## Quick Start
26
206
 
27
- ### Cursor / Claude Desktop with local private key
207
+ ### 1. Local Private Key Mode (EVM + Solana)
208
+
209
+ This is the simplest setup for local signing with your own private keys:
210
+
211
+ ```json
212
+ {
213
+ "mcpServers": {
214
+ "gatepay-mcp": {
215
+ "command": "npx",
216
+ "args": ["-y", "gatepay-local-mcp"],
217
+ "env": {
218
+ "EVM_PRIVATE_KEY": "your-evm-private-key-hex-with-or-without-0x-prefix",
219
+ "SVM_PRIVATE_KEY": "your-solana-private-key-base58-optional"
220
+ }
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ - Set `EVM_PRIVATE_KEY` for EVM network payments (Ethereum, Base, Polygon, etc.)
227
+ - Set `SVM_PRIVATE_KEY` for Solana network payments (optional)
228
+ - Put this into your MCP config such as `~/.cursor/mcp.json`, then restart or reload MCP
229
+
230
+ ### 2. Quick Wallet Mode (Custodial)
231
+
232
+ Remote wallet signing with device-flow OAuth (Google or Gate account):
233
+
234
+ ```json
235
+ {
236
+ "mcpServers": {
237
+ "gatepay-mcp": {
238
+ "command": "npx",
239
+ "args": ["-y", "gatepay-local-mcp"],
240
+ "env": {
241
+ "QUICK_WALLET_MCP_URL": "https://walletmcp.gate.com/mcp",
242
+ "QUICK_WALLET_API_KEY": "your-api-key-optional"
243
+ }
244
+ }
245
+ }
246
+ }
247
+ ```
248
+
249
+ - First payment will trigger device-flow login (opens browser)
250
+ - Token is persisted at `~/.gate-pay/auth.json`
251
+ - Use `x402_quick_wallet_auth` tool to pre-authorize
28
252
 
29
- This is the simplest setup if you want local signing:
253
+ ### 3. Plugin Wallet Mode (Browser Extension)
254
+
255
+ Sign with browser extension wallet (e.g., Gate Wallet):
30
256
 
31
257
  ```json
32
258
  {
@@ -35,31 +261,44 @@ This is the simplest setup if you want local signing:
35
261
  "command": "npx",
36
262
  "args": ["-y", "gatepay-local-mcp"],
37
263
  "env": {
38
- "EVM_PRIVATE_KEY": "your-evm-private-key-hex-with-or-without-0x-prefix"
264
+ "PLUGIN_WALLET_TOKEN": "your-plugin-wallet-mcp-token"
39
265
  }
40
266
  }
41
267
  }
42
268
  }
43
269
  ```
44
270
 
45
- Put this into your MCP config such as `~/.cursor/mcp.json`, then restart the client or reload MCP.
271
+ - Get the token from your browser extension wallet
272
+ - Requires the wallet extension to be installed and running
273
+ - User confirms transactions in the browser extension
46
274
 
47
- ### Cursor / Claude Desktop with quick wallet
275
+ ### 4. Gate Pay Centralized Payment (Browser OAuth)
48
276
 
49
- If you prefer remote wallet signing, you can omit `EVM_PRIVATE_KEY` and let the tool use `quick_wallet`. Note that you need to obtain API credentials from the wallet service provider.
277
+ Use this when merchants expect Gate Pay centralized settlement instead of user-owned signatures.
50
278
 
51
279
  ```json
52
280
  {
53
281
  "mcpServers": {
54
282
  "gatepay-mcp": {
55
283
  "command": "npx",
56
- "args": ["-y", "gatepay-local-mcp"]
284
+ "args": ["-y", "gatepay-local-mcp"],
285
+ "env": {
286
+ "GATE_PAY_OAUTH_CLIENT_ID": "your-gate-pay-client-id",
287
+ "GATE_PAY_OAUTH_CLIENT_SECRET": "your-gate-pay-client-secret",
288
+ "GATE_PAY_OAUTH_BACKEND_ORIGIN": "https://www.gate.com/apiw/v2/mcp/oauth",
289
+ "GATE_PAY_ACCOUNT_AUTHORIZE_ORIGIN": "https://gate.com",
290
+ "GATE_PAY_OAUTH_CALLBACK_PORT": "18473",
291
+ "GATE_PAY_CENTRALIZED_PAYMENT_URL": "https://api.gateio.ws/api/v4/pay/ai/order/pay",
292
+ "GATE_PAY_CLIENT_ID": "your-gate-pay-client-id"
293
+ }
57
294
  }
58
295
  }
59
296
  }
60
297
  ```
61
298
 
62
- When `quick_wallet` has no saved token, the server can start a device-flow login and persist the token at `~/.gate-pay/auth.json`.
299
+ - Run `x402_gate_pay_auth` once per token lifecycle; it opens the Gate consent page and exchanges the code automatically.
300
+ - Use `x402_submit_payment` with `sign_mode: "centralized_payment"` after you create a `PAYMENT-SIGNATURE`, or
301
+ - Call `x402_centralized_payment` directly with the Base64 `PAYMENT-REQUIRED` header when you prefer a single-step helper.
63
302
 
64
303
  ### Cursor / Claude Desktop with plugin wallet
65
304
 
@@ -90,15 +329,34 @@ Before using plugin wallet mode:
90
329
 
91
330
  The server loads `.env` from the repository or package root at startup.
92
331
 
93
- ### Runtime variables
94
-
95
- | Variable | Required | Default | Description |
96
- | --------------------------- | -------- | ------- | --------------------------------------------------------------------------- |
97
- | `EVM_PRIVATE_KEY` | No | | Local EVM private key used by `local_private_key`; hex with or without `0x` |
98
- | `PLUGIN_WALLET_SERVER_URL` | No | | Base URL for the plugin wallet MCP server (required for `plugin_wallet`) |
99
- | `PLUGIN_WALLET_TOKEN` | No | — | Authentication token for plugin wallet (required for `plugin_wallet`) |
100
-
101
- ### Test and script variables
332
+ ### Signing Mode Configuration
333
+
334
+ | Variable | Mode | Description |
335
+ | ------------------------- | ------------------- | --------------------------------------------------------------------------- |
336
+ | `EVM_PRIVATE_KEY` | `local_private_key` | Local EVM private key; hex with or without `0x` prefix |
337
+ | `SVM_PRIVATE_KEY` | `local_private_key` | Local Solana private key; base58 encoded (optional) |
338
+ | `QUICK_WALLET_MCP_URL` | `quick_wallet` | MCP wallet endpoint URL (default: `https://walletmcp.gate.com/mcp`) |
339
+ | `QUICK_WALLET_API_KEY` | `quick_wallet` | API key for MCP wallet service (optional) |
340
+ | `PLUGIN_WALLET_TOKEN` | `plugin_wallet` | MCP token from browser extension wallet |
341
+
342
+ ### Gate Pay Centralized Payment
343
+
344
+ | Variable | Description |
345
+ | --------------------------------- | --------------------------------------------------------------------------------------------- |
346
+ | `GATE_PAY_OAUTH_CLIENT_ID` | Gate Pay OAuth client id used for device authorization and token exchange |
347
+ | `GATE_PAY_OAUTH_CLIENT_SECRET` | Client secret required when exchanging the authorization code for an access token |
348
+ | `GATE_PAY_OAUTH_BACKEND_ORIGIN` | Base URL for the OAuth backend that hosts the token/refresh endpoints |
349
+ | `GATE_PAY_ACCOUNT_AUTHORIZE_ORIGIN` | Domain that serves the Gate Pay authorization page (opens in the browser) |
350
+ | `GATE_PAY_OAUTH_CALLBACK_PORT` | Local port used to receive the OAuth redirect (set to `0` for a random port if needed) |
351
+ | `GATE_PAY_OAUTH_SCOPE` | OAuth scope requested during device/login flow |
352
+ | `GATE_PAY_OAUTH_AUTHORIZE_USER_AGENT` | Custom User-Agent for the authorization preflight (defaults to `gateio/web`) |
353
+ | `GATE_PAY_CENTRALIZED_PAYMENT_URL`| HTTPS endpoint for submitting centralized payments via Gate Pay |
354
+ | `GATE_PAY_CLIENT_ID` | Merchant client id embedded in centralized payment payloads |
355
+ | `GATE_PAY_OAUTH_TOKEN_BASE_URL` | Optional: origin used to derive default token and refresh endpoints |
356
+ | `GATE_PAY_OAUTH_TOKEN_URL` | Optional: explicit token endpoint path override |
357
+ | `GATE_PAY_OAUTH_REFRESH_URL` | Optional: explicit refresh endpoint path override |
358
+
359
+ ### Test and Script Variables
102
360
 
103
361
  | Variable | Used By | Default | Description |
104
362
  | ----------------------------- | ------------------------------- | ----------------------- | ----------------------------------------------- |
@@ -106,55 +364,101 @@ The server loads `.env` from the repository or package root at startup.
106
364
  | `ENDPOINT_PATH` | `test/privateKey.ts` | `/flight/order` | Endpoint path appended to `RESOURCE_SERVER_URL` |
107
365
  | `GATEPAY_MCP_TEST_TIMEOUT_MS` | `test/mcp-x402-request-tool.ts` | `180000` | Timeout for the MCP tool integration test |
108
366
 
109
- ## Available Tool
367
+ ## Usage Examples
110
368
 
111
- ### `x402_request`
369
+ ### Example 1: Single-Step Payment (Recommended)
112
370
 
113
- Executes a single HTTP request to an x402-protected endpoint. If the response is `402 Payment Required`, the server completes the payment flow and retries automatically.
114
-
115
- Use this tool only for endpoints that are expected to require x402 payment.
116
-
117
- | Argument | Type | Required | Description |
118
- | ----------------------- | ------ | -------- | ------------------------------------------------------------------------------- |
119
- | `url` | string | Yes | Full `http` or `https` URL |
120
- | `method` | string | No | `GET`, `POST`, `PUT`, or `PATCH`; default is `POST` |
121
- | `body` | string | No | JSON string request body; omit for `GET` |
122
- | `sign_mode` | string | No | Preferred signing mode: `local_private_key`, `quick_wallet`, or `plugin_wallet` |
123
- | `wallet_login_provider` | string | No | Login provider for `quick_wallet`: `google` or `gate`; default is `gate` |
371
+ ```json
372
+ // Step 1: Place order to get payment requirements
373
+ {
374
+ "tool": "x402_place_order",
375
+ "arguments": {
376
+ "url": "https://api.example.com/order",
377
+ "method": "POST",
378
+ "body": "{\"flightId\":\"FL001\",\"uid\":\"100\"}"
379
+ }
380
+ }
124
381
 
125
- ### Tool examples
382
+ // Step 2: If 402 response, sign and submit payment
383
+ {
384
+ "tool": "x402_sign_payment",
385
+ "arguments": {
386
+ "url": "https://api.example.com/order",
387
+ "method": "POST",
388
+ "body": "{\"flightId\":\"FL001\",\"uid\":\"100\"}",
389
+ "payment_required_header": "<base64-from-place_order>",
390
+ "sign_mode": "quick_wallet"
391
+ }
392
+ }
393
+ ```
126
394
 
127
- GET request with automatic mode selection:
395
+ ### Example 2: Two-Step Payment (Advanced)
128
396
 
129
397
  ```json
398
+ // Create signature first
130
399
  {
131
- "url": "https://api.example.com/resource"
400
+ "tool": "x402_create_signature",
401
+ "arguments": {
402
+ "payment_required_header": "<base64>",
403
+ "sign_mode": "local_private_key"
404
+ }
405
+ }
406
+
407
+ // Then submit separately
408
+ {
409
+ "tool": "x402_submit_payment",
410
+ "arguments": {
411
+ "url": "https://api.example.com/order",
412
+ "payment_signature": "<base64-from-create_signature>"
413
+ }
132
414
  }
133
415
  ```
134
416
 
135
- POST request with explicit local signing:
417
+ ### Example 3: Quick Wallet with Pre-Auth
136
418
 
137
419
  ```json
420
+ // Pre-authorize (opens browser for OAuth)
138
421
  {
139
- "url": "https://api.example.com/order",
140
- "method": "POST",
141
- "body": "{\"flightId\":\"FL001\",\"uid\":\"100\"}",
142
- "sign_mode": "local_private_key"
422
+ "tool": "x402_quick_wallet_auth",
423
+ "arguments": {
424
+ "wallet_login_provider": "gate"
425
+ }
143
426
  }
144
427
  ```
145
428
 
146
- POST request with quick wallet login through Gate:
429
+ ### Example 4: Gate Pay Centralized Payment
147
430
 
148
431
  ```json
432
+ // Step 1: Run OAuth (opens Gate authorize page)
433
+ { "tool": "x402_gate_pay_auth", "arguments": {} }
434
+
435
+ // Step 2a: Use centralized helper
436
+ {
437
+ "tool": "x402_centralized_payment",
438
+ "arguments": {
439
+ "payment_required_header": "<base64-from-place_order>"
440
+ }
441
+ }
442
+
443
+ // Step 2b: Or submit with sign_mode: centralized_payment
149
444
  {
150
- "url": "https://api.example.com/order",
151
- "method": "POST",
152
- "body": "{\"flightId\":\"FL001\",\"uid\":\"100\"}",
153
- "sign_mode": "quick_wallet",
154
- "wallet_login_provider": "gate"
445
+ "tool": "x402_submit_payment",
446
+ "arguments": {
447
+ "url": "https://api.example.com/order",
448
+ "method": "POST",
449
+ "payment_signature": "<base64-from-create_signature>",
450
+ "sign_mode": "centralized_payment"
451
+ }
155
452
  }
156
453
  ```
157
454
 
455
+ ## Agent Skill
456
+
457
+ - `skills/SKILL.md` contains the `gatepay-x402` skill manifest and prompts so MCP-aware IDEs (Cursor, Claude Desktop, Codex CLI, etc.) know how to call every tool exposed by this server.
458
+ - `skills/gatepay-x402.md` (mirrored at `docs/gatepay-x402.md`) is a natural-language installation guide. Share that link with your AI host for a “one-click” experience: the host can follow the steps to download `gatepay-local-mcp`, register it in `mcpServers`, and copy the `gatepay-x402` skill into its skills directory automatically.
459
+
460
+ Tool names and arguments always match each tool’s MCP `inputSchema` on the server you connect to; check your client’s tool list if you ship a trimmed build.
461
+
158
462
  ## Development
159
463
 
160
464
  ```bash
@@ -191,15 +495,6 @@ npm run test:mcp-tool
191
495
 
192
496
  If you already logged in before, the saved token in `~/.gate-pay/auth.json` will be reused. Otherwise the quick wallet flow may require interactive device login. You can increase the timeout with `GATEPAY_MCP_TEST_TIMEOUT_MS`.
193
497
 
194
- ## How It Works
195
-
196
- 1. The MCP client calls `x402_request`.
197
- 2. The server normalizes the input and selects a ready `sign_mode`.
198
- 3. The first request is sent to the target URL.
199
- 4. If the upstream returns `402 Payment Required`, the server parses the payment requirements.
200
- 5. The selected signer signs the payment payload.
201
- 6. The server retries the request with the payment header and returns the final response.
202
-
203
498
  ## License
204
499
 
205
500
  MIT
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 环境配置管理模块
3
+ * 支持通过 GATE_PAY_ENV 环境变量在 test 和 prd 环境间切换
4
+ */
5
+ export type Environment = "test" | "prd";
6
+ /**
7
+ * 环境配置接口
8
+ */
9
+ export interface EnvironmentConfig {
10
+ oauthClientId: string;
11
+ oauthClientSecret: string;
12
+ oauthBackendOrigin: string;
13
+ accountAuthorizeOrigin: string;
14
+ oauthCallbackPort: number;
15
+ centralizedPaymentUrl: string;
16
+ paymentClientId: string;
17
+ quickWalletServerUrl: string;
18
+ pluginWalletServerUrl: string;
19
+ oauthScope: string;
20
+ oauthAuthorizeUserAgent: string;
21
+ }
22
+ /**
23
+ * 获取当前环境(test 或 prd)
24
+ * 默认为 prd
25
+ */
26
+ export declare function getEnvironment(): Environment;
27
+ /**
28
+ * 获取最终环境配置
29
+ * 优先级:直接设置的环境变量 > GATE_PAY_ENV 预设配置 > 默认值
30
+ */
31
+ export declare function getEnvConfig(): EnvironmentConfig;
32
+ //# sourceMappingURL=env-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config.d.ts","sourceRoot":"","sources":["../../../src/config/env-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAEhC,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAG1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IAGxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAG9B,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAkDD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAG5C;AAUD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,iBAAiB,CAoChD"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * 环境配置管理模块
3
+ * 支持通过 GATE_PAY_ENV 环境变量在 test 和 prd 环境间切换
4
+ */
5
+ /**
6
+ * 测试环境配置
7
+ */
8
+ const TEST_CONFIG = {
9
+ // OAuth 配置
10
+ oauthClientId: "mZ96D37oKk-HrWJc",
11
+ oauthClientSecret: "QcICEvHYl4zlqd27AD8Grw1s78ni989RK1t3igeRdN0=",
12
+ oauthBackendOrigin: "http://dev.halftrust.xyz/oauth2",
13
+ accountAuthorizeOrigin: "https://14099.gateio.tech",
14
+ oauthCallbackPort: 18473,
15
+ // 中心化支付
16
+ centralizedPaymentUrl: "http://dev.halftrust.xyz/payment-service/payment/gatepay/v2/pay/ai/order/pay",
17
+ paymentClientId: "mZ96D37oKk-HrWJc",
18
+ // 钱包服务
19
+ quickWalletServerUrl: "https://wallet-service-mcp-test.gateweb3.cc/mcp",
20
+ pluginWalletServerUrl: "https://walletmcp-test.gateweb3.cc/mcp",
21
+ // 其他配置
22
+ oauthScope: "read_profile",
23
+ oauthAuthorizeUserAgent: "gateio/web",
24
+ };
25
+ /**
26
+ * 生产环境配置
27
+ */
28
+ const PRD_CONFIG = {
29
+ // OAuth 配置
30
+ oauthClientId: "kIWkpCQBJUPWNuDo",
31
+ oauthClientSecret: "u4tyiLBhryczzT_5XcmHLVYQkWYhCIbPH1ejtXqiuLs=",
32
+ oauthBackendOrigin: "https://www.gate.com/apiw/v2/mcp/oauth",
33
+ accountAuthorizeOrigin: "https://gate.com",
34
+ oauthCallbackPort: 18473,
35
+ // 中心化支付
36
+ centralizedPaymentUrl: "https://api.gateio.ws/api/v4/pay/ai/order/pay",
37
+ paymentClientId: "kIWkpCQBJUPWNuDo",
38
+ // 钱包服务
39
+ quickWalletServerUrl: "https://api.gatemcp.ai/mcp/dex",
40
+ pluginWalletServerUrl: "https://walletmcp.gate.com/mcp",
41
+ // 其他配置
42
+ oauthScope: "read_profile",
43
+ oauthAuthorizeUserAgent: "gateio/web",
44
+ };
45
+ /**
46
+ * 获取当前环境(test 或 prd)
47
+ * 默认为 prd
48
+ */
49
+ export function getEnvironment() {
50
+ const env = process.env.GATE_PAY_ENV?.toLowerCase().trim();
51
+ return env === "test" ? "test" : "prd";
52
+ }
53
+ /**
54
+ * 获取基础环境配置(根据 GATE_PAY_ENV)
55
+ */
56
+ function getBaseConfig() {
57
+ const env = getEnvironment();
58
+ return env === "test" ? TEST_CONFIG : PRD_CONFIG;
59
+ }
60
+ /**
61
+ * 获取最终环境配置
62
+ * 优先级:直接设置的环境变量 > GATE_PAY_ENV 预设配置 > 默认值
63
+ */
64
+ export function getEnvConfig() {
65
+ const baseConfig = getBaseConfig();
66
+ return {
67
+ // OAuth 配置
68
+ oauthClientId: process.env.GATE_PAY_OAUTH_CLIENT_ID?.trim() || baseConfig.oauthClientId,
69
+ oauthClientSecret: process.env.GATE_PAY_OAUTH_CLIENT_SECRET?.trim() || baseConfig.oauthClientSecret,
70
+ oauthBackendOrigin: process.env.GATE_PAY_OAUTH_BACKEND_ORIGIN?.trim()?.replace(/\/$/, "") ||
71
+ baseConfig.oauthBackendOrigin,
72
+ accountAuthorizeOrigin: process.env.GATE_PAY_ACCOUNT_AUTHORIZE_ORIGIN?.trim()?.replace(/\/$/, "") ||
73
+ baseConfig.accountAuthorizeOrigin,
74
+ oauthCallbackPort: parseCallbackPort() ?? baseConfig.oauthCallbackPort,
75
+ // 中心化支付
76
+ centralizedPaymentUrl: process.env.GATE_PAY_CENTRALIZED_PAYMENT_URL?.trim() ||
77
+ baseConfig.centralizedPaymentUrl,
78
+ paymentClientId: process.env.GATE_PAY_CLIENT_ID?.trim() || baseConfig.paymentClientId,
79
+ // 钱包服务
80
+ quickWalletServerUrl: process.env.QUICK_WALLET_SERVER_URL?.trim() || baseConfig.quickWalletServerUrl,
81
+ pluginWalletServerUrl: process.env.PLUGIN_WALLET_SERVER_URL?.trim() || baseConfig.pluginWalletServerUrl,
82
+ // 其他配置
83
+ oauthScope: process.env.GATE_PAY_OAUTH_SCOPE?.trim() || baseConfig.oauthScope,
84
+ oauthAuthorizeUserAgent: process.env.GATE_PAY_OAUTH_AUTHORIZE_USER_AGENT?.trim() ||
85
+ baseConfig.oauthAuthorizeUserAgent,
86
+ };
87
+ }
88
+ /**
89
+ * 解析回调端口
90
+ */
91
+ function parseCallbackPort() {
92
+ const portStr = process.env.GATE_PAY_OAUTH_CALLBACK_PORT?.trim();
93
+ if (!portStr)
94
+ return undefined;
95
+ const n = parseInt(portStr, 10);
96
+ return Number.isNaN(n) ? undefined : n;
97
+ }
98
+ //# sourceMappingURL=env-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-config.js","sourceRoot":"","sources":["../../../src/config/env-config.ts"],"names":[],"mappings":"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"}