@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
@@ -0,0 +1,264 @@
1
+ # 14. Desktop Wizard Release
2
+
3
+ ## 14.1 Purpose
4
+
5
+ The Desktop Wizard packages SAP MCP onboarding as a GUI/TUI-style installer for users who should not need to hand-edit agent runtime config.
6
+
7
+ It is a wrapper around the same production setup modules used by:
8
+
9
+ ```bash
10
+ sap-mcp-config wizard
11
+ ```
12
+
13
+ The desktop app must not maintain a second config format, wallet model, signer model, or x402 flow.
14
+
15
+ ## 14.2 Source Layout
16
+
17
+ | Path | Purpose |
18
+ | --- | --- |
19
+ | `src/wizard-core/desktop-flow.ts` | Shared desktop setup core: defaults, validation, runtime detection, save orchestration. |
20
+ | `apps/desktop/main.mjs` | Electron main process and IPC boundary. |
21
+ | `apps/desktop/preload.cjs` | Safe renderer bridge. |
22
+ | `apps/desktop/src/main.tsx` | React wizard UI. |
23
+ | `apps/desktop/src/styles.css` | Accessible aqua-themed desktop styling. |
24
+ | `apps/desktop/electron-builder.cjs` | DMG/ZIP, NSIS EXE, and Linux tar.gz packaging config. |
25
+ | `apps/desktop/build/icon.png` | 1024x1024 installer icon derived from the public SAP MCP logo. |
26
+
27
+ ## 14.3 Trust Boundary
28
+
29
+ The renderer receives profile metadata and user-entered form values only.
30
+
31
+ It must never receive:
32
+
33
+ 1. keypair bytes;
34
+ 2. private signer payloads;
35
+ 3. facilitator secrets;
36
+ 4. RPC API keys;
37
+ 5. hosted deployment env values;
38
+ 6. payment recipient private material.
39
+
40
+ Profile creation and runtime config writes happen through the main-process IPC handler, which calls shared setup modules.
41
+
42
+ ## 14.4 Runtime Integrations
43
+
44
+ The desktop wizard supports two setup modes:
45
+
46
+ | Mode | Behavior |
47
+ | --- | --- |
48
+ | Full SAP MCP setup | Creates or updates the local SAP MCP profile, wallet boundary, policy limits, hosted MCP runtime entries, and x402 bridge. |
49
+ | x402 payment client only | Skips profile/wallet writes and only installs or repairs hosted MCP plus local `sap_payments` runtime entries. |
50
+
51
+ The x402-only mode is for users who already ran a wizard, can see hosted SAP MCP tools, but cannot execute paid/write calls because their runtime does not yet attach payment proofs.
52
+
53
+ ### 14.4.1 Codex
54
+
55
+ Codex uses native Streamable HTTP MCP support for hosted SAP MCP and a local command-backed bridge for payment replay:
56
+
57
+ 1. hosted remote MCP entry:
58
+
59
+ ```toml
60
+ [mcp_servers.sap]
61
+ url = "https://mcp.sap.oobeprotocol.ai/mcp"
62
+ ```
63
+
64
+ 2. local payment bridge entry:
65
+
66
+ ```toml
67
+ [mcp_servers.sap_payments]
68
+ command = "npx"
69
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server", "sap-mcp-server"]
70
+ enabled_tools = ["sap_x402_paid_call", "sap_profile_current", "sap_x402_estimate_cost"]
71
+ tool_timeout_sec = 300
72
+ ```
73
+
74
+ On Windows, use `npx.cmd`.
75
+
76
+ ### 14.4.2 Claude Desktop
77
+
78
+ Claude Desktop receives a root `mcpServers` JSON config. The hosted server uses Claude's HTTP MCP shape:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "sap": {
84
+ "type": "http",
85
+ "url": "https://mcp.sap.oobeprotocol.ai/mcp"
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ The desktop wizard writes platform-native Claude paths:
92
+
93
+ | OS | Path |
94
+ | --- | --- |
95
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
96
+ | Windows | `%USERPROFILE%\AppData\Roaming\Claude\claude_desktop_config.json` |
97
+ | Linux | `~/.config/Claude/claude_desktop_config.json` |
98
+
99
+ ### 14.4.3 Hermes
100
+
101
+ Hermes global `mcp.json` receives flat server entries:
102
+
103
+ ```json
104
+ {
105
+ "sap": {
106
+ "url": "https://mcp.sap.oobeprotocol.ai/mcp",
107
+ "transport": "streamable-http"
108
+ }
109
+ }
110
+ ```
111
+
112
+ Hermes profile YAML receives entries under top-level `mcp_servers`.
113
+
114
+ ### 14.4.4 OpenClaw
115
+
116
+ OpenClaw receives root `mcpServers` JSON when `~/.openclaw/mcp.json` is selected or created. Existing YAML config receives top-level `mcp_servers` entries.
117
+
118
+ ### 14.4.5 Payment Bridge Invariant
119
+
120
+ Every supported runtime may also receive a local `sap_payments` server with only these enabled tools:
121
+
122
+ ```txt
123
+ sap_x402_paid_call
124
+ sap_profile_current
125
+ sap_x402_estimate_cost
126
+ ```
127
+
128
+ The hosted `sap` entry must not include wallet paths, RPC API-key overrides, profile names, keypair bytes, or private signer data.
129
+
130
+ ## 14.5 Build Commands
131
+
132
+ Renderer only:
133
+
134
+ ```bash
135
+ pnpm run desktop:renderer:build
136
+ ```
137
+
138
+ Full local desktop build:
139
+
140
+ ```bash
141
+ pnpm run desktop:build
142
+ ```
143
+
144
+ The full command runs:
145
+
146
+ 1. TypeScript build for server/core/TUI.
147
+ 2. Vite renderer build.
148
+ 3. Electron Builder packaging with `--publish never`.
149
+
150
+ Artifacts are written to:
151
+
152
+ ```txt
153
+ release/desktop
154
+ ```
155
+
156
+ Generated renderer and release files are ignored by git.
157
+
158
+ ## 14.6 GitHub Release Workflow
159
+
160
+ Native multi-OS artifacts are built by:
161
+
162
+ ```txt
163
+ .github/workflows/desktop-release.yml
164
+ ```
165
+
166
+ Triggers:
167
+
168
+ 1. manual `workflow_dispatch`;
169
+ 2. tag push such as `0.6.0`.
170
+
171
+ Artifact matrix:
172
+
173
+ | Runner | Artifact |
174
+ | --- | --- |
175
+ | `macos-15` | `.dmg`, `.zip` |
176
+ | `windows-2025` | NSIS `.exe` |
177
+ | `ubuntu-24.04` | `.tar.gz` |
178
+
179
+ Tagged runs attach artifacts to a draft GitHub release.
180
+
181
+ ## 14.7 Signing Requirements
182
+
183
+ Local unsigned builds are acceptable when the release notes clearly mark the macOS artifact as unsigned and provide the quarantine removal command.
184
+
185
+ Public release requirements:
186
+
187
+ 1. macOS Developer ID Application certificate;
188
+ 2. macOS notarization credentials;
189
+ 3. Windows code signing certificate for SmartScreen reputation;
190
+ 4. checksum publication in GitHub release notes;
191
+ 5. changelog section for the exact released version.
192
+
193
+ Do not publish unsigned binaries as final user-facing installers without an explicit warning.
194
+
195
+ For signed tagged GitHub release builds, the macOS job uses these secrets when they are configured:
196
+
197
+ | Secret | Purpose |
198
+ | --- | --- |
199
+ | `MACOS_CSC_LINK` or `CSC_LINK` | Base64-encoded `.p12` Developer ID Application certificate, or a secure URL supported by Electron Builder. |
200
+ | `MACOS_CSC_KEY_PASSWORD` or `CSC_KEY_PASSWORD` | Password for the certificate bundle. |
201
+ | `APPLE_ID` | Apple Developer account email used for notarization. |
202
+ | `APPLE_APP_SPECIFIC_PASSWORD` | App-specific password for notarization. |
203
+ | `APPLE_TEAM_ID` | Apple Developer Team ID. |
204
+
205
+ The Electron Builder macOS config uses:
206
+
207
+ 1. hardened runtime;
208
+ 2. explicit Electron entitlements;
209
+ 3. `afterSign` notarization through `apps/desktop/notarize.cjs`;
210
+ 4. ad-hoc signing mode when `CSC_LINK` is not present;
211
+ 5. signed/notarized mode when Apple Developer ID secrets are present.
212
+
213
+ If macOS shows this message:
214
+
215
+ ```txt
216
+ "SAP MCP Wizard" is damaged and cannot be opened.
217
+ ```
218
+
219
+ the downloaded app was blocked by Gatekeeper because it was not signed and notarized for public distribution, or because the browser applied a quarantine attribute to an unsigned build.
220
+
221
+ Temporary local-only workaround for a trusted internal build:
222
+
223
+ ```bash
224
+ xattr -dr com.apple.quarantine "/Applications/SAP MCP Wizard.app"
225
+ ```
226
+
227
+ or, before dragging from the mounted image:
228
+
229
+ ```bash
230
+ xattr -dr com.apple.quarantine "/Volumes/SAP MCP Wizard/SAP MCP Wizard.app"
231
+ ```
232
+
233
+ Unsigned/ad-hoc macOS release note text:
234
+
235
+ ```txt
236
+ macOS note: this build is ad-hoc signed but not Apple-notarized. After copying the app to /Applications, run:
237
+ xattr -dr com.apple.quarantine "/Applications/SAP MCP Wizard.app"
238
+ ```
239
+
240
+ A zero-warning public macOS release still requires Apple Developer ID signing and notarization.
241
+
242
+ ## 14.8 Verification Gates
243
+
244
+ Before publishing:
245
+
246
+ ```bash
247
+ pnpm install --frozen-lockfile
248
+ pnpm run typecheck
249
+ pnpm run lint
250
+ pnpm run test:run
251
+ pnpm audit --audit-level moderate
252
+ pnpm run build
253
+ pnpm run desktop:build
254
+ npm pack --dry-run --cache ./.npm-cache
255
+ ```
256
+
257
+ The current local macOS arm64 build produces:
258
+
259
+ ```txt
260
+ SAP-MCP-Wizard-0.6.0-arm64.dmg
261
+ SAP-MCP-Wizard-0.6.0-arm64.zip
262
+ ```
263
+
264
+ Windows EXE and Linux artifacts are produced by the GitHub Actions matrix.
package/docs/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # SAP MCP Documentation
2
+
3
+ SAP MCP is the hosted and local Model Context Protocol gateway for Synapse Agent Protocol, Solana execution tools, x402/pay.sh monetization, SNS identity, and agent operations.
4
+
5
+ The primary hosted endpoint is:
6
+
7
+ ```txt
8
+ https://mcp.sap.oobeprotocol.ai/mcp
9
+ ```
10
+
11
+ Use this documentation when you need to install the wizard, connect Claude/Hermes/Codex/OpenClaw or another MCP client, configure a local SAP profile and signer, understand hosted payments, or operate the server on a VPS.
12
+
13
+ ## Fastest Hosted Setup
14
+
15
+ Most users should connect agents to the hosted remote MCP server while keeping signing local and user-controlled.
16
+
17
+ ```bash
18
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
19
+ ```
20
+
21
+ Users who prefer a GUI can download the Desktop Wizard from GitHub releases:
22
+
23
+ ```txt
24
+ https://github.com/OOBE-PROTOCOL/sap-mcp/releases
25
+ ```
26
+
27
+ The desktop wizard creates the same local SAP MCP profile, signer boundary, hosted MCP client config, and optional x402 paid-call bridge as the CLI wizard.
28
+
29
+ The wizard creates an isolated SAP MCP profile under:
30
+
31
+ ```txt
32
+ ~/.config/mcp-sap
33
+ ```
34
+
35
+ Then configure your MCP client with:
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "sap": {
41
+ "url": "https://mcp.sap.oobeprotocol.ai/mcp",
42
+ "transport": "streamable-http"
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## What The Hosted Server Provides
49
+
50
+ SAP MCP groups tools into three practical buckets:
51
+
52
+ | Bucket | What Agents Can Do |
53
+ | --- | --- |
54
+ | Solana DeFi protocol tools | Use Jupiter, Raydium, Orca, Meteora, Drift, Pyth, Metaplex, SPL Token, bridging, staking, and related Solana protocol integrations. |
55
+ | Solana RPC and chain methods | Read balances, token accounts, transactions, DAS assets, NFTs, network state, program data, and chain metadata. |
56
+ | Synapse Agent Protocol methods | Register and discover agents, use SAP reputation, escrow, settlement, memory, proofs, SNS identity, policy context, and coordination flows. |
57
+
58
+ ## Trust Boundary
59
+
60
+ The hosted server does not custody user wallets. Users create a local SAP MCP profile and signer with the wizard. Value-moving flows, x402/pay.sh payment payloads, and transaction signatures remain authorized by the user machine or an external signer.
61
+
62
+ Keypair bytes must never be pasted into MCP client config, sent to the hosted server, logged, or shown to agents.
63
+
64
+ ## Remote Payment Model
65
+
66
+ Hosted paid tools use x402 and pay.sh:
67
+
68
+ - free: MCP handshake, `tools/list`, prompts, resources, base profile/context tools
69
+ - paid reads: premium registry, discovery, and analytics tools
70
+ - builders: batch/domain/enriched operations
71
+ - value flows: fixed or percentage pricing only where it is operationally appropriate
72
+
73
+ For agents that cannot replay x402 challenges natively, install the optional paid-call helper:
74
+
75
+ ```bash
76
+ npx --yes --package @oobe-protocol-labs/sap-mcp-server sap-mcp-x402-paid-call \
77
+ --tool sap_list_all_agents \
78
+ --arguments '{"limit":5}' \
79
+ --max-usd 0.02 \
80
+ --confirm
81
+ ```
82
+
83
+ ## Start Here
84
+
85
+ Read these first:
86
+
87
+ 1. [Hosted Remote MCP](user/01_HOSTED_REMOTE_MCP.md)
88
+ 2. [Client Configs](user/04_CLIENT_CONFIGS.md)
89
+ 3. [Payments: x402 And pay.sh](user/03_PAYMENTS_X402_PAYSH.md)
90
+ 4. [Desktop GUI Wizard](user/06_DESKTOP_GUI_WIZARD.md)
91
+ 5. [Configuration And Wizard](03_CONFIGURATION_AND_WIZARD.md)
92
+ 6. [Endpoints And Clients](07_ENDPOINTS_AND_CLIENTS.md)
93
+
94
+ ## Public Endpoints
95
+
96
+ | Endpoint | Purpose |
97
+ | --- | --- |
98
+ | `GET /` | Public landing page and payment/server overview. |
99
+ | `GET /docs` | This documentation site. |
100
+ | `POST /mcp` | Streamable HTTP MCP endpoint for agents. |
101
+ | `GET /server.json` | Public, secret-free machine-readable server metadata. |
102
+ | `GET /.well-known/agent-card.json` | A2A-style agent card. |
103
+ | `GET /.well-known/sap-mcp-wizard.json` | Wizard install descriptor for agents that cannot see local config. |
104
+ | `GET /wizard/install.sh` | One-line wizard installer. |
@@ -0,0 +1,31 @@
1
+ - Getting Started
2
+ - [Overview](README.md)
3
+ - [Hosted Remote MCP](user/01_HOSTED_REMOTE_MCP.md)
4
+ - [Local Stdio MCP](user/02_LOCAL_STDIO_MCP.md)
5
+ - [Client Configs](user/04_CLIENT_CONFIGS.md)
6
+ - [Skills And Tools](user/05_SKILLS_AND_TOOLS.md)
7
+ - [Desktop GUI Wizard](user/06_DESKTOP_GUI_WIZARD.md)
8
+
9
+ - Payments
10
+ - [x402 And pay.sh](user/03_PAYMENTS_X402_PAYSH.md)
11
+ - [Protocol Spec](x402-protocol-spec.md)
12
+ - [Payments Architecture](06_PAYMENTS_X402_AND_PAYSH.md)
13
+
14
+ - Configuration
15
+ - [Configuration And Wizard](03_CONFIGURATION_AND_WIZARD.md)
16
+ - [Security Policy And Signing](08_SECURITY_POLICY_AND_SIGNING.md)
17
+ - [Endpoints And Clients](07_ENDPOINTS_AND_CLIENTS.md)
18
+
19
+ - Operations
20
+ - [Product Overview](01_PRODUCT_OVERVIEW.md)
21
+ - [Architecture And Request Flow](02_ARCHITECTURE_AND_REQUEST_FLOW.md)
22
+ - [Local Stdio Usage](04_LOCAL_STDIO_USAGE.md)
23
+ - [Remote VPS Deployment](05_REMOTE_VPS_DEPLOYMENT.md)
24
+ - [Operations Release And PM2](10_OPERATIONS_RELEASE_AND_PM2.md)
25
+ - [Desktop Wizard Release](14_DESKTOP_WIZARD_RELEASE.md)
26
+ - [Code Quality Audit](11_CODE_QUALITY_AUDIT.md)
27
+
28
+ - Advanced
29
+ - [Tools Skills And Agent Guide](09_TOOLS_SKILLS_AND_AGENT_GUIDE.md)
30
+ - [On-Chain Agent Chat](12_ONCHAIN_AGENT_CHAT.md)
31
+ - [Bounty Program Proposal](13_BOUNTY_PROGRAM_PROPOSAL.md)
@@ -0,0 +1,166 @@
1
+ # MagicBlock Tools
2
+
3
+ > 20 MCP tools wrapping the MagicBlock ER Router, Private Payment API, and Solana VRF.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ The SAP MCP server now includes 20 MagicBlock tools that wrap two MagicBlock
10
+ API surfaces:
11
+
12
+ 1. **ER Router** — JSON-RPC 2.0 at `https://(devnet-)router.magicblock.app`
13
+ 2. **Private Payment API** — REST at `https://payments.magicblock.app`
14
+
15
+ A third protocol (VRF) is implemented on-chain using `@solana/web3.js` —
16
+ it builds unsigned transactions that invoke the VRF program
17
+ (`Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz`) and reads
18
+ `RandomnessRequest` accounts to check fulfillment.
19
+
20
+ All tools are registered automatically when the MCP server starts — no
21
+ additional configuration needed.
22
+
23
+ ---
24
+
25
+ ## Pricing
26
+
27
+ Two tiers, priced in USDC base units (6 decimals):
28
+
29
+ | Tier | Price | Count | Tools |
30
+ |------|-------|-------|-------|
31
+ | READ | $0.01 | 14 | ER Router queries, health, auth, balances, swap quotes, mint checks, VRF result |
32
+ | WRITE | $0.05 | 6 | deposit, transfer, withdraw, swap, initializeMint, VRF request |
33
+
34
+ Every tool description includes its price. Every successful response
35
+ includes `priceUsd` and `priceBaseUnits` fields for SAP escrow settlement.
36
+
37
+ ---
38
+
39
+ ## Tools (20 total)
40
+
41
+ ### ER Router (6 read-only — $0.01)
42
+
43
+ | Tool | Description |
44
+ |------|-------------|
45
+ | `magicblock_getRoutes` | List available ER nodes (identity, FQDN, fee, block time, country) |
46
+ | `magicblock_getIdentity` | Get the identity and FQDN of the current ER validator |
47
+ | `magicblock_getDelegationStatus` | Check if a Solana account is delegated to an ER |
48
+ | `magicblock_getAccountInfo` | Fetch account info via the Magic Router |
49
+ | `magicblock_getBlockhashForAccounts` | Get a blockhash for a batch of accounts (max 100) |
50
+ | `magicblock_getSignatureStatuses` | Check transaction confirmation status |
51
+
52
+ ### Private Payments — Meta & Auth (3 — $0.01)
53
+
54
+ | Tool | Description |
55
+ |------|-------------|
56
+ | `magicblock_health` | Check Private Payments API health |
57
+ | `magicblock_challenge` | Generate a challenge string for wallet auth |
58
+ | `magicblock_login` | Exchange signed challenge for bearer token |
59
+
60
+ ### Private Payments — Balance (2 — $0.01)
61
+
62
+ | Tool | Description |
63
+ |------|-------------|
64
+ | `magicblock_balance` | Read base-chain SPL token balance |
65
+ | `magicblock_privateBalance` | Read ephemeral-rollup SPL balance (requires auth) |
66
+
67
+ ### Private Payments — SPL Token Flows (3 — $0.05)
68
+
69
+ | Tool | Description |
70
+ |------|-------------|
71
+ | `magicblock_deposit` | Build unsigned deposit tx (Solana → ER) |
72
+ | `magicblock_transfer` | Build unsigned SPL transfer (public or private) |
73
+ | `magicblock_withdraw` | Build unsigned withdraw tx (ER → Solana) |
74
+
75
+ ### Private Payments — Swap (2)
76
+
77
+ | Tool | Price | Description |
78
+ |------|-------|-------------|
79
+ | `magicblock_swapQuote` | $0.01 | Get a swap quote between two SPL mints |
80
+ | `magicblock_swap` | $0.05 | Build unsigned swap tx (public or private) |
81
+
82
+ ### Private Payments — Mint Init (2)
83
+
84
+ | Tool | Price | Description |
85
+ |------|-------|-------------|
86
+ | `magicblock_initializeMint` | $0.05 | Build unsigned mint transfer queue init tx |
87
+ | `magicblock_isMintInitialized` | $0.01 | Check if a mint's transfer queue exists |
88
+
89
+ ### VRF (2 — on-chain via @solana/web3.js)
90
+
91
+ | Tool | Price | Description |
92
+ |------|-------|-------------|
93
+ | `magicblock_requestRandomness` | $0.05 | Build unsigned tx invoking request_randomness on the VRF program (Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz) |
94
+ | `magicblock_getRandomnessResult` | $0.01 | Read the RandomnessRequest account on-chain to check fulfillment and retrieve random bytes |
95
+
96
+ ---
97
+
98
+ ## Auth Flow (Private Ephemeral Rollup)
99
+
100
+ ```
101
+ 1. magicblock_challenge({ pubkey }) → { challenge: "..." }
102
+ 2. Wallet signs the challenge string
103
+ 3. magicblock_login({ pubkey, challenge, signature }) → { token: "..." }
104
+ 4. Pass authToken on magicblock_privateBalance and magicblock_transfer (private)
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Transaction Flow (Write Tools)
110
+
111
+ Write tools return an unsigned transaction:
112
+
113
+ ```json
114
+ {
115
+ "kind": "deposit",
116
+ "version": "legacy",
117
+ "transactionBase64": "AQAAAA...",
118
+ "sendTo": "base",
119
+ "recentBlockhash": "9A4VhP8M...",
120
+ "lastValidBlockHeight": 284512337,
121
+ "instructionCount": 3,
122
+ "requiredSigners": ["3rXKwQ1kpjBd..."]
123
+ }
124
+ ```
125
+
126
+ Expected flow:
127
+
128
+ 1. Call the MagicBlock tool (e.g. `magicblock_deposit`) → get `transactionBase64`
129
+ 2. Sign with `sap_sign_transaction`
130
+ 3. Submit with `sap_submit_signed_transaction` to the RPC indicated by `sendTo`
131
+
132
+ ---
133
+
134
+ ## Response Format
135
+
136
+ Every successful response is wrapped with pricing metadata:
137
+
138
+ ```json
139
+ {
140
+ "success": true,
141
+ "tool": "magicblock_deposit",
142
+ "priceUsd": "$0.05",
143
+ "priceBaseUnits": "50000",
144
+ "data": { ... }
145
+ }
146
+ ```
147
+
148
+ Error responses:
149
+
150
+ ```json
151
+ {
152
+ "error": "MagicBlock tool magicblock_deposit failed",
153
+ "message": "MagicBlock API 400: ..."
154
+ }
155
+ ```
156
+
157
+ ---
158
+
159
+ ## File Reference
160
+
161
+ | File | Description |
162
+ |------|-------------|
163
+ | `src/tools/magicblock-tools.ts` | 20 tool registrations with HTTP client |
164
+ | `src/tools/__tests__/magicblock-tools.test.ts` | 10 smoke tests |
165
+ | `src/tools/index.ts` | Barrel export |
166
+ | `src/tools/register-tools.ts` | Registration call during server init |