@oobe-protocol-labs/sap-mcp-server 0.1.0

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 (593) hide show
  1. package/.env.example +159 -0
  2. package/CHANGELOG.md +55 -0
  3. package/LICENSE +21 -0
  4. package/README.md +223 -0
  5. package/config.example.json +64 -0
  6. package/config.schema.json +370 -0
  7. package/config.secure-example.json +100 -0
  8. package/dist/adapters/index.d.ts +6 -0
  9. package/dist/adapters/index.d.ts.map +1 -0
  10. package/dist/adapters/index.js +6 -0
  11. package/dist/adapters/index.js.map +1 -0
  12. package/dist/adapters/mcp/errors.d.ts +7 -0
  13. package/dist/adapters/mcp/errors.d.ts.map +1 -0
  14. package/dist/adapters/mcp/errors.js +10 -0
  15. package/dist/adapters/mcp/errors.js.map +1 -0
  16. package/dist/adapters/mcp/index.d.ts +8 -0
  17. package/dist/adapters/mcp/index.d.ts.map +1 -0
  18. package/dist/adapters/mcp/index.js +8 -0
  19. package/dist/adapters/mcp/index.js.map +1 -0
  20. package/dist/adapters/mcp/prompt-response.d.ts +13 -0
  21. package/dist/adapters/mcp/prompt-response.d.ts.map +1 -0
  22. package/dist/adapters/mcp/prompt-response.js +7 -0
  23. package/dist/adapters/mcp/prompt-response.js.map +1 -0
  24. package/dist/adapters/mcp/resource-response.d.ts +8 -0
  25. package/dist/adapters/mcp/resource-response.d.ts.map +1 -0
  26. package/dist/adapters/mcp/resource-response.js +7 -0
  27. package/dist/adapters/mcp/resource-response.js.map +1 -0
  28. package/dist/adapters/mcp/sdk-compat.d.ts +191 -0
  29. package/dist/adapters/mcp/sdk-compat.d.ts.map +1 -0
  30. package/dist/adapters/mcp/sdk-compat.js +606 -0
  31. package/dist/adapters/mcp/sdk-compat.js.map +1 -0
  32. package/dist/adapters/mcp/tool-response.d.ts +32 -0
  33. package/dist/adapters/mcp/tool-response.d.ts.map +1 -0
  34. package/dist/adapters/mcp/tool-response.js +27 -0
  35. package/dist/adapters/mcp/tool-response.js.map +1 -0
  36. package/dist/adapters/solana/commitment.d.ts +9 -0
  37. package/dist/adapters/solana/commitment.d.ts.map +1 -0
  38. package/dist/adapters/solana/commitment.js +14 -0
  39. package/dist/adapters/solana/commitment.js.map +1 -0
  40. package/dist/adapters/solana/connection.d.ts +10 -0
  41. package/dist/adapters/solana/connection.d.ts.map +1 -0
  42. package/dist/adapters/solana/connection.js +13 -0
  43. package/dist/adapters/solana/connection.js.map +1 -0
  44. package/dist/adapters/solana/index.d.ts +7 -0
  45. package/dist/adapters/solana/index.d.ts.map +1 -0
  46. package/dist/adapters/solana/index.js +7 -0
  47. package/dist/adapters/solana/index.js.map +1 -0
  48. package/dist/adapters/solana/public-key.d.ts +9 -0
  49. package/dist/adapters/solana/public-key.d.ts.map +1 -0
  50. package/dist/adapters/solana/public-key.js +11 -0
  51. package/dist/adapters/solana/public-key.js.map +1 -0
  52. package/dist/cli.d.ts +29 -0
  53. package/dist/cli.d.ts.map +1 -0
  54. package/dist/cli.js +269 -0
  55. package/dist/cli.js.map +1 -0
  56. package/dist/config/defaults.d.ts +28 -0
  57. package/dist/config/defaults.d.ts.map +1 -0
  58. package/dist/config/defaults.js +28 -0
  59. package/dist/config/defaults.js.map +1 -0
  60. package/dist/config/env.d.ts +297 -0
  61. package/dist/config/env.d.ts.map +1 -0
  62. package/dist/config/env.js +563 -0
  63. package/dist/config/env.js.map +1 -0
  64. package/dist/config/index.d.ts +7 -0
  65. package/dist/config/index.d.ts.map +1 -0
  66. package/dist/config/index.js +7 -0
  67. package/dist/config/index.js.map +1 -0
  68. package/dist/config/mcp-client-injection.d.ts +113 -0
  69. package/dist/config/mcp-client-injection.d.ts.map +1 -0
  70. package/dist/config/mcp-client-injection.js +453 -0
  71. package/dist/config/mcp-client-injection.js.map +1 -0
  72. package/dist/config/paths.d.ts +37 -0
  73. package/dist/config/paths.d.ts.map +1 -0
  74. package/dist/config/paths.js +93 -0
  75. package/dist/config/paths.js.map +1 -0
  76. package/dist/config/profiles.d.ts +85 -0
  77. package/dist/config/profiles.d.ts.map +1 -0
  78. package/dist/config/profiles.js +346 -0
  79. package/dist/config/profiles.js.map +1 -0
  80. package/dist/config/schema.d.ts +9 -0
  81. package/dist/config/schema.d.ts.map +1 -0
  82. package/dist/config/schema.js +8 -0
  83. package/dist/config/schema.js.map +1 -0
  84. package/dist/config/secure-config.d.ts +607 -0
  85. package/dist/config/secure-config.d.ts.map +1 -0
  86. package/dist/config/secure-config.js +526 -0
  87. package/dist/config/secure-config.js.map +1 -0
  88. package/dist/config/setup.d.ts +42 -0
  89. package/dist/config/setup.d.ts.map +1 -0
  90. package/dist/config/setup.js +173 -0
  91. package/dist/config/setup.js.map +1 -0
  92. package/dist/config/wizard.d.ts +15 -0
  93. package/dist/config/wizard.d.ts.map +1 -0
  94. package/dist/config/wizard.js +1176 -0
  95. package/dist/config/wizard.js.map +1 -0
  96. package/dist/config-cli.d.ts +21 -0
  97. package/dist/config-cli.d.ts.map +1 -0
  98. package/dist/config-cli.js +679 -0
  99. package/dist/config-cli.js.map +1 -0
  100. package/dist/core/constants.d.ts +78 -0
  101. package/dist/core/constants.d.ts.map +1 -0
  102. package/dist/core/constants.js +78 -0
  103. package/dist/core/constants.js.map +1 -0
  104. package/dist/core/errors.d.ts +188 -0
  105. package/dist/core/errors.d.ts.map +1 -0
  106. package/dist/core/errors.js +337 -0
  107. package/dist/core/errors.js.map +1 -0
  108. package/dist/core/guards.d.ts +41 -0
  109. package/dist/core/guards.d.ts.map +1 -0
  110. package/dist/core/guards.js +93 -0
  111. package/dist/core/guards.js.map +1 -0
  112. package/dist/core/index.d.ts +11 -0
  113. package/dist/core/index.d.ts.map +1 -0
  114. package/dist/core/index.js +10 -0
  115. package/dist/core/index.js.map +1 -0
  116. package/dist/core/logger.d.ts +64 -0
  117. package/dist/core/logger.d.ts.map +1 -0
  118. package/dist/core/logger.js +159 -0
  119. package/dist/core/logger.js.map +1 -0
  120. package/dist/core/result.d.ts +49 -0
  121. package/dist/core/result.d.ts.map +1 -0
  122. package/dist/core/result.js +61 -0
  123. package/dist/core/result.js.map +1 -0
  124. package/dist/core/types.d.ts +147 -0
  125. package/dist/core/types.d.ts.map +1 -0
  126. package/dist/core/types.js +8 -0
  127. package/dist/core/types.js.map +1 -0
  128. package/dist/index.d.ts +18 -0
  129. package/dist/index.d.ts.map +1 -0
  130. package/dist/index.js +15 -0
  131. package/dist/index.js.map +1 -0
  132. package/dist/payments/http-adapter.d.ts +76 -0
  133. package/dist/payments/http-adapter.d.ts.map +1 -0
  134. package/dist/payments/http-adapter.js +126 -0
  135. package/dist/payments/http-adapter.js.map +1 -0
  136. package/dist/payments/index.d.ts +12 -0
  137. package/dist/payments/index.d.ts.map +1 -0
  138. package/dist/payments/index.js +9 -0
  139. package/dist/payments/index.js.map +1 -0
  140. package/dist/payments/json-rpc.d.ts +49 -0
  141. package/dist/payments/json-rpc.d.ts.map +1 -0
  142. package/dist/payments/json-rpc.js +53 -0
  143. package/dist/payments/json-rpc.js.map +1 -0
  144. package/dist/payments/monetization-gate.d.ts +49 -0
  145. package/dist/payments/monetization-gate.d.ts.map +1 -0
  146. package/dist/payments/monetization-gate.js +398 -0
  147. package/dist/payments/monetization-gate.js.map +1 -0
  148. package/dist/payments/oobe-facilitator-server.d.ts +71 -0
  149. package/dist/payments/oobe-facilitator-server.d.ts.map +1 -0
  150. package/dist/payments/oobe-facilitator-server.js +409 -0
  151. package/dist/payments/oobe-facilitator-server.js.map +1 -0
  152. package/dist/payments/pay-sh-spec.d.ts +44 -0
  153. package/dist/payments/pay-sh-spec.d.ts.map +1 -0
  154. package/dist/payments/pay-sh-spec.js +218 -0
  155. package/dist/payments/pay-sh-spec.js.map +1 -0
  156. package/dist/payments/pricing.d.ts +60 -0
  157. package/dist/payments/pricing.d.ts.map +1 -0
  158. package/dist/payments/pricing.js +272 -0
  159. package/dist/payments/pricing.js.map +1 -0
  160. package/dist/payments/usage-ledger.d.ts +84 -0
  161. package/dist/payments/usage-ledger.d.ts.map +1 -0
  162. package/dist/payments/usage-ledger.js +126 -0
  163. package/dist/payments/usage-ledger.js.map +1 -0
  164. package/dist/policy/bento-policy-engine.d.ts +71 -0
  165. package/dist/policy/bento-policy-engine.d.ts.map +1 -0
  166. package/dist/policy/bento-policy-engine.js +218 -0
  167. package/dist/policy/bento-policy-engine.js.map +1 -0
  168. package/dist/policy/default-policies.d.ts +9 -0
  169. package/dist/policy/default-policies.d.ts.map +1 -0
  170. package/dist/policy/default-policies.js +69 -0
  171. package/dist/policy/default-policies.js.map +1 -0
  172. package/dist/policy/hybrid-policy-engine.d.ts +95 -0
  173. package/dist/policy/hybrid-policy-engine.d.ts.map +1 -0
  174. package/dist/policy/hybrid-policy-engine.js +297 -0
  175. package/dist/policy/hybrid-policy-engine.js.map +1 -0
  176. package/dist/policy/index.d.ts +10 -0
  177. package/dist/policy/index.d.ts.map +1 -0
  178. package/dist/policy/index.js +10 -0
  179. package/dist/policy/index.js.map +1 -0
  180. package/dist/policy/local-policy-engine.d.ts +119 -0
  181. package/dist/policy/local-policy-engine.d.ts.map +1 -0
  182. package/dist/policy/local-policy-engine.js +318 -0
  183. package/dist/policy/local-policy-engine.js.map +1 -0
  184. package/dist/policy/permission-checks.d.ts +19 -0
  185. package/dist/policy/permission-checks.d.ts.map +1 -0
  186. package/dist/policy/permission-checks.js +60 -0
  187. package/dist/policy/permission-checks.js.map +1 -0
  188. package/dist/policy/policy-engine.d.ts +57 -0
  189. package/dist/policy/policy-engine.d.ts.map +1 -0
  190. package/dist/policy/policy-engine.js +162 -0
  191. package/dist/policy/policy-engine.js.map +1 -0
  192. package/dist/policy/policy-types.d.ts +46 -0
  193. package/dist/policy/policy-types.d.ts.map +1 -0
  194. package/dist/policy/policy-types.js +5 -0
  195. package/dist/policy/policy-types.js.map +1 -0
  196. package/dist/policy/risk-level.d.ts +18 -0
  197. package/dist/policy/risk-level.d.ts.map +1 -0
  198. package/dist/policy/risk-level.js +46 -0
  199. package/dist/policy/risk-level.js.map +1 -0
  200. package/dist/policy/spending-limits.d.ts +17 -0
  201. package/dist/policy/spending-limits.d.ts.map +1 -0
  202. package/dist/policy/spending-limits.js +40 -0
  203. package/dist/policy/spending-limits.js.map +1 -0
  204. package/dist/prompts/context/sap-agent-context.prompt.d.ts +64 -0
  205. package/dist/prompts/context/sap-agent-context.prompt.d.ts.map +1 -0
  206. package/dist/prompts/context/sap-agent-context.prompt.js +336 -0
  207. package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -0
  208. package/dist/prompts/developer/debug-sap-error.prompt.d.ts +13 -0
  209. package/dist/prompts/developer/debug-sap-error.prompt.d.ts.map +1 -0
  210. package/dist/prompts/developer/debug-sap-error.prompt.js +78 -0
  211. package/dist/prompts/developer/debug-sap-error.prompt.js.map +1 -0
  212. package/dist/prompts/developer/generate-sap-integration.prompt.d.ts +13 -0
  213. package/dist/prompts/developer/generate-sap-integration.prompt.d.ts.map +1 -0
  214. package/dist/prompts/developer/generate-sap-integration.prompt.js +132 -0
  215. package/dist/prompts/developer/generate-sap-integration.prompt.js.map +1 -0
  216. package/dist/prompts/developer/index.d.ts +6 -0
  217. package/dist/prompts/developer/index.d.ts.map +1 -0
  218. package/dist/prompts/developer/index.js +6 -0
  219. package/dist/prompts/developer/index.js.map +1 -0
  220. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.d.ts +13 -0
  221. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.d.ts.map +1 -0
  222. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js +97 -0
  223. package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js.map +1 -0
  224. package/dist/prompts/execution-proof/index.d.ts +6 -0
  225. package/dist/prompts/execution-proof/index.d.ts.map +1 -0
  226. package/dist/prompts/execution-proof/index.js +6 -0
  227. package/dist/prompts/execution-proof/index.js.map +1 -0
  228. package/dist/prompts/execution-proof/verify-execution-proof.prompt.d.ts +13 -0
  229. package/dist/prompts/execution-proof/verify-execution-proof.prompt.d.ts.map +1 -0
  230. package/dist/prompts/execution-proof/verify-execution-proof.prompt.js +95 -0
  231. package/dist/prompts/execution-proof/verify-execution-proof.prompt.js.map +1 -0
  232. package/dist/prompts/index.d.ts +5 -0
  233. package/dist/prompts/index.d.ts.map +1 -0
  234. package/dist/prompts/index.js +5 -0
  235. package/dist/prompts/index.js.map +1 -0
  236. package/dist/prompts/payments/create-paid-api.prompt.d.ts +13 -0
  237. package/dist/prompts/payments/create-paid-api.prompt.d.ts.map +1 -0
  238. package/dist/prompts/payments/create-paid-api.prompt.js +142 -0
  239. package/dist/prompts/payments/create-paid-api.prompt.js.map +1 -0
  240. package/dist/prompts/payments/explain-x402-settlement.prompt.d.ts +13 -0
  241. package/dist/prompts/payments/explain-x402-settlement.prompt.d.ts.map +1 -0
  242. package/dist/prompts/payments/explain-x402-settlement.prompt.js +83 -0
  243. package/dist/prompts/payments/explain-x402-settlement.prompt.js.map +1 -0
  244. package/dist/prompts/payments/index.d.ts +6 -0
  245. package/dist/prompts/payments/index.d.ts.map +1 -0
  246. package/dist/prompts/payments/index.js +6 -0
  247. package/dist/prompts/payments/index.js.map +1 -0
  248. package/dist/prompts/register-prompts.d.ts +10 -0
  249. package/dist/prompts/register-prompts.d.ts.map +1 -0
  250. package/dist/prompts/register-prompts.js +40 -0
  251. package/dist/prompts/register-prompts.js.map +1 -0
  252. package/dist/prompts/registry/analyze-sap-agent.prompt.d.ts +13 -0
  253. package/dist/prompts/registry/analyze-sap-agent.prompt.d.ts.map +1 -0
  254. package/dist/prompts/registry/analyze-sap-agent.prompt.js +85 -0
  255. package/dist/prompts/registry/analyze-sap-agent.prompt.js.map +1 -0
  256. package/dist/prompts/registry/index.d.ts +6 -0
  257. package/dist/prompts/registry/index.d.ts.map +1 -0
  258. package/dist/prompts/registry/index.js +6 -0
  259. package/dist/prompts/registry/index.js.map +1 -0
  260. package/dist/prompts/registry/register-sap-agent.prompt.d.ts +13 -0
  261. package/dist/prompts/registry/register-sap-agent.prompt.d.ts.map +1 -0
  262. package/dist/prompts/registry/register-sap-agent.prompt.js +152 -0
  263. package/dist/prompts/registry/register-sap-agent.prompt.js.map +1 -0
  264. package/dist/remote/auth/index.d.ts +86 -0
  265. package/dist/remote/auth/index.d.ts.map +1 -0
  266. package/dist/remote/auth/index.js +152 -0
  267. package/dist/remote/auth/index.js.map +1 -0
  268. package/dist/remote/server.d.ts +140 -0
  269. package/dist/remote/server.d.ts.map +1 -0
  270. package/dist/remote/server.js +412 -0
  271. package/dist/remote/server.js.map +1 -0
  272. package/dist/resources/current/sap-current-config.resource.d.ts +30 -0
  273. package/dist/resources/current/sap-current-config.resource.d.ts.map +1 -0
  274. package/dist/resources/current/sap-current-config.resource.js +142 -0
  275. package/dist/resources/current/sap-current-config.resource.js.map +1 -0
  276. package/dist/resources/execution-proof/index.d.ts +5 -0
  277. package/dist/resources/execution-proof/index.d.ts.map +1 -0
  278. package/dist/resources/execution-proof/index.js +5 -0
  279. package/dist/resources/execution-proof/index.js.map +1 -0
  280. package/dist/resources/execution-proof/sap-execution-record.resource.d.ts +13 -0
  281. package/dist/resources/execution-proof/sap-execution-record.resource.d.ts.map +1 -0
  282. package/dist/resources/execution-proof/sap-execution-record.resource.js +75 -0
  283. package/dist/resources/execution-proof/sap-execution-record.resource.js.map +1 -0
  284. package/dist/resources/index.d.ts +5 -0
  285. package/dist/resources/index.d.ts.map +1 -0
  286. package/dist/resources/index.js +5 -0
  287. package/dist/resources/index.js.map +1 -0
  288. package/dist/resources/memory/index.d.ts +5 -0
  289. package/dist/resources/memory/index.d.ts.map +1 -0
  290. package/dist/resources/memory/index.js +5 -0
  291. package/dist/resources/memory/index.js.map +1 -0
  292. package/dist/resources/memory/sap-memory.resource.d.ts +13 -0
  293. package/dist/resources/memory/sap-memory.resource.d.ts.map +1 -0
  294. package/dist/resources/memory/sap-memory.resource.js +77 -0
  295. package/dist/resources/memory/sap-memory.resource.js.map +1 -0
  296. package/dist/resources/profile/sap-active-profile.resource.d.ts +51 -0
  297. package/dist/resources/profile/sap-active-profile.resource.d.ts.map +1 -0
  298. package/dist/resources/profile/sap-active-profile.resource.js +119 -0
  299. package/dist/resources/profile/sap-active-profile.resource.js.map +1 -0
  300. package/dist/resources/register-resources.d.ts +10 -0
  301. package/dist/resources/register-resources.d.ts.map +1 -0
  302. package/dist/resources/register-resources.js +33 -0
  303. package/dist/resources/register-resources.js.map +1 -0
  304. package/dist/resources/registry/index.d.ts +6 -0
  305. package/dist/resources/registry/index.d.ts.map +1 -0
  306. package/dist/resources/registry/index.js +6 -0
  307. package/dist/resources/registry/index.js.map +1 -0
  308. package/dist/resources/registry/sap-agent.resource.d.ts +13 -0
  309. package/dist/resources/registry/sap-agent.resource.d.ts.map +1 -0
  310. package/dist/resources/registry/sap-agent.resource.js +75 -0
  311. package/dist/resources/registry/sap-agent.resource.js.map +1 -0
  312. package/dist/resources/registry/sap-global-registry.resource.d.ts +13 -0
  313. package/dist/resources/registry/sap-global-registry.resource.d.ts.map +1 -0
  314. package/dist/resources/registry/sap-global-registry.resource.js +71 -0
  315. package/dist/resources/registry/sap-global-registry.resource.js.map +1 -0
  316. package/dist/resources/reputation/index.d.ts +5 -0
  317. package/dist/resources/reputation/index.d.ts.map +1 -0
  318. package/dist/resources/reputation/index.js +5 -0
  319. package/dist/resources/reputation/index.js.map +1 -0
  320. package/dist/resources/reputation/sap-reputation.resource.d.ts +13 -0
  321. package/dist/resources/reputation/sap-reputation.resource.d.ts.map +1 -0
  322. package/dist/resources/reputation/sap-reputation.resource.js +75 -0
  323. package/dist/resources/reputation/sap-reputation.resource.js.map +1 -0
  324. package/dist/resources/stats/sap-network-stats.resource.d.ts +14 -0
  325. package/dist/resources/stats/sap-network-stats.resource.d.ts.map +1 -0
  326. package/dist/resources/stats/sap-network-stats.resource.js +86 -0
  327. package/dist/resources/stats/sap-network-stats.resource.js.map +1 -0
  328. package/dist/resources/tool-schema/index.d.ts +5 -0
  329. package/dist/resources/tool-schema/index.d.ts.map +1 -0
  330. package/dist/resources/tool-schema/index.js +5 -0
  331. package/dist/resources/tool-schema/index.js.map +1 -0
  332. package/dist/resources/tool-schema/sap-tool-schema.resource.d.ts +13 -0
  333. package/dist/resources/tool-schema/sap-tool-schema.resource.d.ts.map +1 -0
  334. package/dist/resources/tool-schema/sap-tool-schema.resource.js +75 -0
  335. package/dist/resources/tool-schema/sap-tool-schema.resource.js.map +1 -0
  336. package/dist/sap/index.d.ts +7 -0
  337. package/dist/sap/index.d.ts.map +1 -0
  338. package/dist/sap/index.js +6 -0
  339. package/dist/sap/index.js.map +1 -0
  340. package/dist/sap/sap-client-manager.d.ts +54 -0
  341. package/dist/sap/sap-client-manager.d.ts.map +1 -0
  342. package/dist/sap/sap-client-manager.js +129 -0
  343. package/dist/sap/sap-client-manager.js.map +1 -0
  344. package/dist/sap/sap-errors.d.ts +13 -0
  345. package/dist/sap/sap-errors.d.ts.map +1 -0
  346. package/dist/sap/sap-errors.js +23 -0
  347. package/dist/sap/sap-errors.js.map +1 -0
  348. package/dist/sap/sap-types.d.ts +69 -0
  349. package/dist/sap/sap-types.d.ts.map +1 -0
  350. package/dist/sap/sap-types.js +5 -0
  351. package/dist/sap/sap-types.js.map +1 -0
  352. package/dist/schemas/common.schema.d.ts +42 -0
  353. package/dist/schemas/common.schema.d.ts.map +1 -0
  354. package/dist/schemas/common.schema.js +36 -0
  355. package/dist/schemas/common.schema.js.map +1 -0
  356. package/dist/schemas/developer.schema.d.ts +31 -0
  357. package/dist/schemas/developer.schema.d.ts.map +1 -0
  358. package/dist/schemas/developer.schema.js +19 -0
  359. package/dist/schemas/developer.schema.js.map +1 -0
  360. package/dist/schemas/execution-proof.schema.d.ts +44 -0
  361. package/dist/schemas/execution-proof.schema.d.ts.map +1 -0
  362. package/dist/schemas/execution-proof.schema.js +26 -0
  363. package/dist/schemas/execution-proof.schema.js.map +1 -0
  364. package/dist/schemas/identity.schema.d.ts +34 -0
  365. package/dist/schemas/identity.schema.d.ts.map +1 -0
  366. package/dist/schemas/identity.schema.js +21 -0
  367. package/dist/schemas/identity.schema.js.map +1 -0
  368. package/dist/schemas/index.d.ts +15 -0
  369. package/dist/schemas/index.d.ts.map +1 -0
  370. package/dist/schemas/index.js +15 -0
  371. package/dist/schemas/index.js.map +1 -0
  372. package/dist/schemas/memory.schema.d.ts +34 -0
  373. package/dist/schemas/memory.schema.d.ts.map +1 -0
  374. package/dist/schemas/memory.schema.js +21 -0
  375. package/dist/schemas/memory.schema.js.map +1 -0
  376. package/dist/schemas/payments.schema.d.ts +37 -0
  377. package/dist/schemas/payments.schema.d.ts.map +1 -0
  378. package/dist/schemas/payments.schema.js +22 -0
  379. package/dist/schemas/payments.schema.js.map +1 -0
  380. package/dist/schemas/registry.schema.d.ts +65 -0
  381. package/dist/schemas/registry.schema.d.ts.map +1 -0
  382. package/dist/schemas/registry.schema.js +34 -0
  383. package/dist/schemas/registry.schema.js.map +1 -0
  384. package/dist/schemas/reputation.schema.d.ts +31 -0
  385. package/dist/schemas/reputation.schema.d.ts.map +1 -0
  386. package/dist/schemas/reputation.schema.js +20 -0
  387. package/dist/schemas/reputation.schema.js.map +1 -0
  388. package/dist/schemas/settlement.schema.d.ts +50 -0
  389. package/dist/schemas/settlement.schema.d.ts.map +1 -0
  390. package/dist/schemas/settlement.schema.js +29 -0
  391. package/dist/schemas/settlement.schema.js.map +1 -0
  392. package/dist/schemas/tool-schema.schema.d.ts +56 -0
  393. package/dist/schemas/tool-schema.schema.d.ts.map +1 -0
  394. package/dist/schemas/tool-schema.schema.js +26 -0
  395. package/dist/schemas/tool-schema.schema.js.map +1 -0
  396. package/dist/schemas/transaction.schema.d.ts +34 -0
  397. package/dist/schemas/transaction.schema.d.ts.map +1 -0
  398. package/dist/schemas/transaction.schema.js +20 -0
  399. package/dist/schemas/transaction.schema.js.map +1 -0
  400. package/dist/security/approval-required.d.ts +9 -0
  401. package/dist/security/approval-required.d.ts.map +1 -0
  402. package/dist/security/approval-required.js +10 -0
  403. package/dist/security/approval-required.js.map +1 -0
  404. package/dist/security/index.d.ts +9 -0
  405. package/dist/security/index.d.ts.map +1 -0
  406. package/dist/security/index.js +9 -0
  407. package/dist/security/index.js.map +1 -0
  408. package/dist/security/private-key-guard.d.ts +11 -0
  409. package/dist/security/private-key-guard.d.ts.map +1 -0
  410. package/dist/security/private-key-guard.js +22 -0
  411. package/dist/security/private-key-guard.js.map +1 -0
  412. package/dist/security/prompt-injection-notes.d.ts +13 -0
  413. package/dist/security/prompt-injection-notes.d.ts.map +1 -0
  414. package/dist/security/prompt-injection-notes.js +23 -0
  415. package/dist/security/prompt-injection-notes.js.map +1 -0
  416. package/dist/security/tool-permissions.d.ts +30 -0
  417. package/dist/security/tool-permissions.d.ts.map +1 -0
  418. package/dist/security/tool-permissions.js +270 -0
  419. package/dist/security/tool-permissions.js.map +1 -0
  420. package/dist/security/unsafe-action-guard.d.ts +28 -0
  421. package/dist/security/unsafe-action-guard.d.ts.map +1 -0
  422. package/dist/security/unsafe-action-guard.js +175 -0
  423. package/dist/security/unsafe-action-guard.js.map +1 -0
  424. package/dist/server/create-server.d.ts +12 -0
  425. package/dist/server/create-server.d.ts.map +1 -0
  426. package/dist/server/create-server.js +57 -0
  427. package/dist/server/create-server.js.map +1 -0
  428. package/dist/server/index.d.ts +7 -0
  429. package/dist/server/index.d.ts.map +1 -0
  430. package/dist/server/index.js +7 -0
  431. package/dist/server/index.js.map +1 -0
  432. package/dist/server/register-capabilities.d.ts +10 -0
  433. package/dist/server/register-capabilities.d.ts.map +1 -0
  434. package/dist/server/register-capabilities.js +23 -0
  435. package/dist/server/register-capabilities.js.map +1 -0
  436. package/dist/server/server-metadata.d.ts +32 -0
  437. package/dist/server/server-metadata.d.ts.map +1 -0
  438. package/dist/server/server-metadata.js +32 -0
  439. package/dist/server/server-metadata.js.map +1 -0
  440. package/dist/session/agent-session.d.ts +25 -0
  441. package/dist/session/agent-session.d.ts.map +1 -0
  442. package/dist/session/agent-session.js +35 -0
  443. package/dist/session/agent-session.js.map +1 -0
  444. package/dist/session/delegated-session.d.ts +20 -0
  445. package/dist/session/delegated-session.d.ts.map +1 -0
  446. package/dist/session/delegated-session.js +47 -0
  447. package/dist/session/delegated-session.js.map +1 -0
  448. package/dist/session/index.d.ts +10 -0
  449. package/dist/session/index.d.ts.map +1 -0
  450. package/dist/session/index.js +9 -0
  451. package/dist/session/index.js.map +1 -0
  452. package/dist/session/redis-session-store.d.ts +89 -0
  453. package/dist/session/redis-session-store.d.ts.map +1 -0
  454. package/dist/session/redis-session-store.js +219 -0
  455. package/dist/session/redis-session-store.js.map +1 -0
  456. package/dist/session/session-limits.d.ts +20 -0
  457. package/dist/session/session-limits.d.ts.map +1 -0
  458. package/dist/session/session-limits.js +55 -0
  459. package/dist/session/session-limits.js.map +1 -0
  460. package/dist/session/session-permissions.d.ts +37 -0
  461. package/dist/session/session-permissions.d.ts.map +1 -0
  462. package/dist/session/session-permissions.js +58 -0
  463. package/dist/session/session-permissions.js.map +1 -0
  464. package/dist/session/session-store.d.ts +38 -0
  465. package/dist/session/session-store.d.ts.map +1 -0
  466. package/dist/session/session-store.js +62 -0
  467. package/dist/session/session-store.js.map +1 -0
  468. package/dist/session/session-types.d.ts +33 -0
  469. package/dist/session/session-types.d.ts.map +1 -0
  470. package/dist/session/session-types.js +5 -0
  471. package/dist/session/session-types.js.map +1 -0
  472. package/dist/signer/external-signer.d.ts +16 -0
  473. package/dist/signer/external-signer.d.ts.map +1 -0
  474. package/dist/signer/external-signer.js +128 -0
  475. package/dist/signer/external-signer.js.map +1 -0
  476. package/dist/signer/index.d.ts +9 -0
  477. package/dist/signer/index.d.ts.map +1 -0
  478. package/dist/signer/index.js +8 -0
  479. package/dist/signer/index.js.map +1 -0
  480. package/dist/signer/load-keypair.d.ts +15 -0
  481. package/dist/signer/load-keypair.d.ts.map +1 -0
  482. package/dist/signer/load-keypair.js +39 -0
  483. package/dist/signer/load-keypair.js.map +1 -0
  484. package/dist/signer/local-keypair-signer.d.ts +11 -0
  485. package/dist/signer/local-keypair-signer.d.ts.map +1 -0
  486. package/dist/signer/local-keypair-signer.js +46 -0
  487. package/dist/signer/local-keypair-signer.js.map +1 -0
  488. package/dist/signer/signer-resolver.d.ts +10 -0
  489. package/dist/signer/signer-resolver.d.ts.map +1 -0
  490. package/dist/signer/signer-resolver.js +63 -0
  491. package/dist/signer/signer-resolver.js.map +1 -0
  492. package/dist/signer/signer-types.d.ts +35 -0
  493. package/dist/signer/signer-types.d.ts.map +1 -0
  494. package/dist/signer/signer-types.js +5 -0
  495. package/dist/signer/signer-types.js.map +1 -0
  496. package/dist/signer/signing-proxy.d.ts +45 -0
  497. package/dist/signer/signing-proxy.d.ts.map +1 -0
  498. package/dist/signer/signing-proxy.js +300 -0
  499. package/dist/signer/signing-proxy.js.map +1 -0
  500. package/dist/tools/client-sdk-tools.d.ts +22 -0
  501. package/dist/tools/client-sdk-tools.d.ts.map +1 -0
  502. package/dist/tools/client-sdk-tools.js +220 -0
  503. package/dist/tools/client-sdk-tools.js.map +1 -0
  504. package/dist/tools/index.d.ts +11 -0
  505. package/dist/tools/index.d.ts.map +1 -0
  506. package/dist/tools/index.js +17 -0
  507. package/dist/tools/index.js.map +1 -0
  508. package/dist/tools/profile-tools.d.ts +12 -0
  509. package/dist/tools/profile-tools.d.ts.map +1 -0
  510. package/dist/tools/profile-tools.js +250 -0
  511. package/dist/tools/profile-tools.js.map +1 -0
  512. package/dist/tools/register-tools.d.ts +12 -0
  513. package/dist/tools/register-tools.d.ts.map +1 -0
  514. package/dist/tools/register-tools.js +36 -0
  515. package/dist/tools/register-tools.js.map +1 -0
  516. package/dist/tools/sap-network-stats.tool.d.ts +14 -0
  517. package/dist/tools/sap-network-stats.tool.d.ts.map +1 -0
  518. package/dist/tools/sap-network-stats.tool.js +101 -0
  519. package/dist/tools/sap-network-stats.tool.js.map +1 -0
  520. package/dist/tools/sap-sdk-tools.d.ts +15 -0
  521. package/dist/tools/sap-sdk-tools.d.ts.map +1 -0
  522. package/dist/tools/sap-sdk-tools.js +1515 -0
  523. package/dist/tools/sap-sdk-tools.js.map +1 -0
  524. package/dist/tools/sap-sns-tools.d.ts +35 -0
  525. package/dist/tools/sap-sns-tools.d.ts.map +1 -0
  526. package/dist/tools/sap-sns-tools.js +626 -0
  527. package/dist/tools/sap-sns-tools.js.map +1 -0
  528. package/dist/tools/skills-tools.d.ts +12 -0
  529. package/dist/tools/skills-tools.d.ts.map +1 -0
  530. package/dist/tools/skills-tools.js +273 -0
  531. package/dist/tools/skills-tools.js.map +1 -0
  532. package/dist/tools/transaction-tools.d.ts +14 -0
  533. package/dist/tools/transaction-tools.d.ts.map +1 -0
  534. package/dist/tools/transaction-tools.js +297 -0
  535. package/dist/tools/transaction-tools.js.map +1 -0
  536. package/dist/transports/http.d.ts +40 -0
  537. package/dist/transports/http.d.ts.map +1 -0
  538. package/dist/transports/http.js +212 -0
  539. package/dist/transports/http.js.map +1 -0
  540. package/dist/transports/index.d.ts +6 -0
  541. package/dist/transports/index.d.ts.map +1 -0
  542. package/dist/transports/index.js +6 -0
  543. package/dist/transports/index.js.map +1 -0
  544. package/dist/transports/stdio.d.ts +14 -0
  545. package/dist/transports/stdio.d.ts.map +1 -0
  546. package/dist/transports/stdio.js +32 -0
  547. package/dist/transports/stdio.js.map +1 -0
  548. package/dist/tui/components.d.ts +59 -0
  549. package/dist/tui/components.d.ts.map +1 -0
  550. package/dist/tui/components.js +82 -0
  551. package/dist/tui/components.js.map +1 -0
  552. package/dist/tui/config-wizard.d.ts +12 -0
  553. package/dist/tui/config-wizard.d.ts.map +1 -0
  554. package/dist/tui/config-wizard.js +348 -0
  555. package/dist/tui/config-wizard.js.map +1 -0
  556. package/dist/tui/wizard-save.d.ts +51 -0
  557. package/dist/tui/wizard-save.d.ts.map +1 -0
  558. package/dist/tui/wizard-save.js +148 -0
  559. package/dist/tui/wizard-save.js.map +1 -0
  560. package/docs/00_README.md +45 -0
  561. package/docs/01_PRODUCT_OVERVIEW.md +69 -0
  562. package/docs/02_ARCHITECTURE_AND_REQUEST_FLOW.md +120 -0
  563. package/docs/03_CONFIGURATION_AND_WIZARD.md +143 -0
  564. package/docs/04_LOCAL_STDIO_USAGE.md +118 -0
  565. package/docs/05_REMOTE_VPS_DEPLOYMENT.md +136 -0
  566. package/docs/06_PAYMENTS_X402_AND_PAYSH.md +162 -0
  567. package/docs/07_ENDPOINTS_AND_CLIENTS.md +114 -0
  568. package/docs/08_SECURITY_POLICY_AND_SIGNING.md +134 -0
  569. package/docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md +72 -0
  570. package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +90 -0
  571. package/docs/11_CODE_QUALITY_AUDIT.md +49 -0
  572. package/ecosystem.config.example.cjs +55 -0
  573. package/package.json +132 -0
  574. package/skills/README.md +146 -0
  575. package/skills/sap-agent-registry/SKILL.md +39 -0
  576. package/skills/sap-agentkit/SKILL.md +40 -0
  577. package/skills/sap-defi/SKILL.md +51 -0
  578. package/skills/sap-discovery-indexing/SKILL.md +33 -0
  579. package/skills/sap-escrow-settlement/SKILL.md +37 -0
  580. package/skills/sap-ledger-session/SKILL.md +24 -0
  581. package/skills/sap-market-data/SKILL.md +36 -0
  582. package/skills/sap-mcp/SKILL.md +202 -0
  583. package/skills/sap-mcp/TOOL_REFERENCE.md +184 -0
  584. package/skills/sap-memory-vault/SKILL.md +29 -0
  585. package/skills/sap-nft-metaplex/SKILL.md +38 -0
  586. package/skills/sap-operations/SKILL.md +97 -0
  587. package/skills/sap-payments-x402/SKILL.md +47 -0
  588. package/skills/sap-reputation-attestation/SKILL.md +30 -0
  589. package/skills/sap-sns/SKILL.md +51 -0
  590. package/skills/sap-social-gaming/SKILL.md +30 -0
  591. package/skills/sap-solana-token/SKILL.md +32 -0
  592. package/skills/sap-staking/SKILL.md +24 -0
  593. package/skills/sap-tool-registry/SKILL.md +29 -0
@@ -0,0 +1,162 @@
1
+ # 06. Payments, x402, And pay.sh
2
+
3
+ ## 06.1 Payment Principles
4
+
5
+ SAP MCP monetization is remote-only by default. Local stdio remains a local developer/operator experience.
6
+
7
+ The server does not charge for connecting. Payment is evaluated per MCP request, primarily for `tools/call`.
8
+
9
+ ## 06.2 Initial Pricing Model
10
+
11
+ | Tier | Examples | Price |
12
+ | --- | --- | --- |
13
+ | Free | `tools/list`, `prompts/list`, `resources/list`, `sap_profile_current`, base overview | Free |
14
+ | Premium read | `sap_list_all_agents`, enriched network stats, indexed discovery | `$0.007` to `$0.01` |
15
+ | Builder or batch | complex builders, SNS/domain batch checks, enriched analytics | `$0.01` to `$0.10` |
16
+ | Value action | settlement-like or value-linked operations where appropriate | fixed `$0.20` plus optional `0.5%` |
17
+
18
+ Do not apply percentage fees blindly to swaps or financial routing. Those workflows may create compliance, custody, and routing implications.
19
+
20
+ ## 06.3 x402 Role
21
+
22
+ x402 is the native payment gate used by SAP MCP for paid hosted requests.
23
+
24
+ For hosted users, the x402/pay.sh payment authorization is signed by the user's wizard-created SAP profile wallet or external signer. The hosted MCP server verifies and settles payments; it does not hold or receive customer keypair bytes.
25
+
26
+ Flow:
27
+
28
+ 1. Client sends a JSON-RPC request to `POST /mcp`.
29
+ 2. SAP MCP parses the request and resolves the tool pricing tier.
30
+ 3. Free requests execute without payment.
31
+ 4. Paid requests return payment requirements when no valid payment is provided.
32
+ 5. The client signs the payment with the user's configured local wallet or external signer.
33
+ 6. Client retries with `PAYMENT-SIGNATURE` or `X-PAYMENT`.
34
+ 7. SAP MCP verifies the payment with the configured facilitator.
35
+ 8. Tool executes.
36
+ 9. SAP MCP settles or cancels the payment based on handler result.
37
+
38
+ SAP MCP accepts both header names:
39
+
40
+ ```text
41
+ PAYMENT-SIGNATURE: <x402 payment payload>
42
+ X-PAYMENT: <x402 payment payload>
43
+ ```
44
+
45
+ ## 06.4 Payment Test Matrix
46
+
47
+ Before mainnet launch, verify these cases on devnet:
48
+
49
+ | Case | Expected result |
50
+ | --- | --- |
51
+ | `initialize` | Free, no payment challenge. |
52
+ | `tools/list` | Free, no payment challenge. |
53
+ | Free tool such as `sap_profile_current` | Free, no payment challenge. |
54
+ | Paid tool without payment | HTTP payment-required response with x402 instructions. |
55
+ | Paid tool with no user signer configured | Client cannot produce a valid payment signature; run the wizard or configure an external signer. |
56
+ | Paid tool with valid payment | Tool executes, facilitator verifies, settlement is attempted. |
57
+ | Paid tool with handler failure | Payment is canceled and tool error is returned. |
58
+ | Paid batch call | Price is aggregated and route is bound to request hash. |
59
+ | Facilitator unavailable | Paid call fails closed, not free. |
60
+ | pay.sh checkout configured | 402 body includes checkout URL, but SAP MCP remains pricing authority. |
61
+
62
+ ## 06.5 pay.sh Role
63
+
64
+ pay.sh is useful as a provider/catalog/proxy layer for public distribution and checkout UX.
65
+
66
+ Important distinction:
67
+
68
+ 1. pay.sh can expose and route the hosted SAP MCP endpoint.
69
+ 2. pay.sh can provide a checkout or provider YAML surface.
70
+ 3. SAP MCP still performs per-tool x402 pricing internally.
71
+ 4. A raw endpoint-level pay.sh charge on `/mcp` can accidentally charge free protocol calls if the proxy is not body-aware.
72
+
73
+ For that reason, SAP MCP should remain the pricing source of truth for MCP `tools/call` requests.
74
+
75
+ ## 06.6 Enable Monetization
76
+
77
+ Configure monetization through a private environment store. Public docs should not include live facilitator URLs, auth tokens, payment recipients, RPC credentials, or signer paths.
78
+
79
+ Required categories:
80
+
81
+ ```bash
82
+ SAP_MCP_MONETIZATION_ENABLED=true
83
+ SAP_MCP_MONETIZATION_PROVIDER=x402
84
+ SAP_MCP_MONETIZATION_PAY_TO=<revenue-recipient>
85
+ SAP_MCP_MONETIZATION_NETWORK=<x402-network-id>
86
+ SAP_MCP_X402_FACILITATOR_URL=<private-or-hosted-facilitator-url>
87
+ SAP_MCP_X402_FACILITATOR_AUTH_TOKEN=<private-facilitator-auth-token>
88
+ SAP_MCP_X402_MAX_TIMEOUT_SECONDS=<timeout-seconds>
89
+ SAP_MCP_PAY_SH_CHECKOUT_URL=<optional-pay-sh-checkout-url>
90
+ ```
91
+
92
+ `SAP_MCP_MONETIZATION_PAY_TO` is the revenue recipient. It is not the facilitator signer, not a customer payment signer, and not an agent wallet.
93
+
94
+ ## 06.7 Facilitator Keypair
95
+
96
+ The facilitator needs its own dedicated signer. Initialize it:
97
+
98
+ ```bash
99
+ npx sap-mcp-facilitator init
100
+ ```
101
+
102
+ Then fund the printed facilitator public key with SOL on the configured network. Store the facilitator signer path in private deployment config, not in public docs.
103
+
104
+ ```text
105
+ <private-facilitator-signer-path>
106
+ ```
107
+
108
+ The facilitator signer is used for facilitator operations. It must be separate from:
109
+
110
+ 1. SAP agent profile wallets.
111
+ 2. Solana CLI `id.json`.
112
+ 3. Revenue recipient wallet.
113
+ 4. Customer wallets.
114
+
115
+ ## 06.8 Start Facilitator
116
+
117
+ Start the facilitator through PM2, systemd, or a container supervisor with private environment injection:
118
+
119
+ ```bash
120
+ npx sap-mcp-facilitator start
121
+ ```
122
+
123
+ If the facilitator binds to a non-loopback host or is reachable across a network boundary, an auth token is required.
124
+
125
+ ## 06.9 Generate pay.sh Provider YAML
126
+
127
+ ```bash
128
+ npx sap-mcp-pay-sh-spec \
129
+ --out sap-mcp-pay-sh.yml \
130
+ --upstream-url https://mcp.sap.oobeprotocol.ai \
131
+ --network mainnet \
132
+ --recipient YOUR_SOLANA_USDC_RECIPIENT \
133
+ --subdomain oobe-sap-mcp \
134
+ --title "OOBE SAP MCP Server"
135
+ ```
136
+
137
+ Options:
138
+
139
+ | Option | Meaning |
140
+ | --- | --- |
141
+ | `--config <path>` | Load a specific SAP MCP config JSON. |
142
+ | `--out <path>` | Write YAML to a file. |
143
+ | `--upstream-url <url>` | Hosted SAP MCP base URL. |
144
+ | `--network <name>` | `mainnet`, `devnet`, or `localnet`. |
145
+ | `--recipient <pubkey>` | Revenue wallet override. |
146
+ | `--rpc-url <url>` | pay.sh operator RPC URL. |
147
+ | `--signer-path <path>` | pay.sh operator signer file. |
148
+ | `--subdomain <slug>` | pay.sh provider slug. |
149
+ | `--title <text>` | pay.sh provider title. |
150
+ | `--no-fee-payer` | Disable operator fee-payer sponsorship. |
151
+
152
+ ## 06.10 Usage Ledger
153
+
154
+ Payment decisions are written to the usage ledger. The ledger should store:
155
+
156
+ 1. Request hash.
157
+ 2. Tool name.
158
+ 3. Pricing decision.
159
+ 4. Verification status.
160
+ 5. Settlement or cancellation state.
161
+
162
+ It must not store raw keypair bytes, raw private keys, raw payment secrets, or sensitive full request payloads.
@@ -0,0 +1,114 @@
1
+ # 07. Endpoints And Clients
2
+
3
+ ## 07.1 Remote MCP Endpoints
4
+
5
+ | Method | Path | Purpose | Auth |
6
+ | --- | --- | --- | --- |
7
+ | `GET` | `/health` | Health check. | No, unless reverse proxy requires it. |
8
+ | `GET` | `/.well-known/agent-card.json` | A2A-compatible discovery card. | Usually public. |
9
+ | `GET` | `/.well-known/sap-mcp-wizard.json` | Machine-readable wizard install metadata for agents that cannot see local config. | Public. |
10
+ | `GET` | `/wizard/install.sh` | Small shell launcher that runs the npm-hosted SAP MCP wizard. | Public. |
11
+ | `POST` | `/mcp` | MCP JSON-RPC requests. | Public in `SAP_MCP_AUTH_TYPE=none`; Bearer in private modes. Paid tools require x402. |
12
+ | `GET` | `/mcp` | Streamable HTTP session stream. | Same as `POST /mcp`. |
13
+ | `DELETE` | `/mcp` | Streamable HTTP session cleanup. | Same as `POST /mcp`. |
14
+
15
+ ## 07.2 Facilitator Endpoints
16
+
17
+ | Method | Path | Purpose |
18
+ | --- | --- | --- |
19
+ | `GET` | `/facilitator/health` | Facilitator health. |
20
+ | `GET` | `/facilitator/supported` | Supported x402 payment schemes and networks. |
21
+ | `POST` | `/facilitator/verify` | Verify a payment payload. |
22
+ | `POST` | `/facilitator/settle` | Settle a verified payment. |
23
+
24
+ Protect facilitator endpoints with `SAP_MCP_FACILITATOR_AUTH_TOKEN` outside local-only development.
25
+
26
+ ## 07.3 Required Remote Headers
27
+
28
+ Public hosted agent-facing mode:
29
+
30
+ ```text
31
+ Content-Type: application/json
32
+ Accept: application/json, text/event-stream
33
+ ```
34
+
35
+ Private API key/JWT mode adds:
36
+
37
+ ```text
38
+ Authorization: Bearer <api-key-or-jwt>
39
+ ```
40
+
41
+ For paid requests, add one of:
42
+
43
+ ```text
44
+ PAYMENT-SIGNATURE: <x402 payment payload>
45
+ X-PAYMENT: <x402 payment payload>
46
+ ```
47
+
48
+ ## 07.4 Initialize Smoke Test
49
+
50
+ ```bash
51
+ curl -i https://mcp.sap.oobeprotocol.ai/mcp \
52
+ -H "Content-Type: application/json" \
53
+ -H "Accept: application/json, text/event-stream" \
54
+ --data '{
55
+ "jsonrpc":"2.0",
56
+ "id":1,
57
+ "method":"initialize",
58
+ "params":{
59
+ "protocolVersion":"2025-06-18",
60
+ "capabilities":{},
61
+ "clientInfo":{"name":"smoke","version":"1.0.0"}
62
+ }
63
+ }'
64
+ ```
65
+
66
+ ## 07.5 Tool List Smoke Test
67
+
68
+ ```bash
69
+ curl -i https://mcp.sap.oobeprotocol.ai/mcp \
70
+ -H "Content-Type: application/json" \
71
+ -H "Accept: application/json, text/event-stream" \
72
+ --data '{
73
+ "jsonrpc":"2.0",
74
+ "id":2,
75
+ "method":"tools/list",
76
+ "params":{}
77
+ }'
78
+ ```
79
+
80
+ ## 07.6 Local Client Config
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "sap": {
86
+ "command": "sap-mcp-server",
87
+ "env": {
88
+ "SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE": "false",
89
+ "SAP_LOG_LEVEL": "info"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## 07.7 Remote Client Config
97
+
98
+ ```yaml
99
+ mcp_servers:
100
+ sap:
101
+ url: https://mcp.sap.oobeprotocol.ai/mcp
102
+ transport: streamable-http
103
+ ```
104
+
105
+ ## 07.8 MCP Client Behavior
106
+
107
+ Clients should:
108
+
109
+ 1. Use the server's language behavior when responding to users.
110
+ 2. Not assume devnet or mainnet from old local environment variables.
111
+ 3. Read the profile/context tools before making network claims.
112
+ 4. Treat keypair files as secret material.
113
+ 5. Retry paid calls with x402 headers only when the server returns payment requirements.
114
+ 6. If local `~/.config/mcp-sap` config is missing or inaccessible, send the user to `/.well-known/sap-mcp-wizard.json` or `/wizard/install.sh` instead of asking for keypair bytes.
@@ -0,0 +1,134 @@
1
+ # 08. Security, Policy, And Signing
2
+
3
+ ## 08.1 Key Material Rules
4
+
5
+ 1. Never expose keypair byte arrays to agents.
6
+ 2. Never print private keys in logs, CLI output, MCP resources, MCP prompts, or errors.
7
+ 3. Never inject keypair bytes into Claude, Hermes, Codex, OpenClaw, or other client config.
8
+ 4. Never use the Solana CLI keypair as an implicit SAP MCP wallet.
9
+ 5. Use dedicated SAP MCP profile keypairs under `~/.config/mcp-sap/keypairs/`.
10
+ 6. Use a separate facilitator signer for x402 facilitator operations.
11
+
12
+ ## 08.2 Signer Modes
13
+
14
+ | Mode | Signing behavior |
15
+ | --- | --- |
16
+ | `readonly` | No signing. Safe for public read-only hosted deployments. |
17
+ | `local-dev-keypair` | Uses a dedicated local SAP MCP keypair. Best for local development. |
18
+ | `external-signer` | Delegates signing to an external signer service or local signing proxy. |
19
+ | `hosted-api` | Hosted server mode for API workflows where raw customer keys do not live in process. |
20
+
21
+ ## 08.3 External Signing Protocol
22
+
23
+ Use external signing when a remote MCP workflow needs user-controlled signatures without uploading the user's keypair to the hosted server.
24
+
25
+ The local signing proxy exposes:
26
+
27
+ ```text
28
+ GET /sign/<profile>
29
+ POST /sign/<profile>
30
+ GET /health
31
+ ```
32
+
33
+ Set the same bearer token on both sides:
34
+
35
+ ```bash
36
+ SAP_SIGNING_AUTH_TOKEN=replace-with-local-token
37
+ SAP_EXTERNAL_SIGNER_AUTH_TOKEN=replace-with-local-token
38
+ SAP_EXTERNAL_SIGNER_URL=http://127.0.0.1:8765/sign/<profile>
39
+ ```
40
+
41
+ `GET /sign/<profile>` returns:
42
+
43
+ ```json
44
+ {
45
+ "publicKey": "..."
46
+ }
47
+ ```
48
+
49
+ `POST /sign/<profile>` accepts:
50
+
51
+ ```json
52
+ {
53
+ "transaction": "base64-serialized-transaction",
54
+ "sessionId": "optional-session-id"
55
+ }
56
+ ```
57
+
58
+ The `<profile>` is resolved through the SAP MCP profile manager first, then through canonical keypair filenames under `~/.config/mcp-sap/keypairs/`. The signing proxy intentionally does not fall back to legacy `agents/` directories.
59
+
60
+ Recommended flow:
61
+
62
+ 1. User runs `npx sap-mcp-config wizard` locally.
63
+ 2. User starts `sap-signing-proxy` on `127.0.0.1`.
64
+ 3. Remote workflow prepares an unsigned transaction or payload.
65
+ 4. Local signer signs through `POST /sign/<profile>`.
66
+ 5. The signed transaction returns to the caller without exposing keypair bytes.
67
+
68
+ ## 08.4 Policy Layers
69
+
70
+ SAP MCP supports:
71
+
72
+ 1. Local policy engine.
73
+ 2. Bento policy engine.
74
+ 3. Hybrid policy engine.
75
+ 4. Spending limits.
76
+ 5. Tool permission mapping.
77
+ 6. Approval workflow for sensitive config changes.
78
+ 7. Unsafe action guard.
79
+ 8. Private-key guard.
80
+
81
+ ## 08.5 Bento Policy
82
+
83
+ Bento can be enabled by profile:
84
+
85
+ ```json
86
+ {
87
+ "bento": {
88
+ "enabled": true,
89
+ "agentId": "sap-agent"
90
+ },
91
+ "policy": {
92
+ "mode": "hybrid",
93
+ "failOpen": false,
94
+ "logging": true
95
+ }
96
+ }
97
+ ```
98
+
99
+ Production recommendation:
100
+
101
+ 1. Use `failOpen=false`.
102
+ 2. Keep local policy as a fallback boundary.
103
+ 3. Log policy decisions without logging secrets.
104
+ 4. Test denied, allowed, and degraded Bento paths before launch.
105
+
106
+ ## 08.6 Transaction Safety
107
+
108
+ Before signing or submitting transactions, enforce:
109
+
110
+ 1. Tool permission.
111
+ 2. Profile mode.
112
+ 3. Daily limit.
113
+ 4. Max transaction value.
114
+ 5. Approval threshold.
115
+ 6. Network consistency.
116
+ 7. Private-key guard.
117
+ 8. Audit log.
118
+
119
+ Agents must ask for approval before value-moving operations when policy requires it.
120
+
121
+ ## 08.7 Remote Hosted Safety
122
+
123
+ For `mcp.sap.oobeprotocol.ai`:
124
+
125
+ 1. Use TLS at the reverse proxy.
126
+ 2. Use `SAP_MCP_AUTH_TYPE=none` for public agent-facing MCP when x402 monetization is enabled.
127
+ 3. Keep hosted payment and value-moving signatures user-controlled through the wizard-created local profile or an external signer.
128
+ 4. Never ask hosted users to paste keypair bytes into an MCP client config or upload wallet files to the hosted server.
129
+ 5. Keep the Node server behind `127.0.0.1` unless intentionally public.
130
+ 6. Use API keys or JWTs with rotation for private beta, enterprise, admin, or non-public deployments.
131
+ 7. Rate-limit abusive clients.
132
+ 8. Enable x402 only after facilitator health and settlement tests pass.
133
+ 9. Keep facilitator auth token private.
134
+ 10. Keep facilitator signer funded only to the level required for operation.
@@ -0,0 +1,72 @@
1
+ # 09. Tools, Skills, And Agent Guide
2
+
3
+ ## 09.1 Tool Families
4
+
5
+ SAP MCP exposes several tool families:
6
+
7
+ 1. SAP SDK registry, discovery, reputation, escrow, memory, capability, SNS, and protocol tools.
8
+ 2. Synapse AgentKit tools.
9
+ 3. Solana RPC, token, NFT, DAS, transaction, network, and Jupiter tools.
10
+ 4. Profile tools such as current profile, switch profile, list profiles, and public key inspection.
11
+ 5. Skill-pack tools for installing SAP MCP usage context into agent runtimes.
12
+ 6. x402 tools for estimating, preparing, verifying, and settling paid workflows.
13
+
14
+ ## 09.2 Agent Context Rules
15
+
16
+ Agents should:
17
+
18
+ 1. Call profile/context tools before claiming the current network.
19
+ 2. Respect the active profile's `rpcUrl`, `programId`, and `mode`.
20
+ 3. Prefer SAP SDK docs and skills when explaining SAP Protocol semantics.
21
+ 4. Answer in the user's language unless the user asks otherwise.
22
+ 5. Avoid showing internal thinking, keypair bytes, raw request secrets, or private config.
23
+ 6. Ask for approval before signing or value-moving operations when required by policy.
24
+
25
+ ## 09.3 Skills Directory
26
+
27
+ The repo may include a `skills/` directory for client-installable SAP MCP operating instructions.
28
+
29
+ Recommended skill topics:
30
+
31
+ 1. SAP MCP overview and safety rules.
32
+ 2. Solana protocol tool routing.
33
+ 3. SAP registry and discovery workflows.
34
+ 4. SNS identity workflows.
35
+ 5. x402 payment and settlement workflows.
36
+ 6. Transaction signing and approval workflows.
37
+ 7. Troubleshooting network/profile mismatch.
38
+
39
+ ## 09.4 Upstream SDK References
40
+
41
+ Use upstream SAP SDK docs and skills as the source of protocol behavior:
42
+
43
+ 1. `https://github.com/OOBE-PROTOCOL/synapse-sap-sdk/tree/main/docs`
44
+ 2. `https://github.com/OOBE-PROTOCOL/synapse-sap-sdk/tree/main/skills`
45
+ 3. `https://github.com/OOBE-PROTOCOL/synapse-sap-sdk/tree/v0.21.0/skills`
46
+
47
+ SAP MCP wrappers should map to real SDK imports and types from:
48
+
49
+ 1. `@oobe-protocol-labs/synapse-sap-sdk`
50
+ 2. `@oobe-protocol-labs/synapse-client-sdk`
51
+ 3. `@modelcontextprotocol/sdk`
52
+
53
+ ## 09.5 Tool Documentation Standard
54
+
55
+ Each exported tool should include:
56
+
57
+ 1. Stable tool name.
58
+ 2. Clear title.
59
+ 3. Operational description.
60
+ 4. JSON schema or Zod schema that serializes correctly through MCP `tools/list`.
61
+ 5. Typed handler input.
62
+ 6. Typed handler output.
63
+ 7. Policy metadata.
64
+ 8. Payment tier when hosted monetization is enabled.
65
+ 9. Error behavior.
66
+
67
+ Avoid stubs, fake compatibility wrappers, `any`, TODO-only handlers, and undocumented low-code glue.
68
+
69
+ ## 09.6 Language Behavior
70
+
71
+ If a user asks in English, the agent should answer in English. If a user asks in Italian, the agent should answer in Italian. SAP MCP prompts and skills should reinforce this behavior because tool output may contain multilingual metadata.
72
+
@@ -0,0 +1,90 @@
1
+ # 10. Operations, Release, And PM2
2
+
3
+ ## 10.1 Required Quality Gates
4
+
5
+ Before release:
6
+
7
+ ```bash
8
+ pnpm run typecheck
9
+ pnpm run lint
10
+ pnpm test -- --run
11
+ pnpm run build
12
+ npm pack --dry-run
13
+ ```
14
+
15
+ or run the aggregate release gate:
16
+
17
+ ```bash
18
+ pnpm run verify:release
19
+ ```
20
+
21
+ For remote deployments, also run MCP smoke tests against `/mcp`.
22
+
23
+ ## 10.2 Process Manager Policy
24
+
25
+ The repo ships `ecosystem.config.example.cjs` as a shape reference without live secrets. Do not publish the real production ecosystem file, host paths, listener ports, signer paths, RPC credentials, payment recipient, or facilitator auth values.
26
+
27
+ Production process definitions should live in a private infrastructure repository or host-level secret manager.
28
+
29
+ ## 10.3 PM2 Commands
30
+
31
+ ```bash
32
+ pm2 start <private-ecosystem-file>
33
+ pm2 status
34
+ pm2 logs <process-name>
35
+ pm2 restart <process-name> --update-env
36
+ pm2 save
37
+ pm2 startup
38
+ ```
39
+
40
+ ## 10.4 Secrets
41
+
42
+ Do not commit:
43
+
44
+ 1. `.env` files with live secrets.
45
+ 2. API keys.
46
+ 3. JWT secrets.
47
+ 4. Facilitator auth tokens.
48
+ 5. Keypair JSON files.
49
+ 6. PM2 ecosystem files containing production secrets.
50
+ 7. Customer configuration files.
51
+
52
+ Use server-side secret management or private deployment files outside the public repo.
53
+
54
+ ## 10.5 Release Packaging
55
+
56
+ Recommended release model:
57
+
58
+ 1. Public GitHub repository for source and docs.
59
+ 2. npm package for CLI, wizard, and local server installation.
60
+ 3. GitHub releases for signed artifacts and changelog.
61
+ 4. Private infrastructure repo or private environment store for production secrets.
62
+
63
+ ## 10.6 Changelog Discipline
64
+
65
+ Each release should document:
66
+
67
+ 1. Runtime tool count.
68
+ 2. SDK versions.
69
+ 3. Transport changes.
70
+ 4. Config and wizard changes.
71
+ 5. Security changes.
72
+ 6. Payment changes.
73
+ 7. Breaking changes.
74
+ 8. Migration notes.
75
+ 9. Verification commands and results.
76
+
77
+ ## 10.7 Current Release Notes
78
+
79
+ Version `0.1.0` includes:
80
+
81
+ 1. Local stdio and remote Streamable HTTP MCP modes.
82
+ 2. Profile-managed config under `~/.config/mcp-sap`.
83
+ 3. Dedicated SAP MCP wallet isolation.
84
+ 4. Optional client config injection for local agents.
85
+ 5. x402 monetization gate for paid hosted tool calls.
86
+ 6. OOBE self-hosted x402 SVM facilitator.
87
+ 7. pay.sh provider YAML generation.
88
+ 8. SAP SDK, SNS, Synapse AgentKit, Solana, profile, transaction, skill, and payment tools.
89
+ 9. Policy engine support with local, Bento, and hybrid modes.
90
+ 10. Security guardrails for private key exposure and unsafe actions.
@@ -0,0 +1,49 @@
1
+ # 11. Code Quality Audit
2
+
3
+ This audit records the current engineering posture for SAP MCP Server `0.1.0`.
4
+
5
+ ## 11.1 Result
6
+
7
+ | Area | Status | Notes |
8
+ | --- | --- | --- |
9
+ | Type safety | Pass | `tsc --noEmit --skipLibCheck` exits cleanly. No production `any` types were found in the audited source paths. |
10
+ | Lint | Pass | `eslint src/` exits cleanly. |
11
+ | Tests | Pass | `vitest --run` passes all current tests. |
12
+ | Build | Pass | `tsc` plus the TUI build complete successfully. |
13
+ | Package dry run | Pass | `npm pack --dry-run` includes the runtime, docs, skills, binaries, and PM2 example. |
14
+ | Documentation surface | Pass | Public docs are numbered and current. Legacy root docs were removed to avoid conflicting setup instructions. |
15
+ | Secret handling | Pass | Agent-facing context and injected MCP client config avoid keypair bytes and hard-coded wallet paths. |
16
+
17
+ Overall assessment: production-ready for staging and public review, with the remaining validation focused on live infrastructure rather than local code hygiene.
18
+
19
+ ## 11.2 Engineering Standards
20
+
21
+ The repository should keep these rules:
22
+
23
+ 1. Use native `@modelcontextprotocol/sdk` transports and server APIs.
24
+ 2. Wrap `@oobe-protocol-labs/synapse-sap-sdk` and `@oobe-protocol-labs/synapse-client-sdk` directly, without fake compatibility stubs.
25
+ 3. Keep profile-owned wallet and RPC settings under `~/.config/mcp-sap`.
26
+ 4. Do not expose keypair bytes in tools, prompts, resources, logs, tests, docs, or injected client config.
27
+ 5. Require local policy checks before signing or submitting transactions.
28
+ 6. Keep hosted public mode bearerless only when x402 monetization, rate limits, and facilitator auth are configured deliberately.
29
+ 7. Keep every exported class, function, interface, type, and enum documented with JSDoc when it is part of the production source surface.
30
+ 8. Keep generated files, OS metadata, old docs, temporary caches, and dead examples out of the public repository surface.
31
+
32
+ ## 11.3 Current Residual Risks
33
+
34
+ | Risk | Severity | Mitigation |
35
+ | --- | --- | --- |
36
+ | Live x402 settlement behavior depends on the deployed facilitator and Solana RPC reliability. | Medium | Run devnet and mainnet payment smoke tests before public launch. |
37
+ | Hosted remote deployment still needs TLS, process monitoring, and log shipping outside the Node process. | Medium | Use Caddy or nginx in front of PM2 and monitor auth, rate-limit, and payment failure metrics. |
38
+ | `synapse-client-sdk` emits missing sourcemap warnings during tests. | Low | Non-blocking; track upstream package packaging quality. |
39
+ | Local keypair mode remains powerful by design. | Medium | Keep approval thresholds, daily limits, and external signer mode available for production operators. |
40
+
41
+ ## 11.4 Verification Command
42
+
43
+ Run the full local release gate before publishing or deploying:
44
+
45
+ ```bash
46
+ pnpm run verify:release
47
+ ```
48
+
49
+ This command runs typecheck, lint, tests, build, and npm package dry-run.
@@ -0,0 +1,55 @@
1
+ /**
2
+ * SAP MCP Server PM2 ecosystem shape example.
3
+ *
4
+ * This file is intentionally non-production and uses placeholders. Copy it into a
5
+ * private infrastructure repository before adding real paths, ports, recipients,
6
+ * RPC providers, auth tokens, or signer locations.
7
+ */
8
+ module.exports = {
9
+ apps: [
10
+ {
11
+ name: 'sap-mcp-remote',
12
+ script: 'dist/remote/server.js',
13
+ cwd: '<repo-root>',
14
+ instances: 1,
15
+ exec_mode: 'fork',
16
+ max_memory_restart: '1G',
17
+ env: {
18
+ NODE_ENV: 'production',
19
+ SAP_MCP_HOST: '<private-listener-host>',
20
+ SAP_MCP_PORT: '<private-listener-port>',
21
+ SAP_MCP_AUTH_TYPE: 'none',
22
+ SAP_MCP_PROFILE: '<hosted-profile-name>',
23
+ SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE: 'false',
24
+ SAP_MCP_LOG_LEVEL: 'info',
25
+ SAP_MCP_LOG_FORMAT: 'json',
26
+ SAP_MCP_MONETIZATION_ENABLED: 'true',
27
+ SAP_MCP_MONETIZATION_PROVIDER: 'x402',
28
+ SAP_MCP_MONETIZATION_PAY_TO: '<revenue-recipient>',
29
+ SAP_MCP_X402_FACILITATOR_URL: '<private-or-hosted-facilitator-url>',
30
+ SAP_MCP_X402_FACILITATOR_AUTH_TOKEN: '<private-facilitator-auth-token>',
31
+ },
32
+ },
33
+ {
34
+ name: 'sap-mcp-facilitator',
35
+ script: 'dist/payments/oobe-facilitator-server.js',
36
+ args: 'start',
37
+ cwd: '<repo-root>',
38
+ instances: 1,
39
+ exec_mode: 'fork',
40
+ max_memory_restart: '512M',
41
+ env: {
42
+ NODE_ENV: 'production',
43
+ SAP_MCP_FACILITATOR_HOST: '<private-listener-host>',
44
+ SAP_MCP_FACILITATOR_PORT: '<private-listener-port>',
45
+ SAP_MCP_FACILITATOR_PATH_PREFIX: '<facilitator-path-prefix>',
46
+ SAP_MCP_FACILITATOR_NETWORKS: '<enabled-networks>',
47
+ SAP_MCP_FACILITATOR_RPC_URL: '<private-rpc-url>',
48
+ SAP_MCP_FACILITATOR_SIGNER_PATH: '<private-facilitator-signer-path>',
49
+ SAP_MCP_FACILITATOR_AUTH_TOKEN: '<private-facilitator-auth-token>',
50
+ SAP_MCP_LOG_LEVEL: 'info',
51
+ SAP_MCP_LOG_FORMAT: 'json',
52
+ },
53
+ },
54
+ ],
55
+ };