feat(x402): route payments through mcp.openmm.io proxy via split execution#31
Merged
feat(x402): route payments through mcp.openmm.io proxy via split execution#31
Conversation
…ution - Replace withX402 + withAutoPayment interceptor with wrapWithSplitPayment from @qbtlabs/x402/split — payment verification and settlement now route through https://mcp.openmm.io by default instead of x402.org/facilitator - payment.ts: rewrite as applyPaymentGate(server) — no configure/setToolPrices, just wrapWithSplitPayment with privateKey, workerUrl, testnet, freeTools - server.ts: replace manual server.tool interceptor with applyPaymentGate(server) called before registerTools; must be called before tool registration - Delete payment-client.ts — split gate handles signing + retry internally - .env.example: replace X402_EVM_ADDRESS with X402_PRIVATE_KEY; PAYMENT_SERVER now defaults to https://mcp.openmm.io - README: update x402 section to document split flow, new env vars, and correct MCP client config examples Split execution flow (mirrors openmm-mcp architecture): 1. Tool called — no payment header required from caller 2. Gate POSTs to workerUrl/verify-payment 3. Worker returns 402 with EIP-3009 requirements 4. Gate signs locally with X402_PRIVATE_KEY (key never leaves process) 5. Gate retries with X-PAYMENT header → worker issues JWT 6. Gate verifies JWT locally, executes handler, injects tx hash in response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
withX402+withAutoPaymentwithwrapWithSplitPaymentfrom@qbtlabs/x402/splitPAYMENT_SERVERnow defaults tohttps://mcp.openmm.ioinstead of going directly tox402.org/facilitatorsrc/payment-client.ts— split gate handles signing, retry, and JWT verification internallysrc/payment.tsrewritten asapplyPaymentGate(server)— one call beforeregisterTools, no per-tool wrappers.env.exampleand README updated:X402_EVM_ADDRESS→X402_PRIVATE_KEY, proxy URL documentedSplit execution flow
Process isolation: indigo-mcp never holds the recipient wallet — only the payer key. Verification and settlement are handled by the openmm.io proxy.
Dependencies
Stacks on top of #30 (
feat/3rd-400-x402-integration). Merge #30 first, then this.