@oobe-protocol-labs/sap-mcp-server 0.3.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -0
- package/CHANGELOG.md +222 -2
- package/README.md +63 -0
- package/USER_DOCS/00_START_HERE.md +23 -1
- package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +4 -1
- package/USER_DOCS/03_PAYMENTS_X402_PAYSH.md +63 -7
- package/USER_DOCS/04_CLIENT_CONFIGS.md +134 -6
- package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +262 -0
- package/dist/adapters/mcp/sdk-compat.d.ts.map +1 -1
- package/dist/adapters/mcp/sdk-compat.js +32 -18
- package/dist/adapters/mcp/sdk-compat.js.map +1 -1
- package/dist/config/mcp-client-injection.d.ts +64 -2
- package/dist/config/mcp-client-injection.d.ts.map +1 -1
- package/dist/config/mcp-client-injection.js +668 -11
- package/dist/config/mcp-client-injection.js.map +1 -1
- package/dist/config/wizard.d.ts.map +1 -1
- package/dist/config/wizard.js +89 -5
- package/dist/config/wizard.js.map +1 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/payments/facilitator-rpc-fallback.d.ts +43 -0
- package/dist/payments/facilitator-rpc-fallback.d.ts.map +1 -0
- package/dist/payments/facilitator-rpc-fallback.js +228 -0
- package/dist/payments/facilitator-rpc-fallback.js.map +1 -0
- package/dist/payments/json-rpc.d.ts.map +1 -1
- package/dist/payments/json-rpc.js +2 -1
- package/dist/payments/json-rpc.js.map +1 -1
- package/dist/payments/monetization-gate.d.ts +43 -2
- package/dist/payments/monetization-gate.d.ts.map +1 -1
- package/dist/payments/monetization-gate.js +618 -9
- package/dist/payments/monetization-gate.js.map +1 -1
- package/dist/payments/oobe-facilitator-server.d.ts +6 -0
- package/dist/payments/oobe-facilitator-server.d.ts.map +1 -1
- package/dist/payments/oobe-facilitator-server.js +79 -4
- package/dist/payments/oobe-facilitator-server.js.map +1 -1
- package/dist/payments/pricing.d.ts.map +1 -1
- package/dist/payments/pricing.js +1 -0
- package/dist/payments/pricing.js.map +1 -1
- package/dist/payments/usage-ledger.d.ts +10 -0
- package/dist/payments/usage-ledger.d.ts.map +1 -1
- package/dist/payments/usage-ledger.js +51 -0
- package/dist/payments/usage-ledger.js.map +1 -1
- package/dist/payments/x402-paid-call.d.ts +53 -0
- package/dist/payments/x402-paid-call.d.ts.map +1 -0
- package/dist/payments/x402-paid-call.js +370 -0
- package/dist/payments/x402-paid-call.js.map +1 -0
- package/dist/prompts/context/sap-agent-context.prompt.js +9 -3
- package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
- package/dist/prompts/developer/debug-sap-error.prompt.js +1 -1
- package/dist/prompts/developer/debug-sap-error.prompt.js.map +1 -1
- package/dist/prompts/developer/generate-sap-integration.prompt.js +6 -2
- package/dist/prompts/developer/generate-sap-integration.prompt.js.map +1 -1
- package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js +1 -1
- package/dist/prompts/execution-proof/explain-proof-of-execution.prompt.js.map +1 -1
- package/dist/prompts/execution-proof/verify-execution-proof.prompt.js +1 -1
- package/dist/prompts/execution-proof/verify-execution-proof.prompt.js.map +1 -1
- package/dist/prompts/payments/create-paid-api.prompt.js +1 -1
- package/dist/prompts/payments/create-paid-api.prompt.js.map +1 -1
- package/dist/prompts/payments/explain-x402-settlement.prompt.js +1 -1
- package/dist/prompts/payments/explain-x402-settlement.prompt.js.map +1 -1
- package/dist/prompts/register-prompts.js +2 -2
- package/dist/prompts/register-prompts.js.map +1 -1
- package/dist/prompts/registry/analyze-sap-agent.prompt.js +1 -1
- package/dist/prompts/registry/analyze-sap-agent.prompt.js.map +1 -1
- package/dist/prompts/registry/register-sap-agent.prompt.js +2 -2
- package/dist/prompts/registry/register-sap-agent.prompt.js.map +1 -1
- package/dist/remote/server.d.ts +132 -1
- package/dist/remote/server.d.ts.map +1 -1
- package/dist/remote/server.js +930 -49
- package/dist/remote/server.js.map +1 -1
- package/dist/resources/current/sap-current-config.resource.d.ts.map +1 -1
- package/dist/resources/current/sap-current-config.resource.js +11 -1
- package/dist/resources/current/sap-current-config.resource.js.map +1 -1
- package/dist/resources/execution-proof/sap-execution-record.resource.js +1 -1
- package/dist/resources/execution-proof/sap-execution-record.resource.js.map +1 -1
- package/dist/resources/memory/sap-memory.resource.js +1 -1
- package/dist/resources/memory/sap-memory.resource.js.map +1 -1
- package/dist/resources/profile/sap-active-profile.resource.js +1 -1
- package/dist/resources/profile/sap-active-profile.resource.js.map +1 -1
- package/dist/resources/register-resources.js +2 -2
- package/dist/resources/register-resources.js.map +1 -1
- package/dist/resources/registry/sap-agent.resource.js +1 -1
- package/dist/resources/registry/sap-agent.resource.js.map +1 -1
- package/dist/resources/registry/sap-global-registry.resource.js +1 -1
- package/dist/resources/registry/sap-global-registry.resource.js.map +1 -1
- package/dist/resources/reputation/sap-reputation.resource.js +1 -1
- package/dist/resources/reputation/sap-reputation.resource.js.map +1 -1
- package/dist/resources/stats/sap-network-stats.resource.js +1 -1
- package/dist/resources/stats/sap-network-stats.resource.js.map +1 -1
- package/dist/resources/tool-schema/sap-tool-schema.resource.js +1 -1
- package/dist/resources/tool-schema/sap-tool-schema.resource.js.map +1 -1
- package/dist/sap/sap-client-manager.js +5 -5
- package/dist/sap/sap-client-manager.js.map +1 -1
- package/dist/security/tool-permissions.d.ts.map +1 -1
- package/dist/security/tool-permissions.js +1 -0
- package/dist/security/tool-permissions.js.map +1 -1
- package/dist/server/create-server.js +5 -5
- package/dist/server/create-server.js.map +1 -1
- package/dist/server/register-capabilities.js +4 -4
- package/dist/server/register-capabilities.js.map +1 -1
- package/dist/signer/signer-resolver.js +1 -1
- package/dist/signer/signer-resolver.js.map +1 -1
- package/dist/tools/client-sdk-tools.js +7 -7
- package/dist/tools/client-sdk-tools.js.map +1 -1
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/magicblock-tools.d.ts +28 -0
- package/dist/tools/magicblock-tools.d.ts.map +1 -0
- package/dist/tools/magicblock-tools.js +578 -0
- package/dist/tools/magicblock-tools.js.map +1 -0
- package/dist/tools/profile-tools.d.ts.map +1 -1
- package/dist/tools/profile-tools.js +20 -0
- package/dist/tools/profile-tools.js.map +1 -1
- package/dist/tools/register-tools.d.ts.map +1 -1
- package/dist/tools/register-tools.js +11 -2
- package/dist/tools/register-tools.js.map +1 -1
- package/dist/tools/sap-sdk-tools.js +2 -2
- package/dist/tools/sap-sdk-tools.js.map +1 -1
- package/dist/tools/sap-sns-tools.js +2 -2
- package/dist/tools/sap-sns-tools.js.map +1 -1
- package/dist/tools/skills-tools.d.ts +1 -1
- package/dist/tools/skills-tools.d.ts.map +1 -1
- package/dist/tools/skills-tools.js +10 -1
- package/dist/tools/skills-tools.js.map +1 -1
- package/dist/tools/tool-aliases.d.ts +10 -0
- package/dist/tools/tool-aliases.d.ts.map +1 -0
- package/dist/tools/tool-aliases.js +23 -0
- package/dist/tools/tool-aliases.js.map +1 -0
- package/dist/tools/x402-paid-call-tool.d.ts +12 -0
- package/dist/tools/x402-paid-call-tool.d.ts.map +1 -0
- package/dist/tools/x402-paid-call-tool.js +118 -0
- package/dist/tools/x402-paid-call-tool.js.map +1 -0
- package/dist/wizard-core/desktop-flow.d.ts +82 -0
- package/dist/wizard-core/desktop-flow.d.ts.map +1 -0
- package/dist/wizard-core/desktop-flow.js +181 -0
- package/dist/wizard-core/desktop-flow.js.map +1 -0
- package/docs/00_README.md +3 -0
- package/docs/03_CONFIGURATION_AND_WIZARD.md +31 -5
- package/docs/06_PAYMENTS_X402_AND_PAYSH.md +70 -7
- package/docs/07_ENDPOINTS_AND_CLIENTS.md +28 -1
- package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +7 -6
- package/docs/13_BOUNTY_PROGRAM_PROPOSAL.md +469 -0
- package/docs/14_DESKTOP_WIZARD_RELEASE.md +264 -0
- package/docs/README.md +104 -0
- package/docs/_sidebar.md +31 -0
- package/docs/magicblock-tools.md +166 -0
- package/docs/x402-protocol-spec.md +984 -0
- package/package.json +23 -2
- package/server.json +71 -0
- package/skills/sap-defi/SKILL.md +8 -0
- package/skills/sap-mcp/SKILL.md +30 -0
- package/skills/sap-payments-x402/SKILL.md +36 -4
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oobe-protocol-labs/sap-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"mcpName": "ai.oobeprotocol.sap.mcp/sap-mcp",
|
|
4
5
|
"description": "Official MCP gateway for OOBE Protocol SAP — AI agents can interact with SAP identity, registry, reputation, tools, memory, payments, settlement, and proof-of-execution on Solana",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
@@ -13,7 +14,8 @@
|
|
|
13
14
|
"sap-signing-proxy": "dist/signer/signing-proxy.js",
|
|
14
15
|
"sap-mcp-remote": "dist/bin/sap-mcp-remote.js",
|
|
15
16
|
"sap-mcp-facilitator": "dist/payments/oobe-facilitator-server.js",
|
|
16
|
-
"sap-mcp-pay-sh-spec": "dist/payments/pay-sh-spec.js"
|
|
17
|
+
"sap-mcp-pay-sh-spec": "dist/payments/pay-sh-spec.js",
|
|
18
|
+
"sap-mcp-x402-paid-call": "dist/payments/x402-paid-call.js"
|
|
17
19
|
},
|
|
18
20
|
"files": [
|
|
19
21
|
"dist",
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
"README.md",
|
|
25
27
|
"CHANGELOG.md",
|
|
26
28
|
"LICENSE",
|
|
29
|
+
"server.json",
|
|
27
30
|
".env.example",
|
|
28
31
|
"config.example.json",
|
|
29
32
|
"config.secure-example.json",
|
|
@@ -43,6 +46,10 @@
|
|
|
43
46
|
"build": "pnpm run clean && tsc && tsc -p tsconfig.tui.json",
|
|
44
47
|
"build:core": "tsc",
|
|
45
48
|
"build:tui": "tsc -p tsconfig.tui.json",
|
|
49
|
+
"desktop:renderer": "vite --config apps/desktop/vite.config.ts",
|
|
50
|
+
"desktop:renderer:build": "vite build --config apps/desktop/vite.config.ts",
|
|
51
|
+
"desktop:build": "pnpm run build && pnpm run desktop:renderer:build && electron-builder --config apps/desktop/electron-builder.cjs --publish never",
|
|
52
|
+
"desktop:verify-artifact": "node scripts/verify-desktop-artifact.mjs",
|
|
46
53
|
"dev": "tsx src/cli.ts",
|
|
47
54
|
"start": "node dist/cli.js",
|
|
48
55
|
"config": "tsx src/config-cli.ts",
|
|
@@ -67,6 +74,14 @@
|
|
|
67
74
|
],
|
|
68
75
|
"author": "OOBE Protocol Labs",
|
|
69
76
|
"license": "MIT",
|
|
77
|
+
"homepage": "https://mcp.sap.oobeprotocol.ai/",
|
|
78
|
+
"repository": {
|
|
79
|
+
"type": "git",
|
|
80
|
+
"url": "git+https://github.com/OOBE-PROTOCOL/sap-mcp.git"
|
|
81
|
+
},
|
|
82
|
+
"bugs": {
|
|
83
|
+
"url": "https://github.com/OOBE-PROTOCOL/sap-mcp/issues"
|
|
84
|
+
},
|
|
70
85
|
"dependencies": {
|
|
71
86
|
"@bonfida/spl-name-service": "3.0.9",
|
|
72
87
|
"@coral-xyz/anchor": "^0.30.1",
|
|
@@ -94,17 +109,23 @@
|
|
|
94
109
|
"js-sha256": "^0.11.0",
|
|
95
110
|
"jsonwebtoken": "^9.0.0",
|
|
96
111
|
"react": "^19.2.7",
|
|
112
|
+
"react-dom": "^19.2.7",
|
|
97
113
|
"tweetnacl": "^1.0.3",
|
|
98
114
|
"ws": "^8.21.0",
|
|
99
115
|
"zod": "^3.23.0"
|
|
100
116
|
},
|
|
101
117
|
"devDependencies": {
|
|
118
|
+
"@electron/notarize": "2.5.0",
|
|
102
119
|
"@eslint/js": "^9.39.4",
|
|
103
120
|
"@types/bn.js": "^5.2.0",
|
|
104
121
|
"@types/cors": "^2.8.0",
|
|
105
122
|
"@types/express": "^4.17.0",
|
|
106
123
|
"@types/node": "^22.0.0",
|
|
107
124
|
"@types/react": "^19.2.17",
|
|
125
|
+
"@types/react-dom": "^19.2.3",
|
|
126
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
127
|
+
"electron": "^39.2.7",
|
|
128
|
+
"electron-builder": "^26.0.12",
|
|
108
129
|
"eslint": "^9.0.0",
|
|
109
130
|
"tsx": "^4.19.0",
|
|
110
131
|
"typescript": "^5.7.0",
|
package/server.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "ai.oobeprotocol.sap.mcp/sap-mcp",
|
|
4
|
+
"title": "SAP MCP Server",
|
|
5
|
+
"description": "Solana-native MCP gateway for SAP, DeFi tools, SNS identity, and x402 payments.",
|
|
6
|
+
"version": "0.7.1",
|
|
7
|
+
"websiteUrl": "https://mcp.sap.oobeprotocol.ai/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/OOBE-PROTOCOL/sap-mcp",
|
|
10
|
+
"source": "github",
|
|
11
|
+
"id": "1283972695"
|
|
12
|
+
},
|
|
13
|
+
"icons": [
|
|
14
|
+
{
|
|
15
|
+
"src": "https://mcp.sap.oobeprotocol.ai/favicon.png",
|
|
16
|
+
"mimeType": "image/png",
|
|
17
|
+
"sizes": [
|
|
18
|
+
"512x512"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"remotes": [
|
|
23
|
+
{
|
|
24
|
+
"type": "streamable-http",
|
|
25
|
+
"url": "https://mcp.sap.oobeprotocol.ai/mcp"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"packages": [
|
|
29
|
+
{
|
|
30
|
+
"registryType": "npm",
|
|
31
|
+
"identifier": "@oobe-protocol-labs/sap-mcp-server",
|
|
32
|
+
"version": "0.7.1",
|
|
33
|
+
"transport": {
|
|
34
|
+
"type": "stdio"
|
|
35
|
+
},
|
|
36
|
+
"runtimeHint": "npx",
|
|
37
|
+
"runtimeArguments": [
|
|
38
|
+
{
|
|
39
|
+
"type": "positional",
|
|
40
|
+
"value": "--yes"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "positional",
|
|
44
|
+
"value": "--package"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "positional",
|
|
48
|
+
"value": "@oobe-protocol-labs/sap-mcp-server@0.7.1"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "positional",
|
|
52
|
+
"value": "sap-mcp-server"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"environmentVariables": [
|
|
56
|
+
{
|
|
57
|
+
"name": "SAP_MCP_ALLOW_ENV_CONFIG_OVERRIDE",
|
|
58
|
+
"description": "Keep SAP MCP pointed at the active profile manager instead of stale client env overrides.",
|
|
59
|
+
"format": "boolean",
|
|
60
|
+
"value": "false"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "SAP_LOG_LEVEL",
|
|
64
|
+
"description": "Runtime log level for local SAP MCP stdio sessions.",
|
|
65
|
+
"format": "string",
|
|
66
|
+
"default": "info"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
package/skills/sap-defi/SKILL.md
CHANGED
|
@@ -44,8 +44,16 @@ staking protocols.
|
|
|
44
44
|
`jupiter_swapInstructions`.
|
|
45
45
|
3. Explain slippage, route, token mints, amount units, and expected output.
|
|
46
46
|
4. Preview and policy-check before signing.
|
|
47
|
+
5. For any unsigned or partially signed transaction returned by Jupiter, use
|
|
48
|
+
`sap_preview_transaction`, `sap_sign_transaction`, and
|
|
49
|
+
`sap_submit_signed_transaction`. Do not write ad-hoc signing scripts.
|
|
47
50
|
|
|
48
51
|
## Safety
|
|
49
52
|
|
|
50
53
|
DeFi execution can lose funds through slippage, MEV, wrong decimals, or bad
|
|
51
54
|
mints. Do not proceed from ticker symbols alone when mint addresses are needed.
|
|
55
|
+
Never read, print, export, or pass keypair bytes through shell commands,
|
|
56
|
+
environment variables, temporary scripts, screenshots, prompts, or MCP client
|
|
57
|
+
config. If a transaction cannot be decoded by SAP MCP transaction tools, stop
|
|
58
|
+
and report the unsupported transaction format instead of manually signing raw
|
|
59
|
+
message bytes.
|
package/skills/sap-mcp/SKILL.md
CHANGED
|
@@ -54,6 +54,14 @@ Use the bundled routing map for local MCP tool selection:
|
|
|
54
54
|
- `skills/sap-mcp/TOOL_REFERENCE.md`
|
|
55
55
|
- `USER_DOCS/05_SKILLS_AND_TOOLS.md`
|
|
56
56
|
|
|
57
|
+
SAP MCP skill bootstrap tools are free context/setup tools. Call
|
|
58
|
+
`sap_skills_list`, `sap_skills_bundle`, and local `sap_skills_install`
|
|
59
|
+
directly. Do not route skill listing, bundling, or installation through
|
|
60
|
+
`sap_x402_paid_call`. On hosted remote MCP, use `sap_skills_bundle` to download
|
|
61
|
+
skill contents; the hosted server cannot install files onto the caller's local
|
|
62
|
+
machine. Local installation belongs to the wizard, desktop app, addon installer,
|
|
63
|
+
or a local stdio SAP MCP process.
|
|
64
|
+
|
|
57
65
|
## Hosted Remote MCP
|
|
58
66
|
|
|
59
67
|
Canonical hosted endpoint:
|
|
@@ -98,6 +106,12 @@ Hosted users still need a local SAP MCP profile when they sign x402/pay.sh
|
|
|
98
106
|
payments, SAP transactions, Solana transactions, SNS operations, or settlement
|
|
99
107
|
actions. The hosted MCP server is not a wallet custodian.
|
|
100
108
|
|
|
109
|
+
For hosted paid tools, use the native x402 flow. If the client runtime cannot
|
|
110
|
+
attach `PAYMENT-SIGNATURE` itself, use the local `x402_paid_call` addon installed
|
|
111
|
+
by the wizard or the local MCP helper `sap_x402_paid_call`. That helper signs
|
|
112
|
+
payment payloads with the user's local SAP MCP profile and retries the hosted
|
|
113
|
+
tool call. It must not be treated as a remote hosted signing service.
|
|
114
|
+
|
|
101
115
|
When connected to hosted SAP MCP, `signerConfigured: false` on the remote
|
|
102
116
|
server means the hosted server is non-custodial. It does not mean the remote
|
|
103
117
|
tool surface is unavailable. Do not silently switch to local stdio just because
|
|
@@ -105,6 +119,22 @@ a hosted call requires x402 payment or because the hosted server does not hold
|
|
|
105
119
|
the user's signer. Use the hosted x402 flow first; ask the user before using a
|
|
106
120
|
local stdio fallback.
|
|
107
121
|
|
|
122
|
+
If a hosted paid tool returns `BlockhashNotFound`,
|
|
123
|
+
`transaction_simulation_failed`, `smart_wallet_simulation_failed`, `node is
|
|
124
|
+
behind`, `minimum context slot`, `fetch failed`, `gateway timeout`, or a
|
|
125
|
+
response marked `retryable: true`, treat it as a transient x402/Solana RPC
|
|
126
|
+
settlement error. Do not claim that SAP MCP is down unless `/health` also
|
|
127
|
+
fails. Do not bypass the paid hosted path with terminal/direct RPC. Retry
|
|
128
|
+
through the local `sap_x402_paid_call` bridge with the same tool name and
|
|
129
|
+
arguments, `confirm: true`, and `maxAttempts: 5` so a fresh payment payload is
|
|
130
|
+
created.
|
|
131
|
+
|
|
132
|
+
When summarizing a hosted connection, use language like:
|
|
133
|
+
"server is non-custodial; user signatures come from the local SAP profile or
|
|
134
|
+
external signer." Avoid saying "signer not configured", "read-only only",
|
|
135
|
+
"writes unavailable", or "remote MCP broken" unless a specific tool returns
|
|
136
|
+
that exact operational error.
|
|
137
|
+
|
|
108
138
|
## Profile Tools
|
|
109
139
|
|
|
110
140
|
| Tool | Purpose |
|
|
@@ -7,6 +7,7 @@ workflows, and hosted SAP MCP x402/pay.sh monetization.
|
|
|
7
7
|
|
|
8
8
|
- `sap_x402_prepare_payment`
|
|
9
9
|
- `sap_x402_get_balance`
|
|
10
|
+
- `sap_x402_paid_call`
|
|
10
11
|
- `sap_create_subscription`
|
|
11
12
|
- `sap_fund_subscription`
|
|
12
13
|
- `sap_cancel_subscription`
|
|
@@ -29,6 +30,10 @@ requests. Local `stdio` usage remains free and should not attempt x402 payment.
|
|
|
29
30
|
Do not treat hosted `402 Payment Required` as a failure; it is the expected
|
|
30
31
|
payment handshake. Do not silently bypass hosted paid tools by switching to a
|
|
31
32
|
local free stdio MCP server unless the user explicitly asks for local execution.
|
|
33
|
+
If `sap_profile_current` says the hosted server has no signer, treat that as
|
|
34
|
+
the non-custodial model: OOBE does not hold user keys. Paid and value-moving
|
|
35
|
+
hosted calls still proceed through x402/pay.sh plus the user's local SAP profile
|
|
36
|
+
or external signer.
|
|
32
37
|
|
|
33
38
|
- Free: `tools/list`, `prompts/list`, `resources/list`, `sap_profile_current`,
|
|
34
39
|
`sap_get_network_overview`.
|
|
@@ -46,16 +51,43 @@ it for browser/manual checkout flows.
|
|
|
46
51
|
For fast x402 execution:
|
|
47
52
|
|
|
48
53
|
1. Reuse the MCP session returned by `initialize`.
|
|
49
|
-
2.
|
|
50
|
-
|
|
54
|
+
2. Retry the same MCP method and params after payment. The JSON-RPC `id` may
|
|
55
|
+
change, but the tool name and arguments must match the challenge.
|
|
51
56
|
3. Use `PAYMENT-SIGNATURE` first; use `X-PAYMENT` only for clients that require
|
|
52
57
|
the alternate header.
|
|
53
58
|
4. Cache free `tools/list`, `prompts/list`, and `resources/list` locally rather
|
|
54
59
|
than paying or re-fetching repeatedly.
|
|
55
60
|
5. Treat `PAYMENT-RESPONSE` as the receipt bound to the tool output.
|
|
56
61
|
6. If the client runtime cannot sign or attach x402 payment headers, ask the
|
|
57
|
-
user to run the SAP MCP wizard
|
|
58
|
-
local stdio automatically.
|
|
62
|
+
user to run the SAP MCP wizard and install the local `x402_paid_call` addon
|
|
63
|
+
instead of falling back to local stdio automatically.
|
|
64
|
+
|
|
65
|
+
When available locally, call `sap_x402_paid_call` with `toolName`, `arguments`,
|
|
66
|
+
`maxPriceUsd`, and `confirm: true`. It initializes the hosted MCP session,
|
|
67
|
+
signs the x402 payment with the user SAP MCP profile wallet, retries the hosted
|
|
68
|
+
tool call, and returns the settlement receipt. The OOBE hosted server should
|
|
69
|
+
not expose this helper when it has no local user wallet because payment signing
|
|
70
|
+
belongs on the user's machine.
|
|
71
|
+
|
|
72
|
+
## Transient Settlement Errors
|
|
73
|
+
|
|
74
|
+
If a hosted paid call fails with `BlockhashNotFound`,
|
|
75
|
+
`transaction_simulation_failed`, `smart_wallet_simulation_failed`, `node is
|
|
76
|
+
behind`, `minimum context slot`, `fetch failed`, `gateway timeout`, or a
|
|
77
|
+
response marked `retryable: true`, treat it as a transient x402/Solana RPC
|
|
78
|
+
settlement failure. Do not say the SAP MCP server is down unless `/health`
|
|
79
|
+
also fails. Do not switch to terminal/direct RPC to bypass payment, and do not
|
|
80
|
+
reuse the old signed payment payload.
|
|
81
|
+
|
|
82
|
+
Correct recovery:
|
|
83
|
+
|
|
84
|
+
1. Call the local `sap_x402_paid_call` bridge again with the same `toolName`
|
|
85
|
+
and `arguments`.
|
|
86
|
+
2. Set `maxAttempts: 5` when the runtime supports it.
|
|
87
|
+
3. Let the helper create a fresh x402 challenge and payment payload for each
|
|
88
|
+
attempt.
|
|
89
|
+
4. If all attempts fail, report that x402 settlement is temporarily unavailable
|
|
90
|
+
and ask the user to retry or repair the facilitator/RPC deployment.
|
|
59
91
|
|
|
60
92
|
References: `USER_DOCS/03_PAYMENTS_X402_PAYSH.md` and
|
|
61
93
|
`docs/06_PAYMENTS_X402_AND_PAYSH.md`.
|