@oobe-protocol-labs/sap-mcp-server 0.9.21 → 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 (190) hide show
  1. package/.env.example +11 -1
  2. package/CHANGELOG.md +233 -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/config.example.json +1 -1
  9. package/config.secure-example.json +1 -1
  10. package/dist/config/env.d.ts +18 -0
  11. package/dist/config/env.d.ts.map +1 -1
  12. package/dist/config/env.js +14 -2
  13. package/dist/config/env.js.map +1 -1
  14. package/dist/config/mcp-client-injection.js +3 -3
  15. package/dist/config/paths.d.ts +9 -1
  16. package/dist/config/paths.d.ts.map +1 -1
  17. package/dist/config/paths.js +15 -1
  18. package/dist/config/paths.js.map +1 -1
  19. package/dist/config/wizard.d.ts.map +1 -1
  20. package/dist/config/wizard.js +3 -1
  21. package/dist/config/wizard.js.map +1 -1
  22. package/dist/core/constants.d.ts +1 -1
  23. package/dist/core/constants.js +1 -1
  24. package/dist/core/logger.js +1 -1
  25. package/dist/memory/async-processor.d.ts +107 -0
  26. package/dist/memory/async-processor.d.ts.map +1 -0
  27. package/dist/memory/async-processor.js +204 -0
  28. package/dist/memory/async-processor.js.map +1 -0
  29. package/dist/memory/auto-record.d.ts +47 -0
  30. package/dist/memory/auto-record.d.ts.map +1 -0
  31. package/dist/memory/auto-record.js +133 -0
  32. package/dist/memory/auto-record.js.map +1 -0
  33. package/dist/memory/database.d.ts +103 -0
  34. package/dist/memory/database.d.ts.map +1 -0
  35. package/dist/memory/database.js +337 -0
  36. package/dist/memory/database.js.map +1 -0
  37. package/dist/memory/hermes-bridge.d.ts +70 -0
  38. package/dist/memory/hermes-bridge.d.ts.map +1 -0
  39. package/dist/memory/hermes-bridge.js +155 -0
  40. package/dist/memory/hermes-bridge.js.map +1 -0
  41. package/dist/memory/index.d.ts +23 -0
  42. package/dist/memory/index.d.ts.map +1 -0
  43. package/dist/memory/index.js +22 -0
  44. package/dist/memory/index.js.map +1 -0
  45. package/dist/memory/memory-store.d.ts +76 -0
  46. package/dist/memory/memory-store.d.ts.map +1 -0
  47. package/dist/memory/memory-store.js +231 -0
  48. package/dist/memory/memory-store.js.map +1 -0
  49. package/dist/memory/stream-buffer-store.d.ts +69 -0
  50. package/dist/memory/stream-buffer-store.d.ts.map +1 -0
  51. package/dist/memory/stream-buffer-store.js +182 -0
  52. package/dist/memory/stream-buffer-store.js.map +1 -0
  53. package/dist/memory/tool-call-store.d.ts +68 -0
  54. package/dist/memory/tool-call-store.d.ts.map +1 -0
  55. package/dist/memory/tool-call-store.js +189 -0
  56. package/dist/memory/tool-call-store.js.map +1 -0
  57. package/dist/memory/types.d.ts +197 -0
  58. package/dist/memory/types.d.ts.map +1 -0
  59. package/dist/memory/types.js +15 -0
  60. package/dist/memory/types.js.map +1 -0
  61. package/dist/memory/utils.d.ts +30 -0
  62. package/dist/memory/utils.d.ts.map +1 -0
  63. package/dist/memory/utils.js +47 -0
  64. package/dist/memory/utils.js.map +1 -0
  65. package/dist/payments/hosted-tool-eligibility.d.ts.map +1 -1
  66. package/dist/payments/hosted-tool-eligibility.js +4 -6
  67. package/dist/payments/hosted-tool-eligibility.js.map +1 -1
  68. package/dist/payments/monetization-gate.d.ts +39 -0
  69. package/dist/payments/monetization-gate.d.ts.map +1 -1
  70. package/dist/payments/monetization-gate.js +165 -11
  71. package/dist/payments/monetization-gate.js.map +1 -1
  72. package/dist/payments/pricing.d.ts.map +1 -1
  73. package/dist/payments/pricing.js +69 -0
  74. package/dist/payments/pricing.js.map +1 -1
  75. package/dist/payments/x402-paid-call.js +1 -1
  76. package/dist/premium/builtin-plugins.d.ts +42 -0
  77. package/dist/premium/builtin-plugins.d.ts.map +1 -1
  78. package/dist/premium/builtin-plugins.js +91 -10
  79. package/dist/premium/builtin-plugins.js.map +1 -1
  80. package/dist/premium/manifest-builder.d.ts.map +1 -1
  81. package/dist/premium/manifest-builder.js +43 -7
  82. package/dist/premium/manifest-builder.js.map +1 -1
  83. package/dist/premium/meme-radar-capabilities.js +9 -9
  84. package/dist/premium/meme-radar-capabilities.js.map +1 -1
  85. package/dist/premium/plugin-validator.d.ts.map +1 -1
  86. package/dist/premium/plugin-validator.js +62 -1
  87. package/dist/premium/plugin-validator.js.map +1 -1
  88. package/dist/premium/provider-bridge.d.ts +25 -1
  89. package/dist/premium/provider-bridge.d.ts.map +1 -1
  90. package/dist/premium/provider-bridge.js +130 -20
  91. package/dist/premium/provider-bridge.js.map +1 -1
  92. package/dist/premium/session-manager.d.ts.map +1 -1
  93. package/dist/premium/session-manager.js +12 -3
  94. package/dist/premium/session-manager.js.map +1 -1
  95. package/dist/premium/tech-fundamentals-capabilities.js +5 -5
  96. package/dist/premium/tech-fundamentals-capabilities.js.map +1 -1
  97. package/dist/premium/trading-capabilities.js +5 -5
  98. package/dist/premium/trading-capabilities.js.map +1 -1
  99. package/dist/premium/webhook-engine.d.ts.map +1 -1
  100. package/dist/premium/webhook-engine.js +7 -1
  101. package/dist/premium/webhook-engine.js.map +1 -1
  102. package/dist/prompts/context/sap-agent-context.prompt.js +1 -1
  103. package/dist/prompts/payments/explain-x402-settlement.prompt.js +1 -1
  104. package/dist/remote/premium-routes.d.ts.map +1 -1
  105. package/dist/remote/premium-routes.js +3 -2
  106. package/dist/remote/premium-routes.js.map +1 -1
  107. package/dist/remote/public-home/sections.d.ts.map +1 -1
  108. package/dist/remote/public-home/sections.js +2 -3
  109. package/dist/remote/public-home/sections.js.map +1 -1
  110. package/dist/remote/public-home/styles.d.ts +1 -1
  111. package/dist/remote/public-home/styles.js +2 -2
  112. package/dist/remote/server.d.ts.map +1 -1
  113. package/dist/remote/server.js +19 -4
  114. package/dist/remote/server.js.map +1 -1
  115. package/dist/server/server-metadata.js +1 -1
  116. package/dist/strategies/strategy-store.d.ts +82 -0
  117. package/dist/strategies/strategy-store.d.ts.map +1 -0
  118. package/dist/strategies/strategy-store.js +165 -0
  119. package/dist/strategies/strategy-store.js.map +1 -0
  120. package/dist/tools/agent-start-tool.d.ts.map +1 -1
  121. package/dist/tools/agent-start-tool.js +97 -10
  122. package/dist/tools/agent-start-tool.js.map +1 -1
  123. package/dist/tools/client-sdk-tools.d.ts.map +1 -1
  124. package/dist/tools/client-sdk-tools.js +152 -9
  125. package/dist/tools/client-sdk-tools.js.map +1 -1
  126. package/dist/tools/estimate-tool-cost.js +1 -1
  127. package/dist/tools/estimate-tool-cost.js.map +1 -1
  128. package/dist/tools/index.d.ts +1 -0
  129. package/dist/tools/index.d.ts.map +1 -1
  130. package/dist/tools/index.js +2 -0
  131. package/dist/tools/index.js.map +1 -1
  132. package/dist/tools/magicblock-tools.js +5 -5
  133. package/dist/tools/magicblock-tools.js.map +1 -1
  134. package/dist/tools/memory-tools.d.ts +26 -0
  135. package/dist/tools/memory-tools.d.ts.map +1 -0
  136. package/dist/tools/memory-tools.js +533 -0
  137. package/dist/tools/memory-tools.js.map +1 -0
  138. package/dist/tools/perp-tools.d.ts +7 -9
  139. package/dist/tools/perp-tools.d.ts.map +1 -1
  140. package/dist/tools/perp-tools.js +386 -367
  141. package/dist/tools/perp-tools.js.map +1 -1
  142. package/dist/tools/premium-tools.d.ts.map +1 -1
  143. package/dist/tools/premium-tools.js +8 -2
  144. package/dist/tools/premium-tools.js.map +1 -1
  145. package/dist/tools/profile-tools.d.ts.map +1 -1
  146. package/dist/tools/profile-tools.js +18 -1
  147. package/dist/tools/profile-tools.js.map +1 -1
  148. package/dist/tools/quick-context-tool.d.ts.map +1 -1
  149. package/dist/tools/quick-context-tool.js +100 -9
  150. package/dist/tools/quick-context-tool.js.map +1 -1
  151. package/dist/tools/register-tools.d.ts.map +1 -1
  152. package/dist/tools/register-tools.js +3 -0
  153. package/dist/tools/register-tools.js.map +1 -1
  154. package/dist/tools/sap-sdk-tools.js +3 -3
  155. package/dist/tools/sap-sdk-tools.js.map +1 -1
  156. package/dist/tools/session-context-packet.d.ts +19 -0
  157. package/dist/tools/session-context-packet.d.ts.map +1 -0
  158. package/dist/tools/session-context-packet.js +256 -0
  159. package/dist/tools/session-context-packet.js.map +1 -0
  160. package/dist/tools/skills-tools.d.ts +10 -0
  161. package/dist/tools/skills-tools.d.ts.map +1 -1
  162. package/dist/tools/skills-tools.js +19 -0
  163. package/dist/tools/skills-tools.js.map +1 -1
  164. package/dist/tools/transaction-tools.d.ts +1 -0
  165. package/dist/tools/transaction-tools.d.ts.map +1 -1
  166. package/dist/tools/transaction-tools.js +248 -9
  167. package/dist/tools/transaction-tools.js.map +1 -1
  168. package/dist/tools/x402-paid-call-tool.d.ts.map +1 -1
  169. package/dist/tools/x402-paid-call-tool.js +55 -21
  170. package/dist/tools/x402-paid-call-tool.js.map +1 -1
  171. package/dist/wizard-core/desktop-flow.d.ts.map +1 -1
  172. package/dist/wizard-core/desktop-flow.js +4 -2
  173. package/dist/wizard-core/desktop-flow.js.map +1 -1
  174. package/docs/06_PAYMENTS_X402_AND_PAYSH.md +14 -5
  175. package/docs/07_ENDPOINTS_AND_CLIENTS.md +1 -1
  176. package/docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md +13 -5
  177. package/docs/13_BOUNTY_PROGRAM_PROPOSAL.md +1 -1
  178. package/docs/14_DESKTOP_WIZARD_RELEASE.md +3 -3
  179. package/docs/15_DASHBOARD_SCREENSHARE_SCRIPT.md +1 -1
  180. package/docs/BRANCH_AND_CI.md +2 -2
  181. package/docs/README.md +1 -1
  182. package/package.json +3 -1
  183. package/server.json +3 -3
  184. package/skills/README.md +1 -1
  185. package/skills/sap-agentkit/SKILL.md +1 -2
  186. package/skills/sap-defi/SKILL.md +31 -2
  187. package/skills/sap-mcp/SKILL.md +24 -13
  188. package/skills/sap-mcp/TOOL_REFERENCE.md +2 -4
  189. package/skills/sap-payments-x402/SKILL.md +15 -3
  190. package/assets/logos/drift.svg +0 -12
package/.env.example CHANGED
@@ -100,6 +100,16 @@ SAP_MCP_REMOTE_KEEP_ALIVE_TIMEOUT_MS=75000
100
100
  # 0 means unlimited requests per socket.
101
101
  SAP_MCP_REMOTE_MAX_REQUESTS_PER_SOCKET=0
102
102
 
103
+ # =============================================================================
104
+ # Hosted Provider Keys (server-side only)
105
+ # =============================================================================
106
+ # Used only by the hosted SAP MCP gateway when serving protocol tools to users.
107
+ # Never put provider keys in agent runtime configs, public metadata, or MCP snippets.
108
+ SAP_MCP_JUPITER_API_BASE_URL=https://api.jup.ag
109
+ # SAP_MCP_JUPITER_TOKENS_API_BASE_URL=https://api.jup.ag
110
+ # SAP_MCP_JUPITER_API_KEY=your-jupiter-api-key
111
+ SAP_MCP_JUPITER_TIMEOUT_MS=30000
112
+
103
113
  # =============================================================================
104
114
  # Remote MCP Access Control
105
115
  # =============================================================================
@@ -187,7 +197,7 @@ SAP_MCP_FACILITATOR_NETWORKS=devnet
187
197
  SAP_MCP_PRICE_READ_PREMIUM_USD=0.001
188
198
  SAP_MCP_PRICE_BUILDER_USD=0.008
189
199
  SAP_MCP_PRICE_VALUE_FIXED_USD=0.09
190
- SAP_MCP_PRICE_HEAVY_VALUE_USD=0.15
200
+ SAP_MCP_PRICE_HEAVY_VALUE_USD=0.05
191
201
  SAP_MCP_PRICE_VALUE_BPS=0
192
202
  SAP_MCP_PRICE_MIN_USD=0.001
193
203
  SAP_MCP_PRICE_MAX_USD=100
package/CHANGELOG.md CHANGED
@@ -2,6 +2,236 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 0.9.35 - 2026-07-26
6
+
7
+ ### Changed — Protocol Safety And Perps Readiness
8
+
9
+ - Removed the disabled perp protocol family from the public SAP MCP surface while
10
+ it is under active exploit review. Public docs, skills, landing-page copy,
11
+ logo carousels, and dynamic AgentKit registration now exclude those tools.
12
+ - Replaced incomplete Adrena transaction builders with `sap_perp_trade_plan`,
13
+ a free trader-grade planning tool that returns notional sizing, liquidation
14
+ estimate, stop risk, reward/risk, risk flags, and the exact read tools an
15
+ agent should call before any external perps execution route.
16
+ - Kept perps analytics free and fast: markets, positions, funding, OHLC,
17
+ long-term charts, volume profile, liquidation zones, and trade planning.
18
+ - Moved local memory and strategy stores onto the canonical SAP MCP profile
19
+ directory: `~/.config/mcp-sap/`.
20
+ - Updated release metadata, hosted server card, desktop wizard references, and
21
+ npm/client snippets to `0.9.35`.
22
+
23
+ ### Added — Local Agent Memory Subsystem (SQLite FTS5)
24
+
25
+ ### Added — Local Agent Memory Subsystem (SQLite FTS5)
26
+
27
+ A complete serverless local-memory subsystem built on SQLite FTS5, using
28
+ inverted full-text indexes and relevance-ranked retrieval to recover historical
29
+ agent interactions. All data is stored locally at
30
+ `~/.config/mcp-sap/memory/agent-memory.db` — no data leaves the user's machine.
31
+
32
+ **10 module files:**
33
+ - `src/memory/types.ts` — 11 TypeScript interfaces with strict typing
34
+ - `src/memory/database.ts` — Singleton SQLite connection (WAL mode, FTS5, schema versioning, prepared statements, graceful degradation)
35
+ - `src/memory/tool-call-store.ts` — Records + FTS5 search with BM25 ranking
36
+ - `src/memory/memory-store.ts` — Agent memories with relevance decay + recall
37
+ - `src/memory/stream-buffer-store.ts` — FIFO event buffering with dedup + replay
38
+ - `src/memory/async-processor.ts` — Non-blocking background maintenance (decay, evict, archive, prune, WAL checkpoint)
39
+ - `src/memory/auto-record.ts` — Automatic tool call recording hook
40
+ - `src/memory/hermes-bridge.ts` — Cross-session Hermes Agent integration (read-only)
41
+ - `src/memory/utils.ts` — truncate, decayRelevance, isExpired
42
+ - `src/strategies/strategy-store.ts` — File-based JSON strategy store with versioning + path traversal protection
43
+
44
+ **17 FREE MCP memory tools (tool surface now 327 total after risk-policy removals, all local, no x402):**
45
+
46
+ | Category | Tool | Function |
47
+ |---|---|---|
48
+ | Memory | `sap_memory_record` | Record a tool call in the DB |
49
+ | | `sap_memory_search` | FTS5 search across tool call history |
50
+ | | `sap_memory_summarize` | Create an LLM-compressed memory (lesson/pattern/failure/success) |
51
+ | | `sap_memory_recall` | Top N memories for a category (prompt injection) |
52
+ | | `sap_memory_prune` | Remove expired + low-relevance memories |
53
+ | Strategy | `sap_strategy_save` | Save/update a strategy JSON |
54
+ | | `sap_strategy_load` | Load a strategy by category+name |
55
+ | | `sap_strategy_list` | List strategies (filterable) |
56
+ | | `sap_strategy_activate` | Activate/deactivate a strategy |
57
+ | Stream | `sap_stream_buffer` | Buffer a stream event (dedup by eventId) |
58
+ | | `sap_stream_consume` | Consume events FIFO (mark consumed) |
59
+ | | `sap_stream_replay` | Replay all events for backtest |
60
+ | Audit | `sap_audit_query` | Query audit trail via FTS5 |
61
+ | | `sap_audit_record` | Record a manual audit entry |
62
+ | | `sap_audit_stats` | Aggregate stats (counts, breakdowns, DB size) |
63
+ | Hermes | `sap_hermes_search` | Search Hermes session history |
64
+ | | `sap_hermes_recent` | Recent Hermes sessions for context injection |
65
+
66
+ **Key engineering features:**
67
+ - SQLite FTS5 with BM25 relevance ranking
68
+ - WAL mode for concurrent read access (crash-safe)
69
+ - Thread-safe singleton with cached prepared statements
70
+ - Graceful degradation (if DB can't open, tools return empty results)
71
+ - Async processor: decay (1h), evict (5m), archive (1h), prune (6h), WAL checkpoint (10m)
72
+ - Relevance decay: 1%/day, auto-prune below 0.05
73
+ - Stream dedup: (streamType, eventId) unique index
74
+ - Strategy versioning: auto-increment on update
75
+ - Path traversal protection: sanitized path segments (alphanumeric + dash/underscore/dot only)
76
+ - Hermes bridge: auto-detected, read-only, FTS5 with LIKE fallback
77
+ - Server lifecycle: init+start on boot, stop+close on shutdown
78
+
79
+ ### Added — Quick Context Auto-Update
80
+
81
+ `sap_quick_context` now accepts `agentKnownVersion`:
82
+ - When omitted (first bootstrap): `skillsUpdateRequired=true`, `skillsContents` populated with full SKILL.md inline
83
+ - When ≠ server version: `skillsUpdateRequired=true`, skills contents included
84
+ - When == server version: `skillsUpdateRequired=false` (token savings)
85
+
86
+ Also returns `serverCommit` (git short hash), `environment` (network, mode, authType, rateLimitPerMinute), and `recommendedFlow` (mode-specific workflow guidance).
87
+
88
+ ### Added — Wizard Directory Creation
89
+
90
+ `ensureConfigDirectories()` now creates `~/.config/mcp-sap/memory/` and `~/.config/mcp-sap/strategies/` with private permissions (mode 0o700) alongside the existing config, keypair, data, log, and cache directories.
91
+
92
+ ### Security
93
+
94
+ - Path traversal protection on all strategy store operations (`sanitizePathSegment`)
95
+ - All SQL queries use parameterized prepared statements (no string interpolation)
96
+ - Hermes bridge opens read-only connections only
97
+ - Memory database is local-only — no network access
98
+ - No secrets, private keys, or keypair bytes stored in the memory DB
99
+ - 0 dependency vulnerabilities (`pnpm audit`)
100
+ - `createRequire` used instead of `require()` to satisfy ESLint
101
+
102
+ ## 0.9.22 - 2026-07-25
103
+
104
+ ### Added
105
+
106
+ - **`signerProfile` per-call parameter** on `sap_payments_finalize_transaction`.
107
+ Agents can now sign with a specific profile without switching `.active-profile`
108
+ manually. Multiple profiles coexist in the same session. Eliminates the #1
109
+ source of agent friction: profile-switch juggling + stale signer cache.
110
+ - **`sap_build_sol_transfer`** — Hosted unsigned builder for native SOL transfers
111
+ using `SystemProgram.transfer`. Fills the gap left by `spl-token_transferSol`
112
+ (local-signer-only). Returns base64 unsigned transaction for local signing.
113
+ - **`sap_build_spl_transfer`** — Hosted unsigned builder for SPL token transfers
114
+ with idempotent ATA creation. Uses raw `@solana/web3.js` `TransactionInstruction`
115
+ (no `@solana/spl-token` dependency). Returns base64 unsigned transaction.
116
+ - **x402 idempotency cache** in `McpMonetizationGate` — prevents double-charge on
117
+ retry. Successful settlements are cached by `requestHash` for 5 minutes
118
+ (max 10,000 entries, LRU eviction, opportunistic pruning). If the same
119
+ request is retried after a network failure, the cached settlement is returned
120
+ without re-charging the payer's USDC.
121
+ - **x402 nonce + TTL strict validation** — `validatePaymentRequirementsForDecision`
122
+ now enforces `maxTimeoutSeconds ≤ 120` and rejects invalid/missing TTL values.
123
+ Prevents stale challenge replay attacks.
124
+ - **Challenge-signature parameter** on `sap_profile_switch` — optional Ed25519
125
+ signature proving ownership of the target profile keypair. Prevents
126
+ impersonation via manual `.active-profile` file edits.
127
+ - **`preloadPremiumProviders`** at server startup — providers are eagerly loaded
128
+ and connected when the server boots, not lazily on first request. The
129
+ `providerHealth` response now reflects real provider status immediately.
130
+ - **3 new free meme-radar providers** (DexScreener + Solana RPC, no API keys):
131
+ - `meme.newlisting.alert` — detects newly listed tokens via DexScreener
132
+ `pairCreatedAt` with honeypot/dev-wallet risk flags.
133
+ - `meme.rugpull.detector` — on-chain mint/freeze authority checks via Solana
134
+ RPC + DexScreener liquidity drain detection. Risk score 0-1 with
135
+ exit/monitor/caution actions.
136
+ - `meme.social.sentiment` — bull/bear scores from DexScreener price momentum
137
+ (1h/6h/24h weighted) with volume acceleration confidence.
138
+ - **Multi-feed Pyth** — `pyth.price.tick` and `pyth.volatility.watch` now poll
139
+ 5 feeds by default (SOL/USD, WBTC/USD, WETH/USD, JUP/USD, USDC/USD) instead
140
+ of 1. All Pyth providers converted from WebSocket to HTTP polling
141
+ (`hermes.pyth.network/v2/updates/price/latest`).
142
+ - **`signalConfidence` field** on Pyth price tick events — normalized 0-1
143
+ confidence score derived from `1 - (confidenceInterval / price)`, separate
144
+ from the raw Pyth `confidenceIntervalUsd`.
145
+ - **ATR-based SL/TP** for volatility breakout signals — `stopLoss = entry ∓
146
+ 2×ATR`, `takeProfit = entry ± 3×ATR`, with `minSpreadPct` filter (0.1%)
147
+ to discard signals too tight for on-chain execution. `action` changed from
148
+ `sell` to `swap` for spot-only agents.
149
+ - **Applied filters in webhook relay response** — `sap_premium_webhook_relay`
150
+ now returns `subscribedEvents` and `appliedFilters` in the subscription
151
+ response for agent verification.
152
+ - **`sap-mcp-optimization` skill** (devops category) — documents pre-estimate,
153
+ profile routing, build→sign→submit, x402 payment rules, readiness checks,
154
+ budget management, and premium stream consumption patterns.
155
+ - Tool count: 317 → 319. Test count: 603 (unchanged, all updated).
156
+
157
+ ### Changed
158
+
159
+ - **Premium capability prices halved** — all 13 premium capabilities now cost
160
+ 50% less per unit/event:
161
+ - `jupiter.quote.delta`: $0.02 → $0.01/min
162
+ - `pyth.price.tick`: $0.015 → $0.0075/min
163
+ - `price.threshold.crossed`: $0.001 → $0.0005/event
164
+ - `jupiter.arbitrage.scan`: $0.05 → $0.025/min
165
+ - `pyth.volatility.watch`: $0.03 → $0.015/min
166
+ - `jupiter.route.optimized`: $0.025 → $0.0125/min
167
+ - `meme.newlisting.alert`: $0.003 → $0.0015/event
168
+ - `meme.social.sentiment`: $0.02 → $0.01/min
169
+ - `meme.rugpull.detector`: $0.04 → $0.02/min
170
+ - `meme.volume.spike`: $0.025 → $0.0125/min
171
+ - `tech.github.activity`: $0.002 → $0.001/event
172
+ - `tech.tvl.change`: $0.02 → $0.01/min
173
+ - `tech.tokenomics.analysis`: $0.004 → $0.002/event
174
+ - **Heavy value-action price**: $0.15 → $0.05 (max accepted x402 for
175
+ value-action tier tools).
176
+ - **Auto-pay threshold**: $0.02 → $0.05 (`SAP_MCP_X402_AUTO_PAY_MAX_USD`).
177
+ Read-premium ($0.001) and builder ($0.008) calls now auto-pay without
178
+ confirmation.
179
+ - **Premium poll/flush/metrics FREE** — `sap_premium_stream_poll`,
180
+ `sap_premium_stream_flush`, `sap_premium_webhook_relay_status`,
181
+ `sap_premium_metrics`, `sap_premium_session_status`, `sap_premium_close_session`
182
+ moved to FREE_TOOLS + STRICT_FREE_TOOLS. No x402 charge for consumption
183
+ or diagnostics.
184
+ - **Birdeye dependency removed** — all meme-radar capabilities now use
185
+ DexScreener + Solana RPC (both free, no API key). `SAP_MCP_PREMIUM_BIRDEYE_API_URL`
186
+ removed from all capability definitions and test fixtures.
187
+ - **Builder tool descriptions** now mention `sap_payments_finalize_transaction`
188
+ as the 1-call alternative to the 3-step preview→sign→submit flow.
189
+ - **`sap_estimate_tool_cost`** description now explicitly says "dry-run — no
190
+ charge, no x402 challenge" and includes `maxPriceUsd = estimate × 1.25`
191
+ guidance.
192
+ - **`sap_quick_context` nextAction** now includes explicit routing guidance:
193
+ accountless hosted → use `sap_payments_profile_current`, `signerProfile`
194
+ per-call, `sap_build_sol_transfer`/`sap_build_spl_transfer`, no signing scripts.
195
+
196
+ ### Fixed
197
+
198
+ - **Bridge cache coherence** — `sap_payments_profile_current` now re-reads
199
+ `.active-profile` and re-resolves the signer on every call. No more stale
200
+ signer after manual profile switch.
201
+ - **`sap_profile_switch` guidance** — when the hosted server is accountless,
202
+ the response now provides 3 concrete options (local bridge, manual edit,
203
+ CLI command) instead of a bare "Profile does not exist" error. Includes
204
+ stale cache warning.
205
+ - **Provider preload at startup** — providers are loaded and connected when
206
+ the server boots, not on first request. `providerHealth` is populated
207
+ immediately, not empty `{}`.
208
+ - **Provider delivery loop logging** — all `catch` blocks in provider-bridge,
209
+ webhook-engine, premium-tools, and premium-routes now log errors to stderr
210
+ instead of swallowing silently.
211
+ - **Meme volume spike provider** — replaced nonexistent DexScreener
212
+ `/v1/solana/volume` endpoint with real API (`/latest/dex/tokens/{mint}` and
213
+ `/latest/dex/search`). Added `activeMints` tracking, EMA baseline spike
214
+ detection, `MAX_MINTS_PER_POLL` limit.
215
+ - **Pyth providers** — converted from WebSocket (`wss://hermes.pyth.network/v2/ws`,
216
+ rejects bare connections) to HTTP polling (`/v2/updates/price/latest`).
217
+ - **All 12 provider import paths** — fixed `../../types.js` → `../types.js`.
218
+ - **`onchain.solana.ts`** — imported `ConfirmedSignatureInfo` from
219
+ `@solana/web3.js` to fix `blockTime: number | null | undefined` type mismatch.
220
+ - **Stale config references** — cleaned up all `0.02` auto-pay and `0.15`
221
+ heavy value refs in `.env.example`, `config.example.json`,
222
+ `config.secure-example.json`, `schema.json`, `mcp-client-injection.ts`, and
223
+ `explain-x402-settlement.prompt.ts`.
224
+
225
+ ### Security
226
+
227
+ - x402 idempotency cache prevents double-charge on retry (point 2c).
228
+ - x402 nonce + TTL strict validation caps challenge lifetime at 120s (point 5b).
229
+ - Challenge-signature parameter on profile switch prevents impersonation (point 5a).
230
+ - `secretMaterial: keypair-bytes-never-returned` guarantee maintained across
231
+ all signing tools.
232
+ - No secrets, private keys, or keypair bytes in source code (security audit clean).
233
+ - 0 dependency vulnerabilities (`pnpm audit`).
234
+
5
235
  ## 0.9.21 - 2026-07-25
6
236
 
7
237
  ### Added
@@ -45,7 +275,7 @@ All notable changes to this project are documented in this file.
45
275
 
46
276
  ### Added
47
277
 
48
- - Added 10 new MCP tools for perpetual futures trading and chart analysis:
278
+ - Added MCP tools for perpetual futures market analytics and chart analysis:
49
279
  - `sap_perp_markets` — List Adrena perp markets with mark price, funding, OI.
50
280
  - `sap_perp_position_info` — Read on-chain Adrena perp positions for a wallet.
51
281
  - `sap_perp_funding_history` — Historical funding rates from Adrena API.
@@ -53,11 +283,8 @@ All notable changes to this project are documented in this file.
53
283
  - `sap_chart_long_term` — Long-term price history + protocol TVL (DexScreener + DeFiLlama).
54
284
  - `sap_chart_volume_profile` — Volume profile analysis with POC, VAH, VAL.
55
285
  - `sap_perp_liquidation_zones` — Compute liquidation zones for open positions.
56
- - `sap_perp_build_open` Build unsigned tx to open leveraged perp position (Adrena).
57
- - `sap_perp_build_close` Build unsigned tx to close a perp position.
58
- - `sap_perp_build_modify` — Build unsigned tx to add/remove collateral.
59
- - All 10 tools use only free APIs (DexScreener, DeFiLlama, Adrena REST, Solana RPC).
60
- - Inscribed tools (`sap_perp_build_*`) return unsigned transactions for local agent signing.
286
+ - Execution builders were later removed from the public surface until IDL-backed, locally finalizable
287
+ perps transactions can meet the SAP MCP signing and safety bar.
61
288
 
62
289
  ### Removed
63
290
 
package/README.md CHANGED
@@ -15,7 +15,7 @@ User-facing setup docs live in [`USER_DOCS/`](USER_DOCS/00_START_HERE.md). Opera
15
15
 
16
16
  | Area | Current behavior |
17
17
  | --- | --- |
18
- | Package version | `0.9.21` |
18
+ | Package version | `0.9.35` |
19
19
  | MCP transport | stdio locally, Streamable HTTP remotely |
20
20
  | Remote access | Bearerless public mode for hosted agents; API key or JWT for private modes |
21
21
  | Config directory | `~/.config/mcp-sap` only |
@@ -134,7 +134,7 @@ For paid/write hosted tools, add the local non-custodial payment bridge as well:
134
134
  ```toml
135
135
  [mcp_servers.sap_payments]
136
136
  command = "npx"
137
- args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"]
137
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"]
138
138
  startup_timeout_sec = 300
139
139
  tool_timeout_sec = 300
140
140
 
@@ -152,7 +152,7 @@ Codex supports Streamable HTTP MCP servers with URL-based entries in `config.tom
152
152
  ```toml
153
153
  [mcp_servers.sap]
154
154
  command = "npx"
155
- args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"]
155
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"]
156
156
 
157
157
  [mcp_servers.sap.env]
158
158
  SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE = "false"
@@ -71,7 +71,14 @@ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config re
71
71
  9. For registrations, check `success`, `agentRegistered`, `agentPda`, `protocolFee`, and `protocolComplete`. Local registration does not pay a hosted x402 fee. `success: true` means the agent account exists and the source-level protocol fee invariant was verified. If `success: false` with `agentRegistered: true`, the account may exist but SAP registration is not protocol-complete.
72
72
  10. Use `sap_payments_finalize_transaction` when a paid hosted builder returns an unsigned transaction to preview, sign locally, and optionally submit already-signed bytes through the hosted OOBE relay.
73
73
  11. Use `sap_agent_runtime_status` when asking an agent whether SAP MCP is connected or ready for paid/write work. It returns the hosted/local bridge routing truth without reading local files.
74
- 12. Use `sap_pricing_catalog` or `https://mcp.sap.oobeprotocol.ai/pricing.json` to inspect generated hosted pricing tiers. The x402 challenge returned by a paid tool remains the final payment source of truth.
74
+ 12. Use `sap_prepare_action` before swaps, registry writes, identity updates, Escrow V2, external x402 calls, premium streams, or transaction finalization. It returns fresh-data requirements, the correct hosted/local route, confirmation policy, retry rules, and proof-tape fields without charging x402.
75
+ 13. Use `sap_pricing_catalog` or `https://mcp.sap.oobeprotocol.ai/pricing.json` to inspect generated hosted pricing tiers. The x402 challenge returned by a paid tool remains the final payment source of truth.
76
+
77
+ Session memory is for operational context and audit: active profile name after
78
+ readiness, public wallet keys, runtime namespace availability, x402 receipts,
79
+ submitted signatures, final statuses, and error classifications. Do not use
80
+ memory as cached truth for balances, token prices, Jupiter quotes/orders,
81
+ blockhashes, simulations, liquidity/routes, SNS ownership, or SAP account state.
75
82
 
76
83
  Agent identity, profile images, Metaplex bridging, SNS linking, capabilities,
77
84
  pricing, and update fields are documented in:
@@ -87,6 +94,7 @@ server exposes these free maintenance tools:
87
94
  | --- | --- |
88
95
  | `sap_agent_start` | Load the canonical startup playbook. |
89
96
  | `sap_agent_runtime_status` | Free runtime truth table for hosted connection, local `sap_payments` readiness expectations, write routing, forbidden actions, and next tool calls. |
97
+ | `sap_prepare_action` | Free intent-level planner for paid calls, writes, swaps, escrow, external x402, premium streams, confirmation policy, retry rules, and proof-tape shape. |
90
98
  | `sap_pricing_catalog` | Free machine-readable pricing catalog generated from the hosted pricing registry. Also available at `/pricing.json`. |
91
99
  | `sap_protocol_invariants` | Return the canonical SAP program id, protocol treasury, registration fee, hosted/local routing rules, and forbidden actions. |
92
100
  | `sap_agent_identity_plan` | Free planner for SAP registration, image/profile updates, Metaplex identity, SNS linking, and verification. |
@@ -29,7 +29,7 @@ Public `server.json` shape:
29
29
  "name": "sap-mcp-server",
30
30
  "title": "SAP MCP Server | OOBE Protocol",
31
31
  "description": "Hosted Solana-native MCP gateway for Synapse Agent Protocol tools, x402/pay.sh monetization, SNS identity, and agent operations.",
32
- "version": "0.9.21",
32
+ "version": "0.9.35",
33
33
  "status": "online",
34
34
  "protocol": {
35
35
  "primary": "mcp",
@@ -45,7 +45,7 @@ url = "https://mcp.sap.oobeprotocol.ai/mcp"
45
45
 
46
46
  [mcp_servers.sap_payments]
47
47
  command = "npx.cmd"
48
- args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"]
48
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"]
49
49
  startup_timeout_sec = 300
50
50
  tool_timeout_sec = 300
51
51
 
@@ -65,7 +65,7 @@ the complete local stdio SAP MCP process instead of using the hosted endpoint, u
65
65
  ```toml
66
66
  [mcp_servers.sap]
67
67
  command = "npx.cmd"
68
- args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"]
68
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"]
69
69
 
70
70
  [mcp_servers.sap.env]
71
71
  SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE = "false"
@@ -201,7 +201,7 @@ For Claude Code, use the official MCP CLI pattern:
201
201
 
202
202
  ```bash
203
203
  claude mcp add --transport http sap https://mcp.sap.oobeprotocol.ai/mcp
204
- claude mcp add --transport stdio sap_payments -- npx --yes --package @oobe-protocol-labs/sap-mcp-server@0.9.21 sap-mcp-server
204
+ claude mcp add --transport stdio sap_payments -- npx --yes --package @oobe-protocol-labs/sap-mcp-server@0.9.35 sap-mcp-server
205
205
  ```
206
206
 
207
207
  Set `SAP_MCP_PAYMENTS_BRIDGE_ONLY=true` and `SAP_ALLOWED_TOOLS=all` in the
@@ -106,7 +106,7 @@ url = "https://mcp.sap.oobeprotocol.ai/mcp"
106
106
 
107
107
  [mcp_servers.sap_payments]
108
108
  command = "npx"
109
- args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"]
109
+ args = ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"]
110
110
  startup_timeout_sec = 300
111
111
  tool_timeout_sec = 300
112
112
 
@@ -138,7 +138,7 @@ Claude Desktop uses a root `mcpServers` JSON object:
138
138
  },
139
139
  "sap_payments": {
140
140
  "command": "npx",
141
- "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"],
141
+ "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"],
142
142
  "env": {
143
143
  "SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE": "false",
144
144
  "SAP_MCP_PAYMENTS_BRIDGE_ONLY": "true",
@@ -170,7 +170,7 @@ Hermes global `mcp.json` uses flat server entries:
170
170
  },
171
171
  "sap_payments": {
172
172
  "command": "npx",
173
- "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"],
173
+ "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"],
174
174
  "env": {
175
175
  "SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE": "false",
176
176
  "SAP_MCP_PAYMENTS_BRIDGE_ONLY": "true",
@@ -193,7 +193,7 @@ mcp_servers:
193
193
  args:
194
194
  - "--yes"
195
195
  - "--package"
196
- - "@oobe-protocol-labs/sap-mcp-server@0.9.21"
196
+ - "@oobe-protocol-labs/sap-mcp-server@0.9.35"
197
197
  - "sap-mcp-server"
198
198
  env:
199
199
  SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE: "false"
@@ -215,7 +215,7 @@ OpenClaw MCP JSON uses the same root `mcpServers` structure as generic MCP clien
215
215
  },
216
216
  "sap_payments": {
217
217
  "command": "npx",
218
- "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.21", "sap-mcp-server"],
218
+ "args": ["--yes", "--package", "@oobe-protocol-labs/sap-mcp-server@0.9.35", "sap-mcp-server"],
219
219
  "env": {
220
220
  "SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE": "false",
221
221
  "SAP_MCP_PAYMENTS_BRIDGE_ONLY": "true",
@@ -56,7 +56,7 @@
56
56
  "readPremiumUsd": 0.001,
57
57
  "builderUsd": 0.008,
58
58
  "valueFixedUsd": 0.09,
59
- "heavyValueUsd": 0.15,
59
+ "heavyValueUsd": 0.05,
60
60
  "valueBps": 0,
61
61
  "minUsd": 0.001,
62
62
  "maxUsd": 100
@@ -59,7 +59,7 @@
59
59
  "readPremiumUsd": 0.001,
60
60
  "builderUsd": 0.008,
61
61
  "valueFixedUsd": 0.09,
62
- "heavyValueUsd": 0.15,
62
+ "heavyValueUsd": 0.05,
63
63
  "valueBps": 0,
64
64
  "minUsd": 0.001,
65
65
  "maxUsd": 100
@@ -47,6 +47,10 @@ export declare const envSchema: z.ZodObject<{
47
47
  SAP_CACHE_TTL_SECONDS: z.ZodDefault<z.ZodNumber>;
48
48
  SAP_ENABLE_RATE_LIMIT: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
49
49
  SAP_RATE_LIMIT_PER_MINUTE: z.ZodDefault<z.ZodNumber>;
50
+ SAP_MCP_JUPITER_API_BASE_URL: z.ZodDefault<z.ZodString>;
51
+ SAP_MCP_JUPITER_TOKENS_API_BASE_URL: z.ZodOptional<z.ZodString>;
52
+ SAP_MCP_JUPITER_API_KEY: z.ZodOptional<z.ZodString>;
53
+ SAP_MCP_JUPITER_TIMEOUT_MS: z.ZodDefault<z.ZodNumber>;
50
54
  SAP_MCP_MONETIZATION_ENABLED: z.ZodDefault<z.ZodEffects<z.ZodBoolean, boolean, unknown>>;
51
55
  SAP_MCP_MONETIZATION_PROVIDER: z.ZodDefault<z.ZodEnum<["x402", "pay-sh"]>>;
52
56
  SAP_MCP_MONETIZATION_PAY_TO: z.ZodOptional<z.ZodString>;
@@ -87,6 +91,8 @@ export declare const envSchema: z.ZodObject<{
87
91
  SAP_CACHE_TTL_SECONDS: number;
88
92
  SAP_ENABLE_RATE_LIMIT: boolean;
89
93
  SAP_RATE_LIMIT_PER_MINUTE: number;
94
+ SAP_MCP_JUPITER_API_BASE_URL: string;
95
+ SAP_MCP_JUPITER_TIMEOUT_MS: number;
90
96
  SAP_MCP_MONETIZATION_ENABLED: boolean;
91
97
  SAP_MCP_MONETIZATION_PROVIDER: "x402" | "pay-sh";
92
98
  SAP_MCP_X402_MAX_TIMEOUT_SECONDS: number;
@@ -109,6 +115,8 @@ export declare const envSchema: z.ZodObject<{
109
115
  SAP_HTTP_CORS_ORIGINS?: string | undefined;
110
116
  SAP_ALLOWED_TOOLS?: string | undefined;
111
117
  SAP_LOG_FILE?: string | undefined;
118
+ SAP_MCP_JUPITER_TOKENS_API_BASE_URL?: string | undefined;
119
+ SAP_MCP_JUPITER_API_KEY?: string | undefined;
112
120
  SAP_MCP_MONETIZATION_PAY_TO?: string | undefined;
113
121
  SAP_MCP_MONETIZATION_NETWORK?: string | undefined;
114
122
  SAP_MCP_X402_FACILITATOR_URL?: string | undefined;
@@ -149,6 +157,10 @@ export declare const envSchema: z.ZodObject<{
149
157
  SAP_CACHE_TTL_SECONDS?: number | undefined;
150
158
  SAP_ENABLE_RATE_LIMIT?: unknown;
151
159
  SAP_RATE_LIMIT_PER_MINUTE?: number | undefined;
160
+ SAP_MCP_JUPITER_API_BASE_URL?: string | undefined;
161
+ SAP_MCP_JUPITER_TOKENS_API_BASE_URL?: string | undefined;
162
+ SAP_MCP_JUPITER_API_KEY?: string | undefined;
163
+ SAP_MCP_JUPITER_TIMEOUT_MS?: number | undefined;
152
164
  SAP_MCP_MONETIZATION_ENABLED?: unknown;
153
165
  SAP_MCP_MONETIZATION_PROVIDER?: "x402" | "pay-sh" | undefined;
154
166
  SAP_MCP_MONETIZATION_PAY_TO?: string | undefined;
@@ -205,6 +217,12 @@ export interface SapMcpConfig {
205
217
  cacheTtlSeconds: number;
206
218
  enableRateLimit: boolean;
207
219
  rateLimitPerMinute: number;
220
+ jupiter: {
221
+ apiBaseUrl: string;
222
+ tokensApiBaseUrl?: string;
223
+ apiKeyConfigured: boolean;
224
+ timeoutMs: number;
225
+ };
208
226
  bento?: {
209
227
  enabled: boolean;
210
228
  apiKey?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyDxB;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0EpB,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAMrD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAA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AAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAmCD;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAMD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,YAAY,CAqC5D;AAmXD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAQ9D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA+BhG"}
@@ -102,6 +102,12 @@ export const envSchema = z.object({
102
102
  SAP_CACHE_TTL_SECONDS: z.coerce.number().positive().default(300),
103
103
  SAP_ENABLE_RATE_LIMIT: booleanEnvSchema.default(true),
104
104
  SAP_RATE_LIMIT_PER_MINUTE: z.coerce.number().positive().default(60),
105
+ // Hosted gateway provider keys. These are server-side only and must never be
106
+ // written into client MCP configs, public metadata, or tool responses.
107
+ SAP_MCP_JUPITER_API_BASE_URL: z.string().url().default('https://api.jup.ag'),
108
+ SAP_MCP_JUPITER_TOKENS_API_BASE_URL: z.string().url().optional(),
109
+ SAP_MCP_JUPITER_API_KEY: z.string().optional(),
110
+ SAP_MCP_JUPITER_TIMEOUT_MS: z.coerce.number().positive().default(30000),
105
111
  // Remote MCP monetization. Applies only when explicitly enabled by hosted HTTP deployments.
106
112
  SAP_MCP_MONETIZATION_ENABLED: booleanEnvSchema.default(false),
107
113
  SAP_MCP_MONETIZATION_PROVIDER: monetizationProviderSchema.default('x402'),
@@ -115,7 +121,7 @@ export const envSchema = z.object({
115
121
  SAP_MCP_PRICE_READ_PREMIUM_USD: z.coerce.number().positive().default(0.001),
116
122
  SAP_MCP_PRICE_BUILDER_USD: z.coerce.number().positive().default(0.008),
117
123
  SAP_MCP_PRICE_VALUE_FIXED_USD: z.coerce.number().nonnegative().default(0.09),
118
- SAP_MCP_PRICE_HEAVY_VALUE_USD: z.coerce.number().nonnegative().default(0.15),
124
+ SAP_MCP_PRICE_HEAVY_VALUE_USD: z.coerce.number().nonnegative().default(0.05),
119
125
  SAP_MCP_PRICE_VALUE_BPS: z.coerce.number().nonnegative().default(0),
120
126
  SAP_MCP_PRICE_MIN_USD: z.coerce.number().nonnegative().default(0.001),
121
127
  SAP_MCP_PRICE_MAX_USD: z.coerce.number().positive().default(100),
@@ -442,7 +448,7 @@ function getDefaultEnvConfig() {
442
448
  SAP_MCP_PRICE_READ_PREMIUM_USD: 0.001,
443
449
  SAP_MCP_PRICE_BUILDER_USD: 0.008,
444
450
  SAP_MCP_PRICE_VALUE_FIXED_USD: 0.09,
445
- SAP_MCP_PRICE_HEAVY_VALUE_USD: 0.15,
451
+ SAP_MCP_PRICE_HEAVY_VALUE_USD: 0.05,
446
452
  SAP_MCP_PRICE_VALUE_BPS: 0,
447
453
  SAP_MCP_PRICE_MIN_USD: 0.001,
448
454
  SAP_MCP_PRICE_MAX_USD: 100,
@@ -499,6 +505,12 @@ function transformToRuntimeConfig(env, fileConfig = {}) {
499
505
  cacheTtlSeconds: env.SAP_CACHE_TTL_SECONDS,
500
506
  enableRateLimit: env.SAP_ENABLE_RATE_LIMIT,
501
507
  rateLimitPerMinute: env.SAP_RATE_LIMIT_PER_MINUTE,
508
+ jupiter: {
509
+ apiBaseUrl: env.SAP_MCP_JUPITER_API_BASE_URL,
510
+ tokensApiBaseUrl: env.SAP_MCP_JUPITER_TOKENS_API_BASE_URL,
511
+ apiKeyConfigured: Boolean(env.SAP_MCP_JUPITER_API_KEY?.trim()),
512
+ timeoutMs: env.SAP_MCP_JUPITER_TIMEOUT_MS,
513
+ },
502
514
  bento: {
503
515
  enabled: effectiveBentoEnabled,
504
516
  apiKey: process.env.SAP_MCP_BENTO_API_KEY || asOptionalString(bentoConfig.apiKey),