@oobe-protocol-labs/sap-mcp-server 0.1.0 → 0.2.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 (108) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +21 -2
  3. package/USER_DOCS/00_START_HERE.md +130 -0
  4. package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +106 -0
  5. package/USER_DOCS/02_LOCAL_STDIO_MCP.md +91 -0
  6. package/USER_DOCS/03_PAYMENTS_X402_PAYSH.md +212 -0
  7. package/USER_DOCS/04_CLIENT_CONFIGS.md +73 -0
  8. package/USER_DOCS/05_SKILLS_AND_TOOLS.md +81 -0
  9. package/assets/explorer_logo.png +0 -0
  10. package/dist/bin/sap-mcp-remote.d.ts +3 -0
  11. package/dist/bin/sap-mcp-remote.d.ts.map +1 -0
  12. package/dist/bin/sap-mcp-remote.js +10 -0
  13. package/dist/bin/sap-mcp-remote.js.map +1 -0
  14. package/dist/bin/sap-mcp-server.d.ts +3 -0
  15. package/dist/bin/sap-mcp-server.d.ts.map +1 -0
  16. package/dist/bin/sap-mcp-server.js +9 -0
  17. package/dist/bin/sap-mcp-server.js.map +1 -0
  18. package/dist/config/env.d.ts +14 -14
  19. package/dist/config/env.d.ts.map +1 -1
  20. package/dist/config/env.js +30 -7
  21. package/dist/config/env.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.d.ts +5 -0
  25. package/dist/core/logger.d.ts.map +1 -1
  26. package/dist/core/logger.js +61 -3
  27. package/dist/core/logger.js.map +1 -1
  28. package/dist/payments/monetization-gate.d.ts +6 -1
  29. package/dist/payments/monetization-gate.d.ts.map +1 -1
  30. package/dist/payments/monetization-gate.js +25 -8
  31. package/dist/payments/monetization-gate.js.map +1 -1
  32. package/dist/payments/oobe-facilitator-server.js +2 -2
  33. package/dist/payments/oobe-facilitator-server.js.map +1 -1
  34. package/dist/payments/pay-sh-spec.d.ts.map +1 -1
  35. package/dist/payments/pay-sh-spec.js +2 -1
  36. package/dist/payments/pay-sh-spec.js.map +1 -1
  37. package/dist/payments/usage-ledger.d.ts +9 -1
  38. package/dist/payments/usage-ledger.d.ts.map +1 -1
  39. package/dist/payments/usage-ledger.js +29 -1
  40. package/dist/payments/usage-ledger.js.map +1 -1
  41. package/dist/prompts/context/sap-agent-context.prompt.js +2 -2
  42. package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
  43. package/dist/remote/rate-limiter.d.ts +57 -0
  44. package/dist/remote/rate-limiter.d.ts.map +1 -0
  45. package/dist/remote/rate-limiter.js +127 -0
  46. package/dist/remote/rate-limiter.js.map +1 -0
  47. package/dist/remote/server.d.ts +68 -0
  48. package/dist/remote/server.d.ts.map +1 -1
  49. package/dist/remote/server.js +297 -19
  50. package/dist/remote/server.js.map +1 -1
  51. package/dist/resources/current/sap-current-config.resource.js +2 -2
  52. package/dist/resources/current/sap-current-config.resource.js.map +1 -1
  53. package/dist/resources/stats/sap-network-stats.resource.js +2 -2
  54. package/dist/resources/stats/sap-network-stats.resource.js.map +1 -1
  55. package/dist/runtime/module-resolution.d.ts +6 -0
  56. package/dist/runtime/module-resolution.d.ts.map +1 -0
  57. package/dist/runtime/module-resolution.js +30 -0
  58. package/dist/runtime/module-resolution.js.map +1 -0
  59. package/dist/security/tool-permissions.d.ts.map +1 -1
  60. package/dist/security/tool-permissions.js +25 -0
  61. package/dist/security/tool-permissions.js.map +1 -1
  62. package/dist/server/server-metadata.d.ts +1 -0
  63. package/dist/server/server-metadata.d.ts.map +1 -1
  64. package/dist/server/server-metadata.js +3 -2
  65. package/dist/server/server-metadata.js.map +1 -1
  66. package/dist/tools/chat-tools.d.ts +14 -0
  67. package/dist/tools/chat-tools.d.ts.map +1 -0
  68. package/dist/tools/chat-tools.js +697 -0
  69. package/dist/tools/chat-tools.js.map +1 -0
  70. package/dist/tools/client-sdk-tools.d.ts.map +1 -1
  71. package/dist/tools/client-sdk-tools.js +178 -2
  72. package/dist/tools/client-sdk-tools.js.map +1 -1
  73. package/dist/tools/index.d.ts +1 -0
  74. package/dist/tools/index.d.ts.map +1 -1
  75. package/dist/tools/index.js +2 -0
  76. package/dist/tools/index.js.map +1 -1
  77. package/dist/tools/profile-tools.d.ts.map +1 -1
  78. package/dist/tools/profile-tools.js +3 -2
  79. package/dist/tools/profile-tools.js.map +1 -1
  80. package/dist/tools/register-tools.d.ts.map +1 -1
  81. package/dist/tools/register-tools.js +3 -0
  82. package/dist/tools/register-tools.js.map +1 -1
  83. package/dist/tools/sap-network-stats.tool.js +2 -2
  84. package/dist/tools/sap-network-stats.tool.js.map +1 -1
  85. package/dist/tools/sap-sdk-tools.d.ts.map +1 -1
  86. package/dist/tools/sap-sdk-tools.js +34 -1
  87. package/dist/tools/sap-sdk-tools.js.map +1 -1
  88. package/dist/transports/http.js +3 -3
  89. package/dist/transports/http.js.map +1 -1
  90. package/docs/00_README.md +4 -0
  91. package/docs/01_PRODUCT_OVERVIEW.md +2 -1
  92. package/docs/02_ARCHITECTURE_AND_REQUEST_FLOW.md +1 -1
  93. package/docs/05_REMOTE_VPS_DEPLOYMENT.md +13 -0
  94. package/docs/07_ENDPOINTS_AND_CLIENTS.md +6 -1
  95. package/docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md +2 -1
  96. package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +13 -2
  97. package/docs/11_CODE_QUALITY_AUDIT.md +1 -1
  98. package/docs/12_ONCHAIN_AGENT_CHAT.md +178 -0
  99. package/package.json +24 -21
  100. package/skills/README.md +1 -0
  101. package/skills/sap-agent-chat/SKILL.md +71 -0
  102. package/skills/sap-mcp/SKILL.md +3 -2
  103. package/vendor/bigint-buffer/LICENSE +1 -0
  104. package/vendor/bigint-buffer/README.md +8 -0
  105. package/vendor/bigint-buffer/dist/browser.js +3 -0
  106. package/vendor/bigint-buffer/dist/index.d.ts +35 -0
  107. package/vendor/bigint-buffer/dist/node.js +62 -0
  108. package/vendor/bigint-buffer/package.json +20 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## 0.2.0 - 2026-07-02
6
+
7
+ ### Security
8
+
9
+ - Removed all known npm audit findings in the pnpm dependency graph; `pnpm audit --audit-level moderate` now exits cleanly.
10
+ - Upgraded the test/runtime toolchain to patched `vitest@4.1.9`, `vite@8.1.3`, and `esbuild@0.28.1`.
11
+ - Forced transitive `ws` resolution to `8.21.0` to avoid the memory-exhaustion DoS advisory.
12
+ - Vendored a pure JavaScript `bigint-buffer@1.1.6` compatibility package because the public package has a native binding advisory and no patched `1.1.6` release is published on npm.
13
+ - Raised the supported runtime to Node.js `>=22.12.0` and pnpm `11.7.0`, matching the Ink-based wizard and release lockfile behavior.
14
+
15
+ ### Changed
16
+
17
+ - Bumped package and server metadata to `0.2.0`.
18
+ - Added explicit pnpm workspace security policy for dependency overrides and approved native build scripts.
19
+
20
+ ### Verification
21
+
22
+ - `pnpm audit --audit-level moderate`
23
+ - `pnpm run typecheck`
24
+ - `pnpm run lint`
25
+ - `pnpm test -- --run`
26
+ - `pnpm run build`
27
+ - `pnpm run verify:release`
28
+
29
+ ## 0.1.1 - 2026-06-29
30
+
31
+ ### Added
32
+
33
+ - Added SAP session-ledger chat tools for deterministic public rooms, signed thematic group chats, chunked message writes, latest/all history reads, room status, and ledger sealing.
34
+ - Added `sap_chat_publish_manifest` so agents can publish signed room/group manifests for discovery indexers and policy-aware clients.
35
+ - Added on-chain agent chat documentation covering signed write proofs, room manifests, message envelopes, history fetching, IPFS/link sharing, privacy boundaries, and SDK-native `ChatManager` roadmap.
36
+ - Added a bundled `sap-agent-chat` skill so MCP clients can load correct group-room, manifest discovery, link sharing, history, and privacy instructions.
37
+
38
+ ### Fixed
39
+
40
+ - Fixed `npx`/`npm exec` startup for the default `sap-mcp-server` and `sap-mcp-remote` binaries by adding resolver-safe bootstrap entrypoints.
41
+ - Fixed hosted package execution when the SAP SDK resolves its bundled IDL assets from outside the package working directory.
42
+
5
43
  ## 0.1.0 - 2026-06-29
6
44
 
7
45
  ### Added
@@ -29,7 +67,7 @@ All notable changes to this project are documented in this file.
29
67
  - Hosted MCP onboarding now states that users connect to the hosted URL while x402/pay.sh payments and value-moving tool transactions still require a wizard-created user SAP profile and user-controlled signer.
30
68
  - Remote hosted deployments now publish `/.well-known/sap-mcp-wizard.json` and `/wizard/install.sh` so agents can direct users to the wizard when local SAP MCP config is missing or inaccessible.
31
69
  - Agent context prompts now instruct agents to preserve the user's request language and avoid exposing keypair material.
32
- - Tool documentation now reflects the current runtime registry: 232 tools.
70
+ - Tool documentation now reflects the current runtime registry and requires verification through `tools/list` because upstream SDK tool counts evolve.
33
71
  - Remote HTTP transports can now gate paid tool calls before execution and settle x402 payments after successful MCP responses.
34
72
  - Monetization now requires an explicit facilitator URL and documents OOBE hosted/self-hosted facilitator deployment.
35
73
  - Hybrid policy logging now uses the structured runtime logger instead of direct console output.
package/README.md CHANGED
@@ -9,11 +9,13 @@ SAP MCP exposes the same typed tool registry through two supported MCP launch mo
9
9
 
10
10
  It also includes a professional setup wizard, profile-managed config under `~/.config/mcp-sap`, optional Bento policy integration, local and external signing modes, x402 monetization, a self-hosted OOBE facilitator, pay.sh provider YAML generation, and an A2A-compatible discovery card.
11
11
 
12
+ User-facing setup docs live in [`USER_DOCS/`](USER_DOCS/00_START_HERE.md). Operator and engineering docs live in [`docs/`](docs/00_README.md).
13
+
12
14
  ## 1. Status
13
15
 
14
16
  | Area | Current behavior |
15
17
  | --- | --- |
16
- | Package version | `0.1.0` |
18
+ | Package version | `0.2.0` |
17
19
  | MCP transport | stdio locally, Streamable HTTP remotely |
18
20
  | Remote access | Bearerless public mode for hosted agents; API key or JWT for private modes |
19
21
  | Config directory | `~/.config/mcp-sap` only |
@@ -26,6 +28,15 @@ It also includes a professional setup wizard, profile-managed config under `~/.c
26
28
 
27
29
  ## 2. Install
28
30
 
31
+ Prerequisites:
32
+
33
+ ```bash
34
+ node --version # >= 22.12.0
35
+ corepack enable
36
+ corepack prepare pnpm@11.7.0 --activate
37
+ pnpm --version # 11.7.0
38
+ ```
39
+
29
40
  From source:
30
41
 
31
42
  ```bash
@@ -33,6 +44,8 @@ pnpm install
33
44
  pnpm run build
34
45
  ```
35
46
 
47
+ Do not use `npm install` for source deployments. This repository is locked and verified with pnpm.
48
+
36
49
  From the published package:
37
50
 
38
51
  ```bash
@@ -102,6 +115,9 @@ Production environment values should come from a private secret store or private
102
115
  Remote endpoints:
103
116
 
104
117
  ```text
118
+ GET /
119
+ GET /server.json
120
+ GET /favicon.png
105
121
  GET /health
106
122
  GET /.well-known/agent-card.json
107
123
  GET /.well-known/sap-mcp-wizard.json
@@ -111,6 +127,8 @@ GET /mcp
111
127
  DELETE /mcp
112
128
  ```
113
129
 
130
+ `GET /` is a public, share-safe landing page with Open Graph/Twitter metadata. It exposes only public server information; keypair bytes, private wallet paths, RPC query secrets, and VPS-local paths must never appear there.
131
+
114
132
  See [05. Remote VPS Deployment](docs/05_REMOTE_VPS_DEPLOYMENT.md) and [07. Endpoints And Clients](docs/07_ENDPOINTS_AND_CLIENTS.md).
115
133
 
116
134
  ## 6. Monetization
@@ -193,6 +211,7 @@ Start with [00. Documentation Index](docs/00_README.md).
193
211
  | [09. Tools, Skills, And Agent Guide](docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md) | Tool families, SDK doc pointers, skills, and agent behavior. |
194
212
  | [10. Operations, Release, And PM2](docs/10_OPERATIONS_RELEASE_AND_PM2.md) | Quality gates, PM2, secrets, release packaging, and changelog discipline. |
195
213
  | [11. Code Quality Audit](docs/11_CODE_QUALITY_AUDIT.md) | Current engineering scorecard, release gates, quality rules, and residual risks. |
214
+ | [12. On-Chain Agent Chat](docs/12_ONCHAIN_AGENT_CHAT.md) | Signed thematic group chat, room manifests, retrieval, link sharing, privacy boundaries, and SDK roadmap. |
196
215
 
197
216
  ## 9. Repository Layout
198
217
 
@@ -208,7 +227,7 @@ src/
208
227
  security/ Private-key, unsafe-action, and permission guards
209
228
  server/ MCP server factory and capability registration
210
229
  signer/ Local, delegated, and external signer adapters
211
- tools/ SAP, Solana, AgentKit, SNS, profile, skill, and payment tools
230
+ tools/ SAP, Solana, AgentKit, SNS, profile, skill, chat, and payment tools
212
231
  transports/ stdio and local HTTP transport helpers
213
232
  ```
214
233
 
@@ -0,0 +1,130 @@
1
+ # SAP MCP User Docs
2
+
3
+ ## 1. What SAP MCP Provides
4
+
5
+ SAP MCP is the hosted and local Model Context Protocol gateway for OOBE Protocol's Synapse Agent Protocol stack. It gives MCP-compatible agents access to SAP identity, discovery, reputation, memory, SNS, x402 payment flows, Solana protocol tools, and bundled SAP skills.
6
+
7
+ Use one of two deployment modes:
8
+
9
+ | Mode | Endpoint | Best For |
10
+ | --- | --- | --- |
11
+ | Hosted remote MCP | `https://mcp.sap.oobeprotocol.ai/mcp` | Users and agents that want OOBE-hosted tools over Streamable HTTP |
12
+ | Local stdio MCP | `node dist/cli.js` or `npx sap-mcp-server` | Local development, dedicated wallet profiles, local signing |
13
+
14
+ ## 2. Hosted Remote MCP Quick Start
15
+
16
+ Hosted MCP still requires a local SAP MCP profile when the agent needs to sign payments or value-moving transactions. The hosted server never receives keypair bytes. The user's machine or external signer owns the trust boundary.
17
+
18
+ Run the wizard:
19
+
20
+ ```bash
21
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
22
+ ```
23
+
24
+ Show the active profile:
25
+
26
+ ```bash
27
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config show
28
+ ```
29
+
30
+ Hosted MCP URL:
31
+
32
+ ```txt
33
+ https://mcp.sap.oobeprotocol.ai/mcp
34
+ ```
35
+
36
+ Wizard descriptor:
37
+
38
+ ```txt
39
+ https://mcp.sap.oobeprotocol.ai/.well-known/sap-mcp-wizard.json
40
+ ```
41
+
42
+ ## 3. What The Wizard Creates
43
+
44
+ The wizard creates an isolated profile under:
45
+
46
+ ```txt
47
+ ~/.config/mcp-sap/
48
+ ```
49
+
50
+ Typical layout:
51
+
52
+ ```txt
53
+ ~/.config/mcp-sap/
54
+ config.json
55
+ config-<profile>.json
56
+ keypairs/
57
+ <profile>-keypair.json
58
+ ```
59
+
60
+ The wizard does not modify the Solana CLI keypair unless the user explicitly points a profile at it. The recommended path is a dedicated SAP MCP keypair per agent profile.
61
+
62
+ ## 4. MCP Client Setup
63
+
64
+ Use hosted remote MCP in MCP-compatible clients by pointing the client at:
65
+
66
+ ```txt
67
+ https://mcp.sap.oobeprotocol.ai/mcp
68
+ ```
69
+
70
+ The wizard can inject client config automatically for Claude, Hermes, OpenClaw, and Codex, or print manual snippets.
71
+
72
+ Minimal hosted MCP client concept:
73
+
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "sap": {
78
+ "url": "https://mcp.sap.oobeprotocol.ai/mcp",
79
+ "transport": "streamable-http"
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ If a client does not support remote Streamable HTTP MCP yet, use local stdio mode and let the local server connect to the same SAP/Solana stack.
86
+
87
+ ## 5. Safety Rules For Agents
88
+
89
+ Agents should follow these rules:
90
+
91
+ 1. Never read keypair bytes.
92
+ 2. Never print wallet secret material.
93
+ 3. Use `sap_profile_current` before operational work.
94
+ 4. Use preview/sign/submit flows for transactions.
95
+ 5. Ask for user approval when policy requires it.
96
+ 6. Treat hosted paid tools as x402/pay.sh-gated resources.
97
+ 7. Load SAP MCP skills before using advanced tools.
98
+
99
+ ## 6. Core User Commands
100
+
101
+ ```bash
102
+ # Start the guided wizard
103
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
104
+
105
+ # Show active config
106
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config show
107
+
108
+ # Show active profile metadata
109
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config profile-info
110
+
111
+ # List pending secure config changes
112
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config pending
113
+
114
+ # Approve or deny a protected config change
115
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config approve <id>
116
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config deny <id>
117
+
118
+ # Show audit log
119
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config audit
120
+ ```
121
+
122
+ ## 7. Docs Map
123
+
124
+ | File | Purpose |
125
+ | --- | --- |
126
+ | `01_HOSTED_REMOTE_MCP.md` | Hosted setup for users and agents |
127
+ | `02_LOCAL_STDIO_MCP.md` | Local stdio setup and wallet profile flow |
128
+ | `03_PAYMENTS_X402_PAYSH.md` | x402, pay.sh pay-per-use, and pay.sh subscriptions |
129
+ | `04_CLIENT_CONFIGS.md` | Claude, Hermes, Codex, OpenClaw config examples |
130
+ | `05_SKILLS_AND_TOOLS.md` | Skills, tool selection, and security behavior |
@@ -0,0 +1,106 @@
1
+ # Hosted Remote MCP
2
+
3
+ ## 1. Endpoint
4
+
5
+ Use the OOBE-hosted SAP MCP endpoint:
6
+
7
+ ```txt
8
+ https://mcp.sap.oobeprotocol.ai/mcp
9
+ ```
10
+
11
+ Discovery endpoints:
12
+
13
+ ```txt
14
+ https://mcp.sap.oobeprotocol.ai/
15
+ https://mcp.sap.oobeprotocol.ai/server.json
16
+ https://mcp.sap.oobeprotocol.ai/health
17
+ https://mcp.sap.oobeprotocol.ai/.well-known/agent-card.json
18
+ https://mcp.sap.oobeprotocol.ai/.well-known/sap-mcp-wizard.json
19
+ https://mcp.sap.oobeprotocol.ai/wizard/install.sh
20
+ https://mcp.sap.oobeprotocol.ai/favicon.png
21
+ ```
22
+
23
+ The root page is safe to share publicly. It exposes professional metadata, favicon/social preview tags, and public endpoint information only. It must never expose RPC API keys, keypair paths, private VPS paths, or signer material.
24
+
25
+ ## 2. Why Hosted Users Still Need The Wizard
26
+
27
+ Hosted MCP executes tools remotely, but the user's wallet and signer should remain local or externally controlled. The wizard creates:
28
+
29
+ - an isolated SAP MCP profile;
30
+ - a dedicated wallet path or external signer reference;
31
+ - policy limits;
32
+ - optional MCP client config injection;
33
+ - local context for agents that need to sign x402/pay.sh payloads or Solana transactions.
34
+
35
+ The hosted server does not expose or store keypair bytes.
36
+
37
+ Read-only discovery can connect directly to the hosted MCP URL. Any agent that needs to sign x402/pay.sh payloads, SAP transactions, Solana transactions, SNS operations, or settlement actions should run the wizard first so the signer remains user-controlled.
38
+
39
+ ## 3. Install And Configure
40
+
41
+ ```bash
42
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
43
+ ```
44
+
45
+ Select hosted remote MCP when asked how the client should connect.
46
+
47
+ Then verify:
48
+
49
+ ```bash
50
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config show
51
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config profile-info
52
+ ```
53
+
54
+ ## 4. Test Hosted MCP Manually
55
+
56
+ Initialize:
57
+
58
+ ```bash
59
+ curl -iN https://mcp.sap.oobeprotocol.ai/mcp \
60
+ -H 'Content-Type: application/json' \
61
+ -H 'Accept: application/json, text/event-stream' \
62
+ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl-smoke","version":"0.1.0"}}}'
63
+ ```
64
+
65
+ Copy the returned `mcp-session-id`, then list tools:
66
+
67
+ ```bash
68
+ curl -iN https://mcp.sap.oobeprotocol.ai/mcp \
69
+ -H 'Content-Type: application/json' \
70
+ -H 'Accept: application/json, text/event-stream' \
71
+ -H 'mcp-session-id: <SESSION_ID>' \
72
+ -H 'mcp-protocol-version: 2025-06-18' \
73
+ -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
74
+ ```
75
+
76
+ ## 5. Free Tool Smoke Test
77
+
78
+ ```bash
79
+ curl -iN https://mcp.sap.oobeprotocol.ai/mcp \
80
+ -H 'Content-Type: application/json' \
81
+ -H 'Accept: application/json, text/event-stream' \
82
+ -H 'mcp-session-id: <SESSION_ID>' \
83
+ -H 'mcp-protocol-version: 2025-06-18' \
84
+ -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"sap_profile_current","arguments":{}}}'
85
+ ```
86
+
87
+ The RPC URL in returned metadata must be redacted if it contains query secrets.
88
+
89
+ ## 6. Paid Tool Smoke Test
90
+
91
+ ```bash
92
+ curl -iN https://mcp.sap.oobeprotocol.ai/mcp \
93
+ -H 'Content-Type: application/json' \
94
+ -H 'Accept: application/json, text/event-stream' \
95
+ -H 'mcp-session-id: <SESSION_ID>' \
96
+ -H 'mcp-protocol-version: 2025-06-18' \
97
+ -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"sap_list_all_agents","arguments":{"limit":5}}}'
98
+ ```
99
+
100
+ Expected result without payment proof:
101
+
102
+ ```txt
103
+ HTTP/1.1 402 Payment Required
104
+ ```
105
+
106
+ The response includes x402 payment instructions. Agents that support x402 can sign the payment payload and replay the exact request with the payment header.
@@ -0,0 +1,91 @@
1
+ # Local Stdio MCP
2
+
3
+ ## 1. When To Use Local Mode
4
+
5
+ Use local stdio mode when:
6
+
7
+ - the MCP client does not support remote Streamable HTTP;
8
+ - the user wants the entire MCP server running locally;
9
+ - transaction signing must happen on the user's machine;
10
+ - development or integration testing needs local logs.
11
+
12
+ ## 2. Create A Profile
13
+
14
+ ```bash
15
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-config wizard
16
+ ```
17
+
18
+ Recommended mode for local non-transactional inspection:
19
+
20
+ ```txt
21
+ readonly
22
+ ```
23
+
24
+ Recommended mode for local signing with a dedicated SAP wallet:
25
+
26
+ ```txt
27
+ local-dev-keypair
28
+ ```
29
+
30
+ Recommended mode for hardware/KMS/managed signers:
31
+
32
+ ```txt
33
+ external-signer
34
+ ```
35
+
36
+ ## 3. Start Local MCP
37
+
38
+ Installed package:
39
+
40
+ ```bash
41
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-server
42
+ ```
43
+
44
+ From a cloned repo:
45
+
46
+ ```bash
47
+ pnpm install --frozen-lockfile
48
+ pnpm run build
49
+ node dist/bin/sap-mcp-server.js
50
+ ```
51
+
52
+ ## 4. Config Directory
53
+
54
+ SAP MCP uses:
55
+
56
+ ```txt
57
+ ~/.config/mcp-sap
58
+ ```
59
+
60
+ Do not use the legacy path:
61
+
62
+ ```txt
63
+ ~/.config/sap-mcp
64
+ ```
65
+
66
+ Do not store SAP MCP keypairs in:
67
+
68
+ ```txt
69
+ ~/.config/solana/id.json
70
+ ```
71
+
72
+ unless the user intentionally chooses to reuse the Solana CLI identity.
73
+
74
+ ## 5. Local Client Config Concept
75
+
76
+ ```json
77
+ {
78
+ "mcpServers": {
79
+ "sap": {
80
+ "command": "node",
81
+ "args": ["/absolute/path/to/sap-mcp-server/dist/bin/sap-mcp-server.js"],
82
+ "cwd": "/absolute/path/to/sap-mcp-server",
83
+ "env": {
84
+ "SAP_MCP_PROFILE": "default"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ The wizard can generate or inject the correct client config.
@@ -0,0 +1,212 @@
1
+ # Payments: x402, pay.sh Pay-Per-Use, And pay.sh Subscriptions
2
+
3
+ ## 1. Payment Layers
4
+
5
+ SAP MCP supports two complementary payment layers:
6
+
7
+ | Layer | Purpose |
8
+ | --- | --- |
9
+ | Native x402 gate | Per-tool pricing inside hosted SAP MCP. Free tools remain free; premium tool calls return `402 Payment Required`. |
10
+ | pay.sh gateway | Optional outer HTTP gateway for metered pay-per-use endpoints or subscription-gated endpoints. |
11
+
12
+ Native SAP MCP x402 is authoritative per tool call. pay.sh is useful when exposing SAP MCP or adjacent HTTP APIs through a cataloged pay gateway.
13
+
14
+ Recommended split:
15
+
16
+ - use native SAP MCP x402 when the price depends on the MCP tool being called;
17
+ - use pay.sh pay-per-use when a normal HTTP route should charge per request or per measured unit;
18
+ - use pay.sh subscriptions when a route should be flat-fee access for a fixed period.
19
+
20
+ Do not put `metering:` and `subscription:` on the same pay.sh endpoint. Use separate endpoints or separate provider specs.
21
+
22
+ ## 2. Native x402 Tool Pricing
23
+
24
+ Free:
25
+
26
+ - `tools/list`
27
+ - `prompts/list`
28
+ - `resources/list`
29
+ - `sap_profile_current`
30
+ - basic overview/profile tools
31
+
32
+ Paid examples:
33
+
34
+ - premium reads such as `sap_list_all_agents`;
35
+ - enriched discovery and network analytics;
36
+ - SNS batch checks and builder tools;
37
+ - value-changing payment/settlement flows.
38
+
39
+ Without payment, a paid tool returns:
40
+
41
+ ```txt
42
+ HTTP/1.1 402 Payment Required
43
+ ```
44
+
45
+ The response contains payment instructions and the caller replays the same request with the payment header.
46
+
47
+ Hosted SAP MCP accepts payment proof headers used by the x402/payment flow and exposes settlement headers back to the caller:
48
+
49
+ | Direction | Header |
50
+ | --- | --- |
51
+ | Client payment proof | `PAYMENT-SIGNATURE` or `X-PAYMENT` |
52
+ | Server challenge | `PAYMENT-REQUIRED` |
53
+ | Server receipt | `PAYMENT-RESPONSE` or `X-PAYMENT-RESPONSE` |
54
+
55
+ The payment receipt should be treated as part of the tool output provenance. For paid hosted tools, agents should bind the receipt to the request hash, tool name, and returned result.
56
+
57
+ ## 3. pay.sh Pay-Per-Use
58
+
59
+ pay.sh pay-per-use uses a provider YAML with `metering:` on paid endpoints. The pay.sh docs describe this as stablecoin-gated HTTP where the first request receives a `402`, the client signs proof locally, and the gateway settles before forwarding upstream.
60
+
61
+ References:
62
+
63
+ - https://pay.sh/docs/building-with-pay/getting-started
64
+ - https://pay.sh/docs/building-with-pay/pricing
65
+ - https://pay.sh/docs/building-with-pay/yaml-specification
66
+
67
+ Generate a SAP MCP pay.sh spec:
68
+
69
+ ```bash
70
+ npm exec --yes --package @oobe-protocol-labs/sap-mcp-server -- sap-mcp-pay-sh-spec \
71
+ --out sap-mcp-pay-sh.yml \
72
+ --upstream-url https://mcp.sap.oobeprotocol.ai \
73
+ --network mainnet \
74
+ --recipient <OOBE_REVENUE_WALLET>
75
+ ```
76
+
77
+ Example metered block:
78
+
79
+ ```yaml
80
+ endpoints:
81
+ - method: POST
82
+ path: 'mcp'
83
+ description: 'SAP MCP JSON-RPC endpoint.'
84
+ metering:
85
+ dimensions:
86
+ - direction: usage
87
+ unit: requests
88
+ scale: 1
89
+ tiers:
90
+ - price_usd: 0.008
91
+ ```
92
+
93
+ pay.sh metered rules to keep:
94
+
95
+ 1. Free endpoints omit both `metering:` and `subscription:`.
96
+ 2. Simple per-call endpoints use `unit: requests` and `scale: 1`.
97
+ 3. Token, character, page, byte, or variant pricing should only be used when that unit is the real cost driver.
98
+ 4. Prices must remain representable in 6-decimal stablecoins.
99
+ 5. With `routing.type: proxy`, the gateway forwards only verified paid requests to the upstream.
100
+ 6. The gateway endpoint allowlist is explicit; routes not listed in `endpoints[]` are not exposed by pay.sh.
101
+
102
+ For SAP MCP, keep pay.sh upstream credentials in environment variables, not in the public YAML:
103
+
104
+ ```yaml
105
+ routing:
106
+ type: proxy
107
+ url: https://mcp.sap.oobeprotocol.ai/
108
+ operator:
109
+ currencies:
110
+ usd: ['USDC']
111
+ network: mainnet
112
+ recipient: '<OOBE_REVENUE_WALLET>'
113
+ ```
114
+
115
+ ## 4. pay.sh Subscriptions
116
+
117
+ pay.sh subscriptions use `subscription:` instead of `metering:`. A subscription gates an endpoint behind recurring flat-fee access for a fixed period. According to pay.sh docs, `metering:` and `subscription:` are mutually exclusive on the same endpoint, so use separate endpoints or separate provider specs when offering both.
118
+
119
+ References:
120
+
121
+ - https://pay.sh/docs/building-with-pay/subscriptions/concept
122
+ - https://pay.sh/docs/building-with-pay/subscriptions/yaml-specification
123
+ - https://pay.sh/docs/building-with-pay/subscriptions/examples
124
+
125
+ Example subscription endpoint:
126
+
127
+ ```yaml
128
+ endpoints:
129
+ - method: POST
130
+ path: 'mcp/subscription'
131
+ description: 'SAP MCP subscription access. Proxy/rewrite this endpoint to the MCP upstream when enabled.'
132
+ subscription:
133
+ period: '30d'
134
+ price_usd: 49.00
135
+ currency: USDC
136
+ ```
137
+
138
+ Operational notes:
139
+
140
+ 1. `period` accepts fixed days or weeks such as `30d`, `1w`, or `52w`.
141
+ 2. Month units are not valid because pay.sh periods are fixed elapsed time.
142
+ 3. The first launch publishes an on-chain Plan PDA when no `plan_id` exists.
143
+ 4. The generated `plan_id`, numeric plan metadata, and created-at metadata may be written back into the YAML by pay.sh.
144
+ 5. Use separate endpoints for pay-per-use and subscription access.
145
+ 6. A subscription endpoint is one price, one period, one endpoint. Build tier upgrades or prorations in your own product layer if needed.
146
+ 7. Subscription tiers are separate endpoints, each with its own `Plan` PDA.
147
+ 8. The subscriber activates once; repeated calls during the active period should not prompt for another payment.
148
+
149
+ Example product split for SAP MCP remote access:
150
+
151
+ ```yaml
152
+ endpoints:
153
+ - method: POST
154
+ path: 'mcp'
155
+ description: 'SAP MCP metered tool access.'
156
+ metering:
157
+ dimensions:
158
+ - direction: usage
159
+ unit: requests
160
+ scale: 1
161
+ tiers:
162
+ - price_usd: 0.008
163
+
164
+ - method: POST
165
+ path: 'mcp/pro'
166
+ description: 'SAP MCP pro subscription access, 30-day billing period.'
167
+ subscription:
168
+ period: '30d'
169
+ price_usd: 49.00
170
+ currency: USDC
171
+ ```
172
+
173
+ When using a subscription route in front of MCP, route or rewrite it to the upstream MCP server after pay.sh verifies the subscription. The MCP protocol endpoint itself remains `/mcp` on the upstream server.
174
+
175
+ Subscriber commands:
176
+
177
+ ```bash
178
+ # First call activates the subscription.
179
+ pay curl https://<pay-sh-provider-host>/mcp/pro
180
+
181
+ # Inspect active subscriptions.
182
+ pay subscriptions list
183
+ pay subscriptions list --network mainnet
184
+ pay subscriptions list --json
185
+ ```
186
+
187
+ ## 5. Recommended OOBE Product Split
188
+
189
+ | Product | Payment Model |
190
+ | --- | --- |
191
+ | Basic hosted discovery | Free |
192
+ | Premium reads | Native x402 per tool |
193
+ | Heavy analytics/builders | Native x402 per tool or pay.sh metered endpoint |
194
+ | Pro remote access | pay.sh subscription endpoint |
195
+ | Enterprise/custom routing | Dedicated subscription endpoint or private contract |
196
+
197
+ ## 6. Official pay.sh References Used
198
+
199
+ - Getting started: https://pay.sh/docs/building-with-pay/getting-started
200
+ - Pricing: https://pay.sh/docs/building-with-pay/pricing
201
+ - Provider YAML specification: https://pay.sh/docs/building-with-pay/yaml-specification
202
+ - Subscriptions concept: https://pay.sh/docs/building-with-pay/subscriptions/concept
203
+ - Subscriptions YAML specification: https://pay.sh/docs/building-with-pay/subscriptions/yaml-specification
204
+ - Subscription examples: https://pay.sh/docs/building-with-pay/subscriptions/examples
205
+
206
+ ## 7. Security Requirements
207
+
208
+ - Never put RPC API keys in public YAML.
209
+ - Never put private keypair paths in public docs.
210
+ - Use environment variables for upstream credentials.
211
+ - Keep facilitator and pay.sh operator keypairs separate from SAP agent wallets.
212
+ - Rotate any API key that appeared in logs before redaction was enabled.