@oobe-protocol-labs/sap-mcp-server 0.9.22 → 0.9.35

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 (188) hide show
  1. package/.env.example +10 -0
  2. package/CHANGELOG.md +100 -6
  3. package/README.md +3 -3
  4. package/USER_DOCS/00_START_HERE.md +9 -1
  5. package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +1 -1
  6. package/USER_DOCS/04_CLIENT_CONFIGS.md +3 -3
  7. package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +5 -5
  8. package/dist/config/env.d.ts +18 -0
  9. package/dist/config/env.d.ts.map +1 -1
  10. package/dist/config/env.js +14 -2
  11. package/dist/config/env.js.map +1 -1
  12. package/dist/config/mcp-client-injection.js +3 -3
  13. package/dist/config/paths.d.ts +9 -1
  14. package/dist/config/paths.d.ts.map +1 -1
  15. package/dist/config/paths.js +15 -1
  16. package/dist/config/paths.js.map +1 -1
  17. package/dist/config/wizard.d.ts.map +1 -1
  18. package/dist/config/wizard.js +3 -1
  19. package/dist/config/wizard.js.map +1 -1
  20. package/dist/core/constants.d.ts +1 -1
  21. package/dist/core/constants.js +1 -1
  22. package/dist/core/logger.js +1 -1
  23. package/dist/memory/async-processor.d.ts +107 -0
  24. package/dist/memory/async-processor.d.ts.map +1 -0
  25. package/dist/memory/async-processor.js +204 -0
  26. package/dist/memory/async-processor.js.map +1 -0
  27. package/dist/memory/auto-record.d.ts +47 -0
  28. package/dist/memory/auto-record.d.ts.map +1 -0
  29. package/dist/memory/auto-record.js +133 -0
  30. package/dist/memory/auto-record.js.map +1 -0
  31. package/dist/memory/database.d.ts +103 -0
  32. package/dist/memory/database.d.ts.map +1 -0
  33. package/dist/memory/database.js +337 -0
  34. package/dist/memory/database.js.map +1 -0
  35. package/dist/memory/hermes-bridge.d.ts +70 -0
  36. package/dist/memory/hermes-bridge.d.ts.map +1 -0
  37. package/dist/memory/hermes-bridge.js +155 -0
  38. package/dist/memory/hermes-bridge.js.map +1 -0
  39. package/dist/memory/index.d.ts +23 -0
  40. package/dist/memory/index.d.ts.map +1 -0
  41. package/dist/memory/index.js +22 -0
  42. package/dist/memory/index.js.map +1 -0
  43. package/dist/memory/memory-store.d.ts +76 -0
  44. package/dist/memory/memory-store.d.ts.map +1 -0
  45. package/dist/memory/memory-store.js +231 -0
  46. package/dist/memory/memory-store.js.map +1 -0
  47. package/dist/memory/stream-buffer-store.d.ts +69 -0
  48. package/dist/memory/stream-buffer-store.d.ts.map +1 -0
  49. package/dist/memory/stream-buffer-store.js +182 -0
  50. package/dist/memory/stream-buffer-store.js.map +1 -0
  51. package/dist/memory/tool-call-store.d.ts +68 -0
  52. package/dist/memory/tool-call-store.d.ts.map +1 -0
  53. package/dist/memory/tool-call-store.js +189 -0
  54. package/dist/memory/tool-call-store.js.map +1 -0
  55. package/dist/memory/types.d.ts +197 -0
  56. package/dist/memory/types.d.ts.map +1 -0
  57. package/dist/memory/types.js +15 -0
  58. package/dist/memory/types.js.map +1 -0
  59. package/dist/memory/utils.d.ts +30 -0
  60. package/dist/memory/utils.d.ts.map +1 -0
  61. package/dist/memory/utils.js +47 -0
  62. package/dist/memory/utils.js.map +1 -0
  63. package/dist/payments/hosted-tool-eligibility.d.ts.map +1 -1
  64. package/dist/payments/hosted-tool-eligibility.js +4 -6
  65. package/dist/payments/hosted-tool-eligibility.js.map +1 -1
  66. package/dist/payments/monetization-gate.d.ts +39 -0
  67. package/dist/payments/monetization-gate.d.ts.map +1 -1
  68. package/dist/payments/monetization-gate.js +165 -11
  69. package/dist/payments/monetization-gate.js.map +1 -1
  70. package/dist/payments/pricing.d.ts.map +1 -1
  71. package/dist/payments/pricing.js +69 -0
  72. package/dist/payments/pricing.js.map +1 -1
  73. package/dist/payments/x402-paid-call.js +1 -1
  74. package/dist/premium/builtin-plugins.d.ts +42 -0
  75. package/dist/premium/builtin-plugins.d.ts.map +1 -1
  76. package/dist/premium/builtin-plugins.js +91 -10
  77. package/dist/premium/builtin-plugins.js.map +1 -1
  78. package/dist/premium/manifest-builder.d.ts.map +1 -1
  79. package/dist/premium/manifest-builder.js +43 -7
  80. package/dist/premium/manifest-builder.js.map +1 -1
  81. package/dist/premium/meme-radar-capabilities.js +9 -9
  82. package/dist/premium/meme-radar-capabilities.js.map +1 -1
  83. package/dist/premium/plugin-validator.d.ts.map +1 -1
  84. package/dist/premium/plugin-validator.js +62 -1
  85. package/dist/premium/plugin-validator.js.map +1 -1
  86. package/dist/premium/provider-bridge.d.ts +25 -1
  87. package/dist/premium/provider-bridge.d.ts.map +1 -1
  88. package/dist/premium/provider-bridge.js +130 -20
  89. package/dist/premium/provider-bridge.js.map +1 -1
  90. package/dist/premium/session-manager.d.ts.map +1 -1
  91. package/dist/premium/session-manager.js +12 -3
  92. package/dist/premium/session-manager.js.map +1 -1
  93. package/dist/premium/tech-fundamentals-capabilities.js +5 -5
  94. package/dist/premium/tech-fundamentals-capabilities.js.map +1 -1
  95. package/dist/premium/trading-capabilities.js +5 -5
  96. package/dist/premium/trading-capabilities.js.map +1 -1
  97. package/dist/premium/webhook-engine.d.ts.map +1 -1
  98. package/dist/premium/webhook-engine.js +7 -1
  99. package/dist/premium/webhook-engine.js.map +1 -1
  100. package/dist/prompts/context/sap-agent-context.prompt.js +1 -1
  101. package/dist/prompts/payments/explain-x402-settlement.prompt.js +1 -1
  102. package/dist/remote/premium-routes.d.ts.map +1 -1
  103. package/dist/remote/premium-routes.js +3 -2
  104. package/dist/remote/premium-routes.js.map +1 -1
  105. package/dist/remote/public-home/sections.d.ts.map +1 -1
  106. package/dist/remote/public-home/sections.js +2 -3
  107. package/dist/remote/public-home/sections.js.map +1 -1
  108. package/dist/remote/public-home/styles.d.ts +1 -1
  109. package/dist/remote/public-home/styles.js +2 -2
  110. package/dist/remote/server.d.ts.map +1 -1
  111. package/dist/remote/server.js +19 -4
  112. package/dist/remote/server.js.map +1 -1
  113. package/dist/server/server-metadata.js +1 -1
  114. package/dist/strategies/strategy-store.d.ts +82 -0
  115. package/dist/strategies/strategy-store.d.ts.map +1 -0
  116. package/dist/strategies/strategy-store.js +165 -0
  117. package/dist/strategies/strategy-store.js.map +1 -0
  118. package/dist/tools/agent-start-tool.d.ts.map +1 -1
  119. package/dist/tools/agent-start-tool.js +97 -10
  120. package/dist/tools/agent-start-tool.js.map +1 -1
  121. package/dist/tools/client-sdk-tools.d.ts.map +1 -1
  122. package/dist/tools/client-sdk-tools.js +152 -9
  123. package/dist/tools/client-sdk-tools.js.map +1 -1
  124. package/dist/tools/estimate-tool-cost.js +1 -1
  125. package/dist/tools/estimate-tool-cost.js.map +1 -1
  126. package/dist/tools/index.d.ts +1 -0
  127. package/dist/tools/index.d.ts.map +1 -1
  128. package/dist/tools/index.js +2 -0
  129. package/dist/tools/index.js.map +1 -1
  130. package/dist/tools/magicblock-tools.js +5 -5
  131. package/dist/tools/magicblock-tools.js.map +1 -1
  132. package/dist/tools/memory-tools.d.ts +26 -0
  133. package/dist/tools/memory-tools.d.ts.map +1 -0
  134. package/dist/tools/memory-tools.js +533 -0
  135. package/dist/tools/memory-tools.js.map +1 -0
  136. package/dist/tools/perp-tools.d.ts +7 -9
  137. package/dist/tools/perp-tools.d.ts.map +1 -1
  138. package/dist/tools/perp-tools.js +386 -367
  139. package/dist/tools/perp-tools.js.map +1 -1
  140. package/dist/tools/premium-tools.d.ts.map +1 -1
  141. package/dist/tools/premium-tools.js +8 -2
  142. package/dist/tools/premium-tools.js.map +1 -1
  143. package/dist/tools/profile-tools.d.ts.map +1 -1
  144. package/dist/tools/profile-tools.js +18 -1
  145. package/dist/tools/profile-tools.js.map +1 -1
  146. package/dist/tools/quick-context-tool.d.ts.map +1 -1
  147. package/dist/tools/quick-context-tool.js +100 -9
  148. package/dist/tools/quick-context-tool.js.map +1 -1
  149. package/dist/tools/register-tools.d.ts.map +1 -1
  150. package/dist/tools/register-tools.js +3 -0
  151. package/dist/tools/register-tools.js.map +1 -1
  152. package/dist/tools/sap-sdk-tools.js +3 -3
  153. package/dist/tools/sap-sdk-tools.js.map +1 -1
  154. package/dist/tools/session-context-packet.d.ts +19 -0
  155. package/dist/tools/session-context-packet.d.ts.map +1 -0
  156. package/dist/tools/session-context-packet.js +256 -0
  157. package/dist/tools/session-context-packet.js.map +1 -0
  158. package/dist/tools/skills-tools.d.ts +10 -0
  159. package/dist/tools/skills-tools.d.ts.map +1 -1
  160. package/dist/tools/skills-tools.js +19 -0
  161. package/dist/tools/skills-tools.js.map +1 -1
  162. package/dist/tools/transaction-tools.d.ts +1 -0
  163. package/dist/tools/transaction-tools.d.ts.map +1 -1
  164. package/dist/tools/transaction-tools.js +248 -9
  165. package/dist/tools/transaction-tools.js.map +1 -1
  166. package/dist/tools/x402-paid-call-tool.d.ts.map +1 -1
  167. package/dist/tools/x402-paid-call-tool.js +55 -21
  168. package/dist/tools/x402-paid-call-tool.js.map +1 -1
  169. package/dist/wizard-core/desktop-flow.d.ts.map +1 -1
  170. package/dist/wizard-core/desktop-flow.js +4 -2
  171. package/dist/wizard-core/desktop-flow.js.map +1 -1
  172. package/docs/06_PAYMENTS_X402_AND_PAYSH.md +14 -5
  173. package/docs/07_ENDPOINTS_AND_CLIENTS.md +1 -1
  174. package/docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md +13 -5
  175. package/docs/13_BOUNTY_PROGRAM_PROPOSAL.md +1 -1
  176. package/docs/14_DESKTOP_WIZARD_RELEASE.md +3 -3
  177. package/docs/15_DASHBOARD_SCREENSHARE_SCRIPT.md +1 -1
  178. package/docs/BRANCH_AND_CI.md +2 -2
  179. package/docs/README.md +1 -1
  180. package/package.json +3 -1
  181. package/server.json +3 -3
  182. package/skills/README.md +1 -1
  183. package/skills/sap-agentkit/SKILL.md +1 -2
  184. package/skills/sap-defi/SKILL.md +31 -2
  185. package/skills/sap-mcp/SKILL.md +24 -13
  186. package/skills/sap-mcp/TOOL_REFERENCE.md +2 -4
  187. package/skills/sap-payments-x402/SKILL.md +15 -3
  188. package/assets/logos/drift.svg +0 -12
@@ -9,6 +9,7 @@ safe signing behavior.
9
9
  If the user says "Start SAP MCP", "Initialize SAP MCP", "Load SAP", or "SAP
10
10
  mode", treat it as the activation command. Call `sap_agent_start` when it is
11
11
  available, then call `sap_agent_runtime_status` with the closest intent and
12
+ `sap_prepare_action` when the request is more than a status check. Then call
12
13
  `sap_skills_bundle` with `includeContents: true`. Load the returned SAP MCP
13
14
  skill contents into context before selecting advanced tools.
14
15
 
@@ -22,18 +23,19 @@ Always inspect runtime context through MCP tools, not by reading config files:
22
23
 
23
24
  1. `sap_agent_start`
24
25
  2. `sap_agent_runtime_status` with `intent: "connection"`, `"paid-call"`, `"registry-write"`, `"transaction-finalize"`, `"escrow"`, `"identity"`, or `"general"`
25
- 3. `sap_agent_context` for free compact agent/directory orientation before paid discovery
26
- 4. `sap_skills_bundle` with `includeContents: true`
27
- 5. `sap_pricing_catalog` before estimating hosted paid call tiers
28
- 6. `sap_agent_next_action` before retrying after any SAP MCP error or partial write result
29
- 7. `sap_skills_upgrade_plan` when local skills are missing or stale
30
- 8. `sap_runtime_repair_plan` when hosted tools are connected but `sap_payments` is missing
31
- 9. `sap_protocol_invariants` before SAP registry writes or when treasury, protocol fee, hosted write routing, or local signer routing is unclear
32
- 10. `sap_agent_identity_plan` before agent registration, profile-image updates, Metaplex identity, SNS linking, or full identity setup
33
- 11. `sap_profile_current`
34
- 12. `sap_profile_list`
35
- 13. `sap_profile_public_key`
36
- 14. `sap_network_stats`
26
+ 3. `sap_prepare_action` with the closest intent before paid calls, swaps, registry writes, identity updates, Escrow V2, external x402 agents, premium streams, or transaction finalization
27
+ 4. `sap_agent_context` for free compact agent/directory orientation before paid discovery
28
+ 5. `sap_skills_bundle` with `includeContents: true`
29
+ 6. `sap_pricing_catalog` before estimating hosted paid call tiers
30
+ 7. `sap_agent_next_action` before retrying after any SAP MCP error or partial write result
31
+ 8. `sap_skills_upgrade_plan` when local skills are missing or stale
32
+ 9. `sap_runtime_repair_plan` when hosted tools are connected but `sap_payments` is missing
33
+ 10. `sap_protocol_invariants` before SAP registry writes or when treasury, protocol fee, hosted write routing, or local signer routing is unclear
34
+ 11. `sap_agent_identity_plan` before agent registration, profile-image updates, Metaplex identity, SNS linking, or full identity setup
35
+ 12. `sap_profile_current`
36
+ 13. `sap_profile_list`
37
+ 14. `sap_profile_public_key`
38
+ 15. `sap_network_stats`
37
39
 
38
40
  For simple "are you connected?" checks, do not dump tool counts or inspect
39
41
  local files. Use `sap_agent_runtime_status` first and answer with the hosted
@@ -57,6 +59,12 @@ and error strings unchanged.
57
59
  agent profile reads as fresh data. Do not rely on old chat memory when the
58
60
  user asks for current state; use exact lightweight reads first, then paid
59
61
  discovery only when enrichment or broad search is needed.
62
+ - Treat session memory as operational context and proof tape, not cached market
63
+ or on-chain truth. It may store active profile names, public wallet keys,
64
+ runtime namespace availability, receipts, signatures, and error
65
+ classifications. It must not be used as truth for token prices, Jupiter
66
+ quotes/orders, balances, blockhashes, simulations, liquidity, routes, or SAP
67
+ account state.
60
68
  - Use free exact/base reads first when the wallet, PDA, or a small orientation
61
69
  page is enough: `sap_agent_context`, `sap_get_agent`, `sap_get_agent_profile`,
62
70
  `sap_get_agent_stats`, `sap_is_agent_active`, `sap_get_global_state`, and
@@ -100,7 +108,7 @@ Use the bundled routing map for local MCP tool selection:
100
108
 
101
109
  SAP MCP startup and skill bootstrap tools are free context/setup tools. Call
102
110
  `sap_agent_start`, `sap_agent_runtime_status`, `sap_agent_context`,
103
- `sap_agent_next_action`, `sap_pricing_catalog`,
111
+ `sap_prepare_action`, `sap_agent_next_action`, `sap_pricing_catalog`,
104
112
  `sap_skills_list`, `sap_skills_bundle`, `sap_skills_upgrade_plan`,
105
113
  `sap_runtime_repair_plan`, and local `sap_skills_install` directly. Do not
106
114
  route startup, runtime status, pricing catalog, skill listing, bundling,
@@ -198,6 +206,9 @@ This prevents silent cap aborts and failed x402 attempts on local-signer-only
198
206
  tools. For local-signer-only tools (e.g. `sap_register_agent`), the estimate
199
207
  will say `tier: "local-signer-only"` and tell you to use the local
200
208
  `sap_payments_*` equivalent instead of `sap_payments_call_paid_tool`.
209
+ For any intent-level workflow, call `sap_prepare_action` before execution. It
210
+ returns the correct hosted/local route, fresh-data requirements, confirmation
211
+ policy, retry rules, and proof-tape shape without charging x402.
201
212
 
202
213
  If a hosted paid tool returns `BlockhashNotFound`,
203
214
  `transaction_simulation_failed`, `smart_wallet_simulation_failed`, `node is
@@ -178,9 +178,7 @@ Jupiter protocol toolkit:
178
178
  `adrena_openPosition`, `adrena_removeCollateral`,
179
179
  `bridging_bridgeDeBridge`, `bridging_bridgeDeBridgeStatus`,
180
180
  `bridging_bridgeWormhole`, `bridging_bridgeWormholeStatus`,
181
- `drift_borrow`, `drift_closePerpPosition`, `drift_deposit`,
182
- `drift_getPositions`, `drift_lend`, `drift_openPerpPosition`,
183
- `drift_withdraw`, `jito_getBundleStatus`, `jito_getTipEstimate`,
181
+ `jito_getBundleStatus`, `jito_getTipEstimate`,
184
182
  `jito_sendBundle`, `lulo_deposit`, `lulo_getBestRates`,
185
183
  `lulo_getPositions`, `lulo_withdraw`, `manifest_cancelOrder`,
186
184
  `manifest_createMarket`, `manifest_getOrderbook`,
@@ -209,7 +207,7 @@ Protocol routing shortcuts:
209
207
  | Token launch/mint/burn | `spl-token_deployToken`, `spl-token_mintTo`, `spl-token_burn` |
210
208
  | Jupiter quote/swap | `jupiter_getQuote`, `jupiter_smartSwap`, `jupiter_swap`, `jupiter_swapInstructions` |
211
209
  | Jupiter limit/DCA | `jupiter_createLimitOrder`, `jupiter_getLimitOrders`, `jupiter_createDCA`, `jupiter_getDCAOrders` |
212
- | Perps/lending | `drift_*`, `adrena_*`, `lulo_*` |
210
+ | Perps/lending | `sap_perp_trade_plan`, `sap_perp_*`, `adrena_*`, `lulo_*` |
213
211
  | Liquidity pools | `raydium-pools_*`, `orca_*`, `meteora_*` |
214
212
  | Orderbooks | `openbook_*`, `manifest_*` |
215
213
  | Price data | `pyth_*`, `coingecko_*` |
@@ -16,6 +16,7 @@ workflows, and hosted SAP MCP x402/pay.sh monetization.
16
16
  - `sap_payments_prepare_challenge`
17
17
  - `sap_payments_sign_challenge`
18
18
  - `sap_payments_verify_receipt`
19
+ - `sap_prepare_action`
19
20
  - `sap_x402_paid_call`
20
21
  - `sap_create_subscription`
21
22
  - `sap_fund_subscription`
@@ -70,6 +71,15 @@ Before retrying `payment_required`, `hosted_local_signer_required`,
70
71
  signature, call `sap_agent_next_action`. Use its `safeToRetryNow`, `nextTool`,
71
72
  and `paymentCharged` fields as the retry guard.
72
73
 
74
+ Before starting a paid or value-moving workflow, call the free hosted
75
+ `sap_prepare_action` planner with the closest intent. It returns:
76
+
77
+ - fresh data that must be fetched again before payment/signing;
78
+ - whether to use hosted `sap`, local `sap_payments`, or a hosted unsigned
79
+ builder plus `sap_payments_finalize_transaction`;
80
+ - max-price and confirmation guidance;
81
+ - retry rules and the proof-tape fields to report back to the user.
82
+
73
83
  For fast x402 execution:
74
84
 
75
85
  1. Reuse the MCP session returned by `initialize`.
@@ -78,9 +88,11 @@ For fast x402 execution:
78
88
  3. Use `PAYMENT-SIGNATURE` first; use `X-PAYMENT` only for clients that require
79
89
  the alternate header.
80
90
  4. Cache only static MCP surface metadata such as `tools/list`, `prompts/list`,
81
- and `resources/list` inside the runtime when useful. Do not cache on-chain
82
- balances, SAP agent rows, pricing, SNS ownership, quotes, or settlement
83
- state when the user expects fresh data.
91
+ and `resources/list` inside the runtime when useful. Session memory can
92
+ store operational context, receipts, signatures, and error classifications.
93
+ Do not cache on-chain balances, SAP agent rows, pricing, SNS ownership,
94
+ quotes, blockhashes, simulations, liquidity, routes, or settlement state
95
+ when the user expects fresh data.
84
96
  5. Treat `PAYMENT-RESPONSE` as the receipt bound to the tool output.
85
97
  6. If the client runtime cannot sign or attach x402 payment headers itself, use
86
98
  the local SAP MCP `sap_payments_call_paid_tool` bridge configured by the SAP
@@ -1,12 +0,0 @@
1
- <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M0 64C0 28.6538 28.6538 0 64 0H192C227.346 0 256 28.6538 256 64V192C256 227.346 227.346 256 192 256H64C28.6538 256 0 227.346 0 192V64Z" fill="#08AA18"/>
3
- <g clip-path="url(#clip0_354_3823)">
4
- <path d="M32 62.9677C32 45.8647 45.8647 32 62.9677 32H193.032C210.135 32 224 45.8647 224 62.9677V193.032C224 210.135 210.135 224 193.032 224H62.9677C45.8647 224 32 210.135 32 193.032V62.9677Z" fill="#08AA18"/>
5
- <path d="M105.764 71.4325C105.367 72.4792 106.14 73.599 107.259 73.5993H129.162C130.199 73.5993 130.962 74.5712 130.717 75.5786L116.825 132.535C116.424 134.18 118.518 135.239 119.606 133.941L169.692 74.1724C169.996 73.8097 170.446 73.5993 170.919 73.5993H203.043C204.411 73.5993 205.148 75.2066 204.256 76.2439L77.1854 224H65.261L92.329 110.773C92.5694 109.767 91.8069 108.8 90.7731 108.799H52.9722C51.6232 108.799 50.8805 107.233 51.7338 106.188L112.32 32H120.719L105.764 71.4325Z" fill="white"/>
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_354_3823">
9
- <rect width="192" height="192" fill="white" transform="translate(32 32)"/>
10
- </clipPath>
11
- </defs>
12
- </svg>