@oobe-protocol-labs/sap-mcp-server 0.3.0 → 0.7.1

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 (154) hide show
  1. package/.env.example +3 -0
  2. package/CHANGELOG.md +222 -2
  3. package/README.md +63 -0
  4. package/USER_DOCS/00_START_HERE.md +23 -1
  5. package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +4 -1
  6. package/USER_DOCS/03_PAYMENTS_X402_PAYSH.md +63 -7
  7. package/USER_DOCS/04_CLIENT_CONFIGS.md +134 -6
  8. package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +262 -0
  9. package/dist/adapters/mcp/sdk-compat.d.ts.map +1 -1
  10. package/dist/adapters/mcp/sdk-compat.js +32 -18
  11. package/dist/adapters/mcp/sdk-compat.js.map +1 -1
  12. package/dist/config/mcp-client-injection.d.ts +64 -2
  13. package/dist/config/mcp-client-injection.d.ts.map +1 -1
  14. package/dist/config/mcp-client-injection.js +668 -11
  15. package/dist/config/mcp-client-injection.js.map +1 -1
  16. package/dist/config/wizard.d.ts.map +1 -1
  17. package/dist/config/wizard.js +89 -5
  18. package/dist/config/wizard.js.map +1 -1
  19. package/dist/core/constants.d.ts +1 -1
  20. package/dist/core/constants.js +1 -1
  21. package/dist/payments/facilitator-rpc-fallback.d.ts +43 -0
  22. package/dist/payments/facilitator-rpc-fallback.d.ts.map +1 -0
  23. package/dist/payments/facilitator-rpc-fallback.js +228 -0
  24. package/dist/payments/facilitator-rpc-fallback.js.map +1 -0
  25. package/dist/payments/json-rpc.d.ts.map +1 -1
  26. package/dist/payments/json-rpc.js +2 -1
  27. package/dist/payments/json-rpc.js.map +1 -1
  28. package/dist/payments/monetization-gate.d.ts +43 -2
  29. package/dist/payments/monetization-gate.d.ts.map +1 -1
  30. package/dist/payments/monetization-gate.js +618 -9
  31. package/dist/payments/monetization-gate.js.map +1 -1
  32. package/dist/payments/oobe-facilitator-server.d.ts +6 -0
  33. package/dist/payments/oobe-facilitator-server.d.ts.map +1 -1
  34. package/dist/payments/oobe-facilitator-server.js +79 -4
  35. package/dist/payments/oobe-facilitator-server.js.map +1 -1
  36. package/dist/payments/pricing.d.ts.map +1 -1
  37. package/dist/payments/pricing.js +1 -0
  38. package/dist/payments/pricing.js.map +1 -1
  39. package/dist/payments/usage-ledger.d.ts +10 -0
  40. package/dist/payments/usage-ledger.d.ts.map +1 -1
  41. package/dist/payments/usage-ledger.js +51 -0
  42. package/dist/payments/usage-ledger.js.map +1 -1
  43. package/dist/payments/x402-paid-call.d.ts +53 -0
  44. package/dist/payments/x402-paid-call.d.ts.map +1 -0
  45. package/dist/payments/x402-paid-call.js +370 -0
  46. package/dist/payments/x402-paid-call.js.map +1 -0
  47. package/dist/prompts/context/sap-agent-context.prompt.js +9 -3
  48. package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
  49. package/dist/prompts/developer/debug-sap-error.prompt.js +1 -1
  50. package/dist/prompts/developer/debug-sap-error.prompt.js.map +1 -1
  51. package/dist/prompts/developer/generate-sap-integration.prompt.js +6 -2
  52. package/dist/prompts/developer/generate-sap-integration.prompt.js.map +1 -1
  53. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js +1 -1
  54. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js.map +1 -1
  55. package/dist/prompts/execution-proof/verify-execution-proof.prompt.js +1 -1
  56. package/dist/prompts/execution-proof/verify-execution-proof.prompt.js.map +1 -1
  57. package/dist/prompts/payments/create-paid-api.prompt.js +1 -1
  58. package/dist/prompts/payments/create-paid-api.prompt.js.map +1 -1
  59. package/dist/prompts/payments/explain-x402-settlement.prompt.js +1 -1
  60. package/dist/prompts/payments/explain-x402-settlement.prompt.js.map +1 -1
  61. package/dist/prompts/register-prompts.js +2 -2
  62. package/dist/prompts/register-prompts.js.map +1 -1
  63. package/dist/prompts/registry/analyze-sap-agent.prompt.js +1 -1
  64. package/dist/prompts/registry/analyze-sap-agent.prompt.js.map +1 -1
  65. package/dist/prompts/registry/register-sap-agent.prompt.js +2 -2
  66. package/dist/prompts/registry/register-sap-agent.prompt.js.map +1 -1
  67. package/dist/remote/server.d.ts +132 -1
  68. package/dist/remote/server.d.ts.map +1 -1
  69. package/dist/remote/server.js +930 -49
  70. package/dist/remote/server.js.map +1 -1
  71. package/dist/resources/current/sap-current-config.resource.d.ts.map +1 -1
  72. package/dist/resources/current/sap-current-config.resource.js +11 -1
  73. package/dist/resources/current/sap-current-config.resource.js.map +1 -1
  74. package/dist/resources/execution-proof/sap-execution-record.resource.js +1 -1
  75. package/dist/resources/execution-proof/sap-execution-record.resource.js.map +1 -1
  76. package/dist/resources/memory/sap-memory.resource.js +1 -1
  77. package/dist/resources/memory/sap-memory.resource.js.map +1 -1
  78. package/dist/resources/profile/sap-active-profile.resource.js +1 -1
  79. package/dist/resources/profile/sap-active-profile.resource.js.map +1 -1
  80. package/dist/resources/register-resources.js +2 -2
  81. package/dist/resources/register-resources.js.map +1 -1
  82. package/dist/resources/registry/sap-agent.resource.js +1 -1
  83. package/dist/resources/registry/sap-agent.resource.js.map +1 -1
  84. package/dist/resources/registry/sap-global-registry.resource.js +1 -1
  85. package/dist/resources/registry/sap-global-registry.resource.js.map +1 -1
  86. package/dist/resources/reputation/sap-reputation.resource.js +1 -1
  87. package/dist/resources/reputation/sap-reputation.resource.js.map +1 -1
  88. package/dist/resources/stats/sap-network-stats.resource.js +1 -1
  89. package/dist/resources/stats/sap-network-stats.resource.js.map +1 -1
  90. package/dist/resources/tool-schema/sap-tool-schema.resource.js +1 -1
  91. package/dist/resources/tool-schema/sap-tool-schema.resource.js.map +1 -1
  92. package/dist/sap/sap-client-manager.js +5 -5
  93. package/dist/sap/sap-client-manager.js.map +1 -1
  94. package/dist/security/tool-permissions.d.ts.map +1 -1
  95. package/dist/security/tool-permissions.js +1 -0
  96. package/dist/security/tool-permissions.js.map +1 -1
  97. package/dist/server/create-server.js +5 -5
  98. package/dist/server/create-server.js.map +1 -1
  99. package/dist/server/register-capabilities.js +4 -4
  100. package/dist/server/register-capabilities.js.map +1 -1
  101. package/dist/signer/signer-resolver.js +1 -1
  102. package/dist/signer/signer-resolver.js.map +1 -1
  103. package/dist/tools/client-sdk-tools.js +7 -7
  104. package/dist/tools/client-sdk-tools.js.map +1 -1
  105. package/dist/tools/index.d.ts +2 -0
  106. package/dist/tools/index.d.ts.map +1 -1
  107. package/dist/tools/index.js +4 -0
  108. package/dist/tools/index.js.map +1 -1
  109. package/dist/tools/magicblock-tools.d.ts +28 -0
  110. package/dist/tools/magicblock-tools.d.ts.map +1 -0
  111. package/dist/tools/magicblock-tools.js +578 -0
  112. package/dist/tools/magicblock-tools.js.map +1 -0
  113. package/dist/tools/profile-tools.d.ts.map +1 -1
  114. package/dist/tools/profile-tools.js +20 -0
  115. package/dist/tools/profile-tools.js.map +1 -1
  116. package/dist/tools/register-tools.d.ts.map +1 -1
  117. package/dist/tools/register-tools.js +11 -2
  118. package/dist/tools/register-tools.js.map +1 -1
  119. package/dist/tools/sap-sdk-tools.js +2 -2
  120. package/dist/tools/sap-sdk-tools.js.map +1 -1
  121. package/dist/tools/sap-sns-tools.js +2 -2
  122. package/dist/tools/sap-sns-tools.js.map +1 -1
  123. package/dist/tools/skills-tools.d.ts +1 -1
  124. package/dist/tools/skills-tools.d.ts.map +1 -1
  125. package/dist/tools/skills-tools.js +10 -1
  126. package/dist/tools/skills-tools.js.map +1 -1
  127. package/dist/tools/tool-aliases.d.ts +10 -0
  128. package/dist/tools/tool-aliases.d.ts.map +1 -0
  129. package/dist/tools/tool-aliases.js +23 -0
  130. package/dist/tools/tool-aliases.js.map +1 -0
  131. package/dist/tools/x402-paid-call-tool.d.ts +12 -0
  132. package/dist/tools/x402-paid-call-tool.d.ts.map +1 -0
  133. package/dist/tools/x402-paid-call-tool.js +118 -0
  134. package/dist/tools/x402-paid-call-tool.js.map +1 -0
  135. package/dist/wizard-core/desktop-flow.d.ts +82 -0
  136. package/dist/wizard-core/desktop-flow.d.ts.map +1 -0
  137. package/dist/wizard-core/desktop-flow.js +181 -0
  138. package/dist/wizard-core/desktop-flow.js.map +1 -0
  139. package/docs/00_README.md +3 -0
  140. package/docs/03_CONFIGURATION_AND_WIZARD.md +31 -5
  141. package/docs/06_PAYMENTS_X402_AND_PAYSH.md +70 -7
  142. package/docs/07_ENDPOINTS_AND_CLIENTS.md +28 -1
  143. package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +7 -6
  144. package/docs/13_BOUNTY_PROGRAM_PROPOSAL.md +469 -0
  145. package/docs/14_DESKTOP_WIZARD_RELEASE.md +264 -0
  146. package/docs/README.md +104 -0
  147. package/docs/_sidebar.md +31 -0
  148. package/docs/magicblock-tools.md +166 -0
  149. package/docs/x402-protocol-spec.md +984 -0
  150. package/package.json +23 -2
  151. package/server.json +71 -0
  152. package/skills/sap-defi/SKILL.md +8 -0
  153. package/skills/sap-mcp/SKILL.md +30 -0
  154. package/skills/sap-payments-x402/SKILL.md +36 -4
package/.env.example CHANGED
@@ -144,6 +144,9 @@ SAP_MCP_FACILITATOR_PATH_PREFIX=/facilitator
144
144
  SAP_MCP_FACILITATOR_NETWORKS=devnet
145
145
  # SAP_MCP_FACILITATOR_SIGNER_PATH=~/.config/mcp-sap/keypairs/oobe-x402-facilitator-keypair.json
146
146
  # SAP_MCP_FACILITATOR_RPC_URL=https://api.devnet.solana.com
147
+ # Optional comma-separated RPC fallbacks. Keep API keys private and server-side.
148
+ # The facilitator also appends the public Solana RPC for each configured network.
149
+ # SAP_MCP_FACILITATOR_RPC_FALLBACK_URLS=https://api.devnet.solana.com
147
150
  # SAP_MCP_FACILITATOR_AUTH_TOKEN=
148
151
 
149
152
  # Initial pricing:
package/CHANGELOG.md CHANGED
@@ -2,6 +2,217 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ## 0.7.1 - 2026-07-13
8
+
9
+ ### Highlights
10
+
11
+ Publishes SAP MCP as a registry-ready MCP server with official metadata for
12
+ the Model Context Protocol Registry, while shipping the MagicBlock tool suite
13
+ that was previously staged under `Unreleased`.
14
+
15
+ ### Added — MCP Registry
16
+
17
+ - Added `mcpName: ai.oobeprotocol.sap.mcp/sap-mcp` to package metadata so
18
+ the npm package can be verified by the MCP Registry through OOBE Protocol's
19
+ domain ownership.
20
+ - Added root `server.json` using the official MCP Registry server schema,
21
+ with hosted `streamable-http` remote metadata for
22
+ `https://mcp.sap.oobeprotocol.ai/mcp` and local npm stdio package metadata.
23
+ - Added `GET /.well-known/mcp-registry-auth` support for MCP Registry
24
+ HTTP domain authentication via `SAP_MCP_REGISTRY_AUTH_RECORD` or
25
+ `SAP_MCP_REGISTRY_AUTH_FILE`.
26
+ - Added repository, homepage, bugs, and packaged `server.json` metadata to
27
+ the npm package for registry and client discovery.
28
+
29
+ ### Added — MagicBlock Tools (20 tools, 3 protocols)
30
+
31
+ New `magicblock-tools.ts` module registering 20 MagicBlock tools with the
32
+ MCP server, covering ER Router (JSON-RPC), Private Payment API (REST),
33
+ and Solana VRF (on-chain via @solana/web3.js).
34
+
35
+ **Tools added:**
36
+
37
+ - `src/tools/magicblock-tools.ts` — 20 tools with JSON Schema input
38
+ definitions, stateless HTTP client (global `fetch`, zero external deps),
39
+ error handling with structured responses, and per-tool pricing metadata.
40
+ - `src/tools/__tests__/magicblock-tools.test.ts` — 10 smoke tests
41
+ verifying tool registration, schema shapes, pricing, and handler
42
+ presence.
43
+
44
+ **Files modified:**
45
+
46
+ - `src/tools/index.ts` — export `registerMagicBlockTools`
47
+ - `src/tools/register-tools.ts` — call `registerMagicBlockTools` during
48
+ server initialization
49
+
50
+ **Pricing:**
51
+
52
+ | Tier | Price | Tools |
53
+ |------|-------|-------|
54
+ | READ | $0.01 | `getRoutes`, `getIdentity`, `getDelegationStatus`, `getAccountInfo`, `getBlockhashForAccounts`, `getSignatureStatuses`, `health`, `challenge`, `login`, `balance`, `privateBalance`, `swapQuote`, `isMintInitialized`, `getRandomnessResult` (14) |
55
+ | WRITE | $0.05 | `deposit`, `transfer`, `withdraw`, `swap`, `initializeMint`, `requestRandomness` (6) |
56
+
57
+ Every tool description includes its price ($0.01 or $0.05). Every
58
+ successful response includes `priceUsd` and `priceBaseUnits` fields for
59
+ SAP escrow settlement.
60
+
61
+ **Validation:**
62
+
63
+ - `tsc --noEmit` passed (0 errors).
64
+ - `eslint` passed.
65
+ - `vitest` 10/10 passed.
66
+
67
+ ## 0.6.0 - 2026-07-04
68
+
69
+ ### Highlights
70
+
71
+ Introduces the SAP MCP Desktop Wizard: a guided GUI/TUI-style installer for non-technical users who need hosted SAP MCP, a local signer profile, and the x402 paid-call bridge configured without editing TOML or JSON by hand.
72
+
73
+ ### Added
74
+
75
+ - Added a desktop Electron wizard under `apps/desktop` with an accessible aqua-themed setup flow for profile naming, wallet boundary, policy limits, runtime detection, and final review.
76
+ - Added shared desktop setup core in `src/wizard-core/desktop-flow.ts` so the GUI persists the same production profile format as the CLI/TUI wizard instead of maintaining a separate installer path.
77
+ - Added automatic Codex hosted MCP + local `sap_payments` bridge configuration from the desktop flow.
78
+ - Added x402 paid-call addon installation from the desktop flow, writing runtime snippets under `~/.config/mcp-sap/addons/x402-paid-call`.
79
+ - Added Electron Builder packaging config for macOS DMG/ZIP, Windows NSIS, and Linux tar.gz release artifacts.
80
+ - Added macOS signing entitlements, notarization hook, and CI preflight for tagged release builds.
81
+ - Added desktop wizard documentation in `apps/desktop/README.md`.
82
+ - Added GitHub Actions desktop release workflow for native macOS, Windows, and Linux wizard artifacts on tagged releases or manual dispatch.
83
+
84
+ ### Changed
85
+
86
+ - Bumped package metadata to `0.6.0`.
87
+ - Added `react-dom`, Electron, Electron Builder, and Vite React tooling for the desktop installer surface.
88
+ - Ignored generated desktop renderer and installer artifacts so release outputs are built intentionally and never committed as source.
89
+ - Tagged macOS release jobs now report whether they are building signed/notarized or unsigned macOS artifacts.
90
+ - Added a first-screen setup mode selector for full SAP MCP setup vs x402 payment-client-only repair, so users who already have `~/.config/mcp-sap` can install only the local payment bridge.
91
+ - Expanded runtime-native config injection for Codex, Claude Desktop, Hermes global/profile configs, and OpenClaw instead of relying on one generic MCP JSON shape.
92
+ - Added platform-aware Claude config paths for macOS, Windows, and Linux.
93
+ - Improved Step 1 desktop wizard layout with a clearer hosted MCP/local trust-boundary explanation.
94
+ - Added guarded desktop startup diagnostics so Windows users no longer get an infinite loading screen when preload/runtime detection fails; the wizard now times out with actionable fallback instructions and writes a desktop log.
95
+ - Corrected OpenClaw hosted MCP and payment-bridge injection to use the documented `mcp.servers` configuration shape instead of a generic root `mcpServers` map.
96
+ - Added hosted native wizard download metadata at `/wizard/downloads.json` and direct Windows, macOS, and Linux download cards on the public dashboard.
97
+ - Published x402scan-compatible discovery metadata through `/.well-known/x402` and aligned the OpenAPI payment metadata with x402 resource discovery expectations.
98
+ - Fixed the shared public server version constant so `/server.json`, `/openapi.json`, and release download links report `0.6.0` instead of stale metadata.
99
+ - Hardened desktop release CI so Windows, macOS, and Linux jobs fail correctly when verification fails.
100
+ - Added packaged `app.asar` verification to prevent blank renderer builds, absolute `/assets` paths, and missing Electron entrypoints from shipping.
101
+
102
+ ### Security
103
+
104
+ - The desktop renderer never receives keypair bytes.
105
+ - Hosted MCP config generated by the desktop flow contains only public remote endpoint metadata; local signing remains under `~/.config/mcp-sap` or an external signer.
106
+ - The desktop flow rejects ambiguous `default` profile creation and requires named SAP MCP profiles.
107
+ - Ad-hoc signed macOS artifacts are supported with explicit Gatekeeper/quarantine instructions; zero-warning macOS installers still require Developer ID signing and notarization.
108
+ - Windows facilitator file-mode checks now skip POSIX-only chmod assertions while keeping Unix keypair mode enforcement intact.
109
+ - Remote docs path resolution now uses POSIX URL normalization so Windows release runners do not produce platform-specific route mismatches.
110
+
111
+ ### Verification
112
+
113
+ - `CI=true pnpm run typecheck`
114
+ - `CI=true pnpm run test:run`
115
+ - `CI=true pnpm run build`
116
+ - `CI=true pnpm run desktop:renderer:build`
117
+ - `CI=true pnpm run desktop:build`
118
+ - `CI=true pnpm run desktop:verify-artifact`
119
+ - `npm pack --dry-run --cache ./.npm-cache`
120
+ - `pnpm audit --audit-level moderate`
121
+
122
+ ## 0.5.0 - 2026-07-03
123
+
124
+ ### Highlights
125
+
126
+ First production-grade x402 monetized MCP server on Solana. This release delivers the full
127
+ non-custodial payment flow — hosted server, client-side signing, facilitator verify+settle —
128
+ with real MCP session management and a standalone client addon for AI agents.
129
+
130
+ **Verified on-chain**: 5 successful USDC settlements on mainnet from wallet
131
+ `28VEsvJpLodUaUReU6t2NFD2uWnqydi2vx2AMfa1HCQP` during testing.
132
+
133
+ ### Added
134
+
135
+ - **x402 Payment-Signature fast path** (`src/payments/monetization-gate.ts`):
136
+ - Server parses `Payment-Signature` header (base64 JSON with `x402Version`, `accepted`,
137
+ `payload`, and `resource`), validates requirements against the original decision, and
138
+ calls facilitator `/verify` → execute tool → `/settle` in a single pass.
139
+ - 402 responses are returned as HTTP 200 JSON-RPC errors (`-32001 payment_required`) for
140
+ MCP SDK `streamable_http_client` compatibility (the SDK hangs for 55s on raw HTTP 402).
141
+ - `PAYMENT-REQUIRED` response header forwarded so client-side plugins can extract the
142
+ full x402 challenge including `accepts[]` with `extra.feePayer`.
143
+
144
+ - **x402 V1/V2 compatibility** (`patchV1Compatibility()`):
145
+ - V2 `buildPaymentRequirements()` emits `amount` but no `maxAmountRequired`; V1 verifier
146
+ checks `maxAmountRequired`. The gate patches every 402/response body to add the alias,
147
+ so both V1 and V2 clients work without modification.
148
+
149
+ - **Standalone x402 client addon** (`src/payments/x402-paid-call.ts`):
150
+ - New npm binary `sap-mcp-x402-paid-call` — initializes a real MCP session, receives the
151
+ x402 challenge, signs locally with the user's SAP profile keypair, and retries with
152
+ `Payment-Signature`.
153
+ - Local MCP tool `sap_x402_paid_call` (`src/tools/x402-paid-call-tool.ts`) — available
154
+ only when the process has a local wallet profile; not advertised by the non-custodial
155
+ hosted server.
156
+
157
+ - **MCP session registry** (`src/remote/server.ts`):
158
+ - Replaced the global singleton `StreamableHTTPServerTransport` with a per-session
159
+ `Map<sessionId, transport>` architecture. Each client `initialize` creates a real
160
+ session; paid calls without a valid session are rejected before facilitator contact.
161
+ - Eliminates "Server already initialized" and "Session not found" errors that made the
162
+ hosted server unusable for multiple concurrent clients.
163
+
164
+ - **Receipt binding to method + params** (`src/payments/usage-ledger.ts`):
165
+ - Payment receipts are now bound to the canonical MCP method-and-params hash, not the
166
+ raw JSON-RPC body including `id`. This lets agents retry with a different `id` without
167
+ invalidating the payment proof.
168
+
169
+ - **Wizard addon flow** (`src/config/wizard.ts`, `src/config/mcp-client-injection.ts`):
170
+ - After client config, the wizard proposes optional installation of the `x402-paid-call`
171
+ addon into `~/.config/mcp-sap/addons/x402-paid-call`.
172
+ - Emits config snippets for Hermes, Claude Code, Codex, OpenClaw, and custom runtimes.
173
+
174
+ - **Log rotation** (`scripts/setup-logrotate.sh`):
175
+ - PM2 logrotate config: 50MB max, 7 retained, compressed, daily rotation.
176
+
177
+ - **x402 protocol spec** (`docs/x402-protocol-spec.md`):
178
+ - 984-line reference document covering V1/V2 schemas, header encoding, amount conversion,
179
+ facilitator endpoints, and Solana transaction structure.
180
+
181
+ ### Changed
182
+
183
+ - Updated skills (`skills/sap-payments-x402/SKILL.md`, `skills/sap-mcp/SKILL.md`) to
184
+ document the `initialize → tools/call unpaid → tools/call paid retry` flow and the
185
+ non-custodial signing boundary.
186
+ - Updated user docs (`USER_DOCS/03_PAYMENTS_X402_PAYSH.md`, `USER_DOCS/04_CLIENT_CONFIGS.md`)
187
+ to clarify that retries must preserve `mcp-session-id`, bind to `method + params`, and
188
+ must not fall back to free local stdio to bypass x402.
189
+ - Updated landing page and wizard descriptor to surface `npx sap-mcp-x402-paid-call`.
190
+ - Added explicit `/favicon.ico` compatibility metadata and route coverage for API-root browser previews.
191
+ - Added crawler-safe `HEAD /favicon.ico` support and consolidated public logo handling for
192
+ `/favicon.ico`, `/favicon.png`, `/apple-touch-icon.png`, and `/og.png`.
193
+
194
+ ### Security
195
+
196
+ - Keypair bytes are never printed, logged, or written to config files.
197
+ - The non-custodial hosted server does not advertise `sap_x402_paid_call` when no wallet
198
+ is present — the tool only exists when a local signer is configured.
199
+ - Paid calls with client-generated (fake) `mcp-session-id` values are rejected before
200
+ facilitator verification, preventing wasted on-chain settlements for doomed sessions.
201
+
202
+ ### Verification
203
+
204
+ ```
205
+ CI=true pnpm run typecheck
206
+ CI=true pnpm run lint
207
+ CI=true pnpm run test:run # 74 tests passed, 17 passed (suites)
208
+ CI=true pnpm run build
209
+ CI=true pnpm run verify:release
210
+ node dist/payments/x402-paid-call.js --help
211
+ npm pack --dry-run # includes new binary
212
+ ```
213
+
214
+ On-chain verification: 5/5 USDC settlements confirmed on Solana mainnet.
215
+
5
216
  ## 0.3.0 - 2026-07-02
6
217
 
7
218
  ### Fixed
@@ -14,12 +225,21 @@ All notable changes to this project are documented in this file.
14
225
  - Updated SAP MCP skills, prompts, and user docs to consistently reference the canonical hosted endpoint, public metadata routes, x402 fast path, and user-controlled signing boundary.
15
226
  - Clarified hosted non-custodial signing context so agents treat `signerConfigured: false` on the remote server as expected and do not silently fall back to local stdio to bypass x402.
16
227
  - Clarified CLI and TUI wizard mode selection so `hosted-api` is visibly the OOBE SAP MCP Server at `https://mcp.sap.oobeprotocol.ai/mcp`, not a prompt to run a local HTTP server.
228
+ - Added explicit hosted-agent guidance to `sap_profile_current` and `sap://config/current` so clients do not summarize non-custodial hosted mode as "signer not configured", "read-only only", or "writes unavailable".
229
+ - Fixed x402 signed retry handling by verifying the client-supplied `Payment-Signature.accepted` requirements instead of rebuilding requirements with a fresh facilitator fee payer.
230
+ - Forwarded the `PAYMENT-REQUIRED` header on JSON-RPC `payment_required` responses so MCP clients can keep HTTP 200 compatibility while local payment plugins still receive the complete x402 challenge.
231
+ - Bound x402 hosted receipts to the canonical MCP method-and-params hash instead of raw JSON-RPC bytes, preventing valid paid retries from failing when an agent changes only the JSON-RPC `id`.
232
+ - Reworked hosted stateful MCP routing to create one official Streamable HTTP transport per initialized session instead of sharing a single global transport, and reject paid calls with missing or client-generated `mcp-session-id` before facilitator verification.
233
+ - Added the local `sap-mcp-x402-paid-call` helper plus optional wizard-installed `x402_paid_call` addon snippets for Hermes, Claude, Codex, OpenClaw, and custom runtimes.
234
+ - Added the local MCP helper tool `sap_x402_paid_call` for signed hosted x402 retries when a user-controlled SAP MCP wallet profile is present, while keeping the non-custodial hosted server from advertising it without a wallet.
235
+ - Updated payment docs and skills so agents retry hosted paid calls with the same MCP method and params, preserve `mcp-session-id`, and do not fall back to free local stdio just because the hosted server has no signer.
236
+ - Added `x402_paid_call` agent plugin install guidance and the `npx sap-mcp-x402-paid-call` command to the public hosted landing page and wizard descriptor.
17
237
 
18
238
  ### Verification
19
239
 
20
240
  - `pnpm run typecheck`
21
241
  - `pnpm run lint`
22
- - `pnpm run test:run -- src/config/mcp-client-injection.test.ts src/config/setup.test.ts src/payments/oobe-facilitator-server.test.ts src/payments/pricing.test.ts`
242
+ - `pnpm test -- --run`
23
243
  - `pnpm run build`
24
244
  - `npm pack --dry-run --cache ./.npm-cache`
25
245
 
@@ -111,4 +331,4 @@ All notable changes to this project are documented in this file.
111
331
  - MCP client injection no longer pins wallet paths or RPC overrides by default.
112
332
  - Private key and transaction policy guards run before MCP tool execution/signing paths.
113
333
  - Payment audit logs store request hashes and settlement metadata, not keypair bytes, raw arguments, or x402 payment signatures.
114
- - Paid x402 virtual resource paths are bound to the SHA-256 hash of the exact JSON-RPC request body.
334
+ - Paid x402 virtual resource paths are bound to the SHA-256 hash of canonical MCP method and params, so JSON-RPC `id` changes do not invalidate a valid paid retry.
package/README.md CHANGED
@@ -100,6 +100,44 @@ For local agents, let SAP MCP follow the active profile manager instead of hard-
100
100
  }
101
101
  ```
102
102
 
103
+ Codex uses TOML rather than the JSON `mcpServers` shape. For hosted remote MCP, add this to `~/.codex/config.toml` and restart Codex:
104
+
105
+ ```toml
106
+ [mcp_servers.sap]
107
+ url = "https://mcp.sap.oobeprotocol.ai/mcp"
108
+ ```
109
+
110
+ For paid/write hosted tools, add the local non-custodial payment bridge as well:
111
+
112
+ ```toml
113
+ [mcp_servers.sap_payments]
114
+ command = "npx"
115
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server", "sap-mcp-server"]
116
+ enabled_tools = ["sap_x402_paid_call", "sap_profile_current", "sap_x402_estimate_cost"]
117
+ tool_timeout_sec = 300
118
+
119
+ [mcp_servers.sap_payments.env]
120
+ SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE = "false"
121
+ SAP_ALLOWED_TOOLS = "sap_x402_paid_call,sap_profile_current,sap_x402_estimate_cost"
122
+ SAP_LOG_LEVEL = "info"
123
+ ```
124
+
125
+ On Windows, use `command = "npx.cmd"`. The wizard can write this automatically.
126
+
127
+ Codex supports Streamable HTTP MCP servers with URL-based entries in `config.toml`. Use local stdio through `npx` only when you specifically want Codex to launch the local SAP MCP process:
128
+
129
+ ```toml
130
+ [mcp_servers.sap]
131
+ command = "npx"
132
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server", "sap-mcp-server"]
133
+
134
+ [mcp_servers.sap.env]
135
+ SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE = "false"
136
+ SAP_LOG_LEVEL = "info"
137
+ ```
138
+
139
+ On Windows, use `command = "npx.cmd"`.
140
+
103
141
  See [04. Local Stdio Usage](docs/04_LOCAL_STDIO_USAGE.md).
104
142
 
105
143
  ## 5. Remote Server
@@ -116,9 +154,14 @@ Remote endpoints:
116
154
 
117
155
  ```text
118
156
  GET /
157
+ GET /docs
119
158
  GET /server.json
120
159
  GET /favicon.png
160
+ GET /favicon.ico
121
161
  GET /health
162
+ GET /openapi.json
163
+ GET /.well-known/x402
164
+ GET /pay/provider.yml
122
165
  GET /.well-known/agent-card.json
123
166
  GET /.well-known/sap-mcp-wizard.json
124
167
  GET /wizard/install.sh
@@ -129,6 +172,8 @@ DELETE /mcp
129
172
 
130
173
  `GET /` is a public, share-safe landing page with Open Graph/Twitter metadata. It exposes only public server information; keypair bytes, private wallet paths, RPC query secrets, and VPS-local paths must never appear there.
131
174
 
175
+ `GET /docs` serves the public documentation site for install, start, configuration, hosted remote MCP, x402/pay.sh payments, and MCP client setup.
176
+
132
177
  See [05. Remote VPS Deployment](docs/05_REMOTE_VPS_DEPLOYMENT.md) and [07. Endpoints And Clients](docs/07_ENDPOINTS_AND_CLIENTS.md).
133
178
 
134
179
  ## 6. Monetization
@@ -162,6 +207,9 @@ npx sap-mcp-facilitator start
162
207
 
163
208
  Generate a pay.sh provider YAML:
164
209
 
210
+ The hosted public catalog is available at `https://mcp.sap.oobeprotocol.ai/pay/provider.yml`.
211
+ It is secret-free and intended for pay.sh catalog/proxy discovery.
212
+
165
213
  ```bash
166
214
  npx sap-mcp-pay-sh-spec \
167
215
  --out sap-mcp-pay-sh.yml \
@@ -172,6 +220,20 @@ npx sap-mcp-pay-sh-spec \
172
220
 
173
221
  See [06. Payments, x402, And pay.sh](docs/06_PAYMENTS_X402_AND_PAYSH.md).
174
222
 
223
+ For local agent runtimes that cannot replay x402 challenges natively, install
224
+ the wizard's `x402_paid_call` addon or call the helper directly:
225
+
226
+ ```bash
227
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-x402-paid-call \
228
+ --tool sap_list_all_agents \
229
+ --arguments '{"limit":5}' \
230
+ --max-usd 0.02 \
231
+ --confirm
232
+ ```
233
+
234
+ The helper signs payment payloads with the user's local SAP MCP profile and
235
+ never sends keypair bytes to the hosted server.
236
+
175
237
  ## 7. Commands
176
238
 
177
239
  ```bash
@@ -193,6 +255,7 @@ Installed binaries:
193
255
  | `sap-signing-proxy` | Local signing proxy |
194
256
  | `sap-mcp-facilitator` | Self-hosted x402 SVM facilitator |
195
257
  | `sap-mcp-pay-sh-spec` | pay.sh provider YAML generator |
258
+ | `sap-mcp-x402-paid-call` | Local x402 payment helper for hosted paid MCP tools |
196
259
 
197
260
  ## 8. Documentation
198
261
 
@@ -21,6 +21,14 @@ Run the wizard:
21
21
  npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
22
22
  ```
23
23
 
24
+ For non-technical users, download the Desktop GUI Wizard from GitHub releases:
25
+
26
+ ```txt
27
+ https://github.com/OOBE-PROTOCOL/sap-mcp/releases
28
+ ```
29
+
30
+ The Desktop GUI Wizard creates the same profile and signer setup as the CLI wizard, then can configure hosted MCP plus the local x402 payment bridge for supported agent runtimes.
31
+
24
32
  Show the active profile:
25
33
 
26
34
  ```bash
@@ -33,6 +41,12 @@ Hosted MCP URL:
33
41
  https://mcp.sap.oobeprotocol.ai/mcp
34
42
  ```
35
43
 
44
+ Hosted documentation:
45
+
46
+ ```txt
47
+ https://mcp.sap.oobeprotocol.ai/docs
48
+ ```
49
+
36
50
  Wizard descriptor:
37
51
 
38
52
  ```txt
@@ -82,7 +96,14 @@ Minimal hosted MCP client concept:
82
96
  }
83
97
  ```
84
98
 
85
- If a client does not support remote Streamable HTTP MCP yet, use local stdio mode and let the local server connect to the same SAP/Solana stack.
99
+ Codex users should not paste that JSON into `~/.codex/config.toml`. Use TOML:
100
+
101
+ ```toml
102
+ [mcp_servers.sap]
103
+ url = "https://mcp.sap.oobeprotocol.ai/mcp"
104
+ ```
105
+
106
+ Codex supports Streamable HTTP MCP servers with URL-based TOML entries. Use local stdio mode only when you want Codex to launch the SAP MCP process locally.
86
107
 
87
108
  ## 5. Safety Rules For Agents
88
109
 
@@ -128,3 +149,4 @@ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config au
128
149
  | `03_PAYMENTS_X402_PAYSH.md` | x402, pay.sh pay-per-use, and pay.sh subscriptions |
129
150
  | `04_CLIENT_CONFIGS.md` | Claude, Hermes, Codex, OpenClaw config examples |
130
151
  | `05_SKILLS_AND_TOOLS.md` | Skills, tool selection, and security behavior |
152
+ | `06_DESKTOP_GUI_WIZARD.md` | Desktop GUI wizard install, hosted setup, x402 client addon, and runtime behavior |
@@ -44,7 +44,8 @@ Public `server.json` shape:
44
44
  "agentCard": "https://mcp.sap.oobeprotocol.ai/.well-known/agent-card.json",
45
45
  "wizardDescriptor": "https://mcp.sap.oobeprotocol.ai/.well-known/sap-mcp-wizard.json",
46
46
  "wizardInstallScript": "https://mcp.sap.oobeprotocol.ai/wizard/install.sh",
47
- "favicon": "https://mcp.sap.oobeprotocol.ai/favicon.png"
47
+ "favicon": "https://mcp.sap.oobeprotocol.ai/favicon.png",
48
+ "faviconIco": "https://mcp.sap.oobeprotocol.ai/favicon.ico"
48
49
  },
49
50
  "capabilities": {
50
51
  "tools": true,
@@ -88,6 +89,8 @@ Read-only discovery can connect directly to the hosted MCP URL. Any agent that n
88
89
 
89
90
  If `sap_profile_current` reports `runtime.signerConfigured: false` on the hosted server, read it as a non-custodial guarantee: OOBE is not holding the user's wallet. It is not a reason to switch to local stdio automatically. Paid hosted tools should complete the x402/pay.sh payment flow from the user's local SAP profile or external signer. Use local stdio only when the user explicitly chooses local execution or the client cannot support remote Streamable HTTP/x402.
90
91
 
92
+ Agent-facing summary should say: "Hosted SAP MCP is connected. OOBE is non-custodial; user signatures come from the local SAP profile or external signer." Avoid "signer not configured", "read-only only", or "writes unavailable" unless a specific tool call returns that exact error.
93
+
91
94
  ## 3. Install And Configure
92
95
 
93
96
  ```bash
@@ -42,7 +42,7 @@ Without payment, a paid tool returns:
42
42
  HTTP/1.1 402 Payment Required
43
43
  ```
44
44
 
45
- The response contains payment instructions and the caller replays the same request with the payment header.
45
+ The response contains payment instructions and the caller retries the same MCP method and params with the payment header. Agents must keep the initialized MCP session headers across both the unpaid challenge and the paid retry.
46
46
 
47
47
  Hosted SAP MCP accepts payment proof headers used by the x402/payment flow and exposes settlement headers back to the caller:
48
48
 
@@ -52,12 +52,66 @@ Hosted SAP MCP accepts payment proof headers used by the x402/payment flow and e
52
52
  | Server challenge | `PAYMENT-REQUIRED` |
53
53
  | Server receipt | `PAYMENT-RESPONSE` or `X-PAYMENT-RESPONSE` |
54
54
 
55
- The payment receipt should be treated as part of the tool output provenance. For paid hosted tools, agents should bind the receipt to the request hash, tool name, and returned result.
55
+ The payment receipt should be treated as part of the tool output provenance. For paid hosted tools, agents should bind the receipt to the canonical request hash, tool name, method params, and returned result. The canonical hash ignores JSON-RPC `id`, so normal agent retries do not invalidate the receipt.
56
56
 
57
- ## 3. pay.sh Pay-Per-Use
57
+ ## 3. Local x402 Paid-Call Addon
58
+
59
+ Most agent runtimes can connect to hosted SAP MCP directly, but not every runtime can automatically sign an x402 challenge and replay the paid MCP request. SAP MCP ships a local helper for that gap:
60
+
61
+ ```bash
62
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-x402-paid-call \
63
+ --tool sap_list_all_agents \
64
+ --arguments '{"limit":5}' \
65
+ --max-usd 0.02 \
66
+ --max-attempts 5 \
67
+ --confirm
68
+ ```
69
+
70
+ The helper:
71
+
72
+ 1. loads the user's active SAP MCP profile from `~/.config/mcp-sap`;
73
+ 2. initializes a real MCP session against `https://mcp.sap.oobeprotocol.ai/mcp`;
74
+ 3. receives the x402 challenge for the requested hosted tool;
75
+ 4. signs the payment payload locally with the user's SAP MCP profile wallet;
76
+ 5. retries the same MCP method and params with `PAYMENT-SIGNATURE`;
77
+ 6. returns the hosted MCP response plus the settlement receipt.
78
+
79
+ Install or print addon snippets from the wizard:
80
+
81
+ ```bash
82
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
83
+ ```
84
+
85
+ The wizard writes the addon bundle under:
86
+
87
+ ```txt
88
+ ~/.config/mcp-sap/addons/x402-paid-call
89
+ ```
90
+
91
+ Local stdio SAP MCP also exposes `sap_x402_paid_call` when the current process has a user-controlled wallet profile. The OOBE hosted server does not advertise this helper in non-custodial mode because payment signing must happen on the user's machine, not on `mcp.sap.oobeprotocol.ai`.
92
+
93
+ Security boundaries:
94
+
95
+ - keypair bytes stay local and are never included in MCP client config;
96
+ - every paid call requires `--max-usd` / `maxPriceUsd`;
97
+ - every paid call requires `--confirm` / `confirm: true`;
98
+ - transient settlement failures such as `BlockhashNotFound`,
99
+ `transaction_simulation_failed`, `node is behind`, or `fetch failed` should
100
+ be retried with a fresh challenge using `--max-attempts 5`;
101
+ - encrypted wallet and external signer bridges are not faked; unsupported signing modes fail closed.
102
+
103
+ ## 4. pay.sh Pay-Per-Use
58
104
 
59
105
  pay.sh pay-per-use uses a provider YAML with `metering:` on paid endpoints. The pay.sh docs describe this as stablecoin-gated HTTP where the first request receives a `402`, the client signs proof locally, and the gateway settles before forwarding upstream.
60
106
 
107
+ The hosted SAP MCP deployment publishes the public pay.sh catalog here:
108
+
109
+ ```text
110
+ https://mcp.sap.oobeprotocol.ai/pay/provider.yml
111
+ ```
112
+
113
+ That hosted YAML is safe to share. It contains the provider name, proxy routing target, network, revenue recipient, and metered `/mcp` endpoint, but not RPC API keys, signer paths, facilitator auth tokens, or wallet bytes.
114
+
61
115
  References:
62
116
 
63
117
  - https://pay.sh/docs/building-with-pay/getting-started
@@ -74,6 +128,8 @@ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-pay-sh-sp
74
128
  --recipient <OOBE_REVENUE_WALLET>
75
129
  ```
76
130
 
131
+ Only publish YAML generated this way if it does not include private `--rpc-url` or `--signer-path` values.
132
+
77
133
  Example metered block:
78
134
 
79
135
  ```yaml
@@ -112,7 +168,7 @@ operator:
112
168
  recipient: '<OOBE_REVENUE_WALLET>'
113
169
  ```
114
170
 
115
- ## 4. pay.sh Subscriptions
171
+ ## 5. pay.sh Subscriptions
116
172
 
117
173
  pay.sh subscriptions use `subscription:` instead of `metering:`. A subscription gates an endpoint behind recurring flat-fee access for a fixed period. According to pay.sh docs, `metering:` and `subscription:` are mutually exclusive on the same endpoint, so use separate endpoints or separate provider specs when offering both.
118
174
 
@@ -184,7 +240,7 @@ pay subscriptions list --network mainnet
184
240
  pay subscriptions list --json
185
241
  ```
186
242
 
187
- ## 5. Recommended OOBE Product Split
243
+ ## 6. Recommended OOBE Product Split
188
244
 
189
245
  | Product | Payment Model |
190
246
  | --- | --- |
@@ -194,7 +250,7 @@ pay subscriptions list --json
194
250
  | Pro remote access | pay.sh subscription endpoint |
195
251
  | Enterprise/custom routing | Dedicated subscription endpoint or private contract |
196
252
 
197
- ## 6. Official pay.sh References Used
253
+ ## 7. Official pay.sh References Used
198
254
 
199
255
  - Getting started: https://pay.sh/docs/building-with-pay/getting-started
200
256
  - Pricing: https://pay.sh/docs/building-with-pay/pricing
@@ -203,7 +259,7 @@ pay subscriptions list --json
203
259
  - Subscriptions YAML specification: https://pay.sh/docs/building-with-pay/subscriptions/yaml-specification
204
260
  - Subscription examples: https://pay.sh/docs/building-with-pay/subscriptions/examples
205
261
 
206
- ## 7. Security Requirements
262
+ ## 8. Security Requirements
207
263
 
208
264
  - Never put RPC API keys in public YAML.
209
265
  - Never put private keypair paths in public docs.