@oobe-protocol-labs/sap-mcp-server 0.9.13 → 0.9.16

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 (87) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +2 -2
  3. package/USER_DOCS/00_START_HERE.md +24 -2
  4. package/USER_DOCS/03_PAYMENTS_X402_PAYSH.md +6 -1
  5. package/USER_DOCS/04_CLIENT_CONFIGS.md +4 -3
  6. package/USER_DOCS/05_SKILLS_AND_TOOLS.md +9 -4
  7. package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +6 -6
  8. package/dist/config/mcp-client-injection.d.ts.map +1 -1
  9. package/dist/config/mcp-client-injection.js +4 -3
  10. package/dist/config/mcp-client-injection.js.map +1 -1
  11. package/dist/core/constants.d.ts +9 -1
  12. package/dist/core/constants.d.ts.map +1 -1
  13. package/dist/core/constants.js +13 -3
  14. package/dist/core/constants.js.map +1 -1
  15. package/dist/payments/hosted-tool-eligibility.d.ts.map +1 -1
  16. package/dist/payments/hosted-tool-eligibility.js +3 -0
  17. package/dist/payments/hosted-tool-eligibility.js.map +1 -1
  18. package/dist/payments/index.d.ts +2 -2
  19. package/dist/payments/index.d.ts.map +1 -1
  20. package/dist/payments/index.js +1 -1
  21. package/dist/payments/index.js.map +1 -1
  22. package/dist/payments/pricing.d.ts +30 -0
  23. package/dist/payments/pricing.d.ts.map +1 -1
  24. package/dist/payments/pricing.js +142 -1
  25. package/dist/payments/pricing.js.map +1 -1
  26. package/dist/prompts/context/sap-agent-context.prompt.js +2 -0
  27. package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
  28. package/dist/prompts/context/sap-agent-start.prompt.js +2 -0
  29. package/dist/prompts/context/sap-agent-start.prompt.js.map +1 -1
  30. package/dist/prompts/registry/register-sap-agent.prompt.js +18 -18
  31. package/dist/prompts/registry/register-sap-agent.prompt.js.map +1 -1
  32. package/dist/remote/public-home/sections.d.ts.map +1 -1
  33. package/dist/remote/public-home/sections.js +4 -0
  34. package/dist/remote/public-home/sections.js.map +1 -1
  35. package/dist/remote/public-home/types.d.ts +1 -0
  36. package/dist/remote/public-home/types.d.ts.map +1 -1
  37. package/dist/remote/server.d.ts +1 -0
  38. package/dist/remote/server.d.ts.map +1 -1
  39. package/dist/remote/server.js +10 -2
  40. package/dist/remote/server.js.map +1 -1
  41. package/dist/security/tool-permissions.d.ts.map +1 -1
  42. package/dist/security/tool-permissions.js +9 -0
  43. package/dist/security/tool-permissions.js.map +1 -1
  44. package/dist/tools/agent-start-tool.d.ts.map +1 -1
  45. package/dist/tools/agent-start-tool.js +411 -1
  46. package/dist/tools/agent-start-tool.js.map +1 -1
  47. package/dist/tools/client-sdk-tools.js +3 -3
  48. package/dist/tools/client-sdk-tools.js.map +1 -1
  49. package/dist/tools/magicblock-tools.d.ts.map +1 -1
  50. package/dist/tools/magicblock-tools.js +43 -26
  51. package/dist/tools/magicblock-tools.js.map +1 -1
  52. package/dist/tools/sap-sdk-tools.d.ts +412 -1
  53. package/dist/tools/sap-sdk-tools.d.ts.map +1 -1
  54. package/dist/tools/sap-sdk-tools.js +1222 -40
  55. package/dist/tools/sap-sdk-tools.js.map +1 -1
  56. package/dist/tools/sap-sns-tools.d.ts.map +1 -1
  57. package/dist/tools/sap-sns-tools.js +6 -2
  58. package/dist/tools/sap-sns-tools.js.map +1 -1
  59. package/dist/tools/skills-tools.d.ts.map +1 -1
  60. package/dist/tools/skills-tools.js +2 -0
  61. package/dist/tools/skills-tools.js.map +1 -1
  62. package/dist/tools/tool-aliases.d.ts.map +1 -1
  63. package/dist/tools/tool-aliases.js +7 -0
  64. package/dist/tools/tool-aliases.js.map +1 -1
  65. package/dist/tools/x402-paid-call-tool.d.ts.map +1 -1
  66. package/dist/tools/x402-paid-call-tool.js +315 -15
  67. package/dist/tools/x402-paid-call-tool.js.map +1 -1
  68. package/docs/03_CONFIGURATION_AND_WIZARD.md +1 -0
  69. package/docs/06_PAYMENTS_X402_AND_PAYSH.md +56 -3
  70. package/docs/07_ENDPOINTS_AND_CLIENTS.md +2 -1
  71. package/docs/09_TOOLS_SKILLS_AND_AGENT_GUIDE.md +16 -5
  72. package/docs/14_DESKTOP_WIZARD_RELEASE.md +5 -4
  73. package/docs/16_SAP_AGENT_IDENTITY_PIPELINE.md +298 -0
  74. package/docs/README.md +2 -0
  75. package/docs/magicblock-tools.md +26 -0
  76. package/package.json +4 -1
  77. package/server.json +3 -3
  78. package/skills/README.md +10 -2
  79. package/skills/sap-agent-registry/SKILL.md +81 -8
  80. package/skills/sap-discovery-indexing/SKILL.md +11 -0
  81. package/skills/sap-escrow-settlement/SKILL.md +22 -4
  82. package/skills/sap-mcp/SKILL.md +84 -23
  83. package/skills/sap-mcp/TOOL_REFERENCE.md +38 -7
  84. package/skills/sap-nft-metaplex/SKILL.md +22 -0
  85. package/skills/sap-operations/SKILL.md +28 -0
  86. package/skills/sap-payments-x402/SKILL.md +38 -3
  87. package/skills/sap-sns/SKILL.md +17 -0
package/docs/README.md CHANGED
@@ -64,6 +64,7 @@ For paid/write hosted tools, also configure the local `sap_payments` bridge. The
64
64
  - [Client Configs](user/04_CLIENT_CONFIGS.md)
65
65
  - [Payments: x402 And pay.sh](user/03_PAYMENTS_X402_PAYSH.md)
66
66
  - [Smithery And MCP Marketplaces](user/07_SMITHERY_AND_MARKETPLACES.md)
67
+ - [SAP Agent Identity Pipeline](16_SAP_AGENT_IDENTITY_PIPELINE.md)
67
68
 
68
69
  ## What The Hosted Server Provides
69
70
 
@@ -116,6 +117,7 @@ Read these first:
116
117
  5. [Desktop GUI Wizard](user/06_DESKTOP_GUI_WIZARD.md)
117
118
  6. [Configuration And Wizard](03_CONFIGURATION_AND_WIZARD.md)
118
119
  7. [Endpoints And Clients](07_ENDPOINTS_AND_CLIENTS.md)
120
+ 8. [SAP Agent Identity Pipeline](16_SAP_AGENT_IDENTITY_PIPELINE.md)
119
121
 
120
122
  ## Public Endpoints
121
123
 
@@ -38,6 +38,10 @@ Do not hard-code MagicBlock prices in agents. Call `sap_x402_estimate_cost` or
38
38
  the local `sap_payments_call_paid_tool` helper and enforce the user profile's
39
39
  `maxPriceUsd` / spend policy.
40
40
 
41
+ Successful MagicBlock tool payloads intentionally do not report their own
42
+ price. Hosted cost is authoritative only in the SAP MCP x402 challenge and the
43
+ payment receipt returned by `sap_payments_call_paid_tool`.
44
+
41
45
  When a hosted MagicBlock builder returns an unsigned transaction, hosted SAP MCP
42
46
  remains non-custodial. Finalize the returned `transactionBase64` with the local
43
47
  `sap_payments_finalize_transaction` bridge. Do not call hosted
@@ -146,6 +150,28 @@ Expected flow:
146
150
  Agents must not create temporary JavaScript signing scripts, read keypair JSON,
147
151
  or sign raw message bytes outside SAP MCP transaction tools.
148
152
 
153
+ ## Safety Guardrails
154
+
155
+ SAP MCP fails closed for MagicBlock flows that live testing has shown to be
156
+ unsafe:
157
+
158
+ - `magicblock_swap` with `visibility: "private"` requires a valid
159
+ `destination`. The server rejects the request before contacting MagicBlock if
160
+ the destination is missing or invalid.
161
+ - `magicblock_swap` with `visibility: "private"` and
162
+ `quoteResponse.outputMint = So11111111111111111111111111111111111111112`
163
+ is blocked. Mainnet testing found that private swaps outputting wSOL can leave
164
+ funds stuck in the Hydra mixer pool when shuttle delivery fails. Use
165
+ `visibility: "public"` for SOL output, or swap privately into a non-SOL SPL
166
+ token until MagicBlock provides shuttle delivery recovery.
167
+ - `magicblock_transfer` requires `from`, `to`, `mint`, `amount`,
168
+ `visibility`, `fromBalance`, and `toBalance`. `amount` must be a positive
169
+ JavaScript-safe integer in token base units because the upstream API expects a
170
+ JSON number, not a string.
171
+ - Private transfers require a bearer token from `magicblock_challenge` and
172
+ `magicblock_login`. Private SOL transfers may deliver wSOL, not native SOL;
173
+ agents should say that clearly before asking for confirmation.
174
+
149
175
  ---
150
176
 
151
177
  ## Response Format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oobe-protocol-labs/sap-mcp-server",
3
- "version": "0.9.13",
3
+ "version": "0.9.16",
4
4
  "mcpName": "ai.oobeprotocol.sap.mcp/sap-mcp",
5
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",
6
6
  "type": "module",
@@ -148,7 +148,10 @@
148
148
  "packageManager": "pnpm@11.7.0",
149
149
  "overrides": {
150
150
  "bigint-buffer": "file:vendor/bigint-buffer",
151
+ "brace-expansion@<1.1.16": "1.1.16",
152
+ "brace-expansion@>=2.0.0 <2.1.2": "2.1.2",
151
153
  "esbuild": "^0.28.1",
154
+ "js-yaml@>=4.0.0 <4.3.0": "4.3.0",
152
155
  "langsmith": "^0.6.0",
153
156
  "uuid": "^11.1.1",
154
157
  "vite": "8.1.0",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "ai.oobeprotocol.sap.mcp/sap-mcp",
4
4
  "title": "SAP MCP Server | OOBE Protocol",
5
5
  "description": "Solana-native MCP gateway for SAP tools, DeFi, SNS identity, x402/pay.sh, and agent operations.",
6
- "version": "0.9.13",
6
+ "version": "0.9.16",
7
7
  "websiteUrl": "https://mcp.sap.oobeprotocol.ai/",
8
8
  "repository": {
9
9
  "url": "https://github.com/OOBE-PROTOCOL/sap-mcp",
@@ -29,7 +29,7 @@
29
29
  {
30
30
  "registryType": "npm",
31
31
  "identifier": "@oobe-protocol-labs/sap-mcp-server",
32
- "version": "0.9.13",
32
+ "version": "0.9.16",
33
33
  "transport": {
34
34
  "type": "stdio"
35
35
  },
@@ -45,7 +45,7 @@
45
45
  },
46
46
  {
47
47
  "type": "positional",
48
- "value": "@oobe-protocol-labs/sap-mcp-server@0.9.13"
48
+ "value": "@oobe-protocol-labs/sap-mcp-server@0.9.16"
49
49
  },
50
50
  {
51
51
  "type": "positional",
package/skills/README.md CHANGED
@@ -55,12 +55,20 @@ or wants to compare this bundled MCP skill pack with the source SDK skills:
55
55
  ## Agent Behavior
56
56
 
57
57
  - Answer in the same natural language as the user's latest request.
58
+ - Use free exact/base SAP reads before paid discovery when possible:
59
+ `sap_agent_context`, `sap_get_agent`, `sap_get_agent_profile`,
60
+ `sap_get_agent_stats`, `sap_is_agent_active`, `sap_get_global_state`, and
61
+ compact `sap_list_agents` pages with `limit <= 20`.
58
62
  - Use `sap_discover_agents` for targeted hosted agent search by query, wallet,
59
63
  PDA, protocol, capability, capability list, or x402 endpoint presence.
60
- - Use `sap_list_all_agents` for current global SAP ecosystem agent lists and
61
- continue with `pagination.nextCursor` when more pages are needed.
64
+ - Use `sap_list_all_agents` for current global SAP ecosystem agent lists only
65
+ when the user needs more than the free compact orientation page, and continue
66
+ with `pagination.nextCursor` when more pages are needed.
62
67
  - Treat `mcp_sap_<tool>` as a client display prefix; the callable MCP tool name
63
68
  inside this server is the suffix, for example `jupiter_getQuote`.
69
+ - Call `sap_agent_next_action` before retrying after `payment_required`,
70
+ `hosted_local_signer_required`, transient Solana RPC errors, a missing local
71
+ bridge, or a submitted signature that has not confirmed.
64
72
  - Use `skills/sap-mcp/TOOL_REFERENCE.md` and `USER_DOCS/05_SKILLS_AND_TOOLS.md`
65
73
  as the bundled routing maps when deciding which SAP MCP tool or skill domain
66
74
  applies to a user request.
@@ -6,15 +6,31 @@ state, global directory listing, and agent profile inspection.
6
6
  ## First Steps
7
7
 
8
8
  1. Call `sap_profile_current`.
9
- 2. Call `sap_get_network_overview` for ecosystem counters when needed.
10
- 3. Use `sap_discover_agents` with `query`, `wallet`, `protocol`, or
11
- `capability` for targeted paid hosted directory reads.
12
- 4. Use `sap_list_all_agents` for global current agent lists and follow
9
+ 2. Call `sap_protocol_invariants` before registry writes when treasury, fee,
10
+ hosted/local routing, or lifecycle-complete rules are unclear.
11
+ 3. For registration, profile-image updates, Metaplex identity, SNS linking, or
12
+ full identity setup, call `sap_agent_identity_plan` before any write. It is
13
+ free and returns normalized fields, local-signer routing, metadata contract,
14
+ forbidden actions, and verification checklist.
15
+ 4. Use free exact/base reads before paid discovery: `sap_agent_context`,
16
+ `sap_get_agent`,
17
+ `sap_get_agent_profile`, `sap_get_agent_stats`, `sap_is_agent_active`,
18
+ `sap_get_global_state`, and `sap_list_agents` with `limit <= 20`,
19
+ `view: "compact"`, and `includeProtocolIndexes: false`.
20
+ 5. Call `sap_get_network_overview` for ecosystem counters when needed.
21
+ 6. Use `sap_discover_agents` with `query`, `wallet`, `protocol`, or
22
+ `capability` for targeted paid hosted directory reads when free exact/base
23
+ reads are not enough.
24
+ 7. Use `sap_list_all_agents` for global current agent lists and follow
13
25
  `pagination.nextCursor` for additional pages.
14
26
 
15
27
  ## Tools
16
28
 
17
29
  - `sap_register_agent`
30
+ - `sap_protocol_invariants`
31
+ - `sap_agent_identity_plan`
32
+ - `sap_agent_context`
33
+ - `sap_agent_next_action`
18
34
  - `sap_update_agent`
19
35
  - `sap_deactivate_agent`
20
36
  - `sap_reactivate_agent`
@@ -24,6 +40,7 @@ state, global directory listing, and agent profile inspection.
24
40
  - `sap_get_agent_stats`
25
41
  - `sap_get_global_state`
26
42
  - `sap_get_network_overview`
43
+ - `sap_list_agents`
27
44
  - `sap_list_all_agents`
28
45
  - `sap_is_agent_active`
29
46
  - `sap_report_calls`
@@ -36,15 +53,41 @@ state, global directory listing, and agent profile inspection.
36
53
  `hosted_local_signer_required`, no x402 payment was charged. For agent
37
54
  registration, call the local `sap_payments.sap_payments_register_agent`
38
55
  bridge with the same fields and `confirm: true`; it signs locally with the
39
- active SAP MCP profile. For other registry writes, run the write on the local
40
- SAP MCP profile or use a production unsigned builder/finalizer flow when
56
+ active SAP MCP profile. For agent profile, image, metadata, capability,
57
+ protocol, pricing, or x402 endpoint updates, call local
58
+ `sap_payments.sap_payments_update_agent` with the same update fields and
59
+ `confirm: true`. For other registry writes, run the write on the local SAP
60
+ MCP profile or use a production unsigned builder/finalizer flow when
41
61
  available.
62
+ - Before any retry after `payment_required`, `hosted_local_signer_required`,
63
+ `BlockhashNotFound`, timeout, missing `sap_payments`, or a submitted
64
+ signature that did not confirm, call `sap_agent_next_action`. Follow its
65
+ `safeToRetryNow`, `nextTool`, and `forbiddenActions` fields.
66
+ - Agent pictures must be public metadata, not desktop file paths. Upload the
67
+ image or metadata JSON to IPFS, Arweave, Kommodo, or HTTPS, then set
68
+ `agentUri`/`metadataUri` with `sap_payments_update_agent`.
69
+ - After `sap_payments_register_agent`, do not stop at a Solscan link. Verify
70
+ `success`, `agentRegistered`, `agentPda`, `confirmationStatus`,
71
+ `protocolComplete`, and `protocolFee.status`. A complete registration should
72
+ show the expected protocol fee credited to treasury
73
+ `J7PyZAGKvprCz4SQ5DKBLAHstJxgVqZcz6kguUoWpP7P`. If `success` is false but
74
+ `agentRegistered` is true, the account may exist but SAP registration is not
75
+ protocol-complete. Report the integrity issue and do not retry automatically.
76
+ - After `sap_payments_update_agent`, fetch the agent profile again and verify
77
+ the changed fields. For image/profile updates, `agentUri` or `metadataUri`
78
+ must resolve to public metadata containing the image URL.
79
+ - For full agent identity setup, follow
80
+ `docs/16_SAP_AGENT_IDENTITY_PIPELINE.md`: SAP registration first, optional
81
+ Metaplex/MPL Core identity, optional SNS domain and records, then a final SAP
82
+ update that points `metadataUri` at the public metadata document.
42
83
  - "Find XONA Agent" or "find an agent by name" means `sap_discover_agents` with
43
84
  `query`.
44
85
  - "Find x402 agents" means `sap_discover_agents` with
45
86
  `hasX402Endpoint: true`.
46
- - "List all agents" means `sap_list_all_agents` with a small `limit`, then
47
- `pagination.nextCursor` if the user wants more.
87
+ - "List all agents" means first call free `sap_list_agents` with
88
+ `limit <= 20`, `view: "compact"`, and `includeProtocolIndexes: false`; then
89
+ use paid `sap_list_all_agents` with `pagination.nextCursor` if the user wants
90
+ more, full rows, or ecosystem-scale enumeration.
48
91
  - "Agent by wallet" means `sap_get_agent` or `sap_get_agent_profile`.
49
92
  - "Is this agent live?" means `sap_is_agent_active`.
50
93
  - "Network totals" means `sap_get_network_overview`.
@@ -53,3 +96,33 @@ state, global directory listing, and agent profile inspection.
53
96
 
54
97
  Registration and update tools are write operations. Explain the action, read
55
98
  policy context, require explicit confirmation, and never inspect keypair files.
99
+ For registrations, distinguish `agent account exists` from `protocol lifecycle
100
+ complete`; the latter requires confirmation plus a non-failing protocol fee
101
+ audit.
102
+
103
+ ## Canonical Register Fields
104
+
105
+ Use these exact fields for `sap_payments_register_agent` and local
106
+ `sap_register_agent`:
107
+
108
+ - `name`: public display name.
109
+ - `description`: public purpose, capabilities, and trust boundary.
110
+ - `capabilities`: array of strings or objects. Prefer object form:
111
+ `{ "id": "jupiter:swap", "description": "...", "protocolId": "jupiter", "version": "1.0.0" }`.
112
+ - `pricing`: array of pricing tiers. For x402/pay.sh use
113
+ `{ "pricePerCall": "1000", "tokenType": "usdc", "settlementMode": "x402", "tokenDecimals": 6 }`;
114
+ USDC amounts are micro-USDC.
115
+ - `protocols`: array such as `["sap", "mcp", "jupiter", "pyth", "metaplex"]`.
116
+ - `agentId`: stable lowercase id, for example `solking`.
117
+ - `agentUri` or `metadataUri`: public metadata/profile URL. Never a local path.
118
+ - `x402Endpoint`: optional `https://host/.well-known/x402`.
119
+ - `confirm`: required `true` on the local `sap_payments` bridge.
120
+ - `protocolFee`: returned output audit for registration; verify it before
121
+ announcing completion.
122
+
123
+ ## Canonical Update Fields
124
+
125
+ `sap_payments_update_agent` accepts the same profile fields as registration,
126
+ but every field is optional. Omitted fields stay unchanged. Array fields
127
+ replace the full on-chain list, so fetch the current agent first before adding
128
+ only one capability, protocol, or pricing tier.
@@ -18,12 +18,21 @@ indexes, and filtered agent discovery.
18
18
 
19
19
  ## Rules
20
20
 
21
+ - Start with free orientation when possible:
22
+ - `sap_agent_context` for a one-shot compact context read and routing hints.
23
+ - `sap_get_agent` or `sap_get_agent_profile` for a known owner wallet.
24
+ - `sap_is_agent_active` for a known owner wallet status check.
25
+ - `sap_get_global_state` for compact registry state.
26
+ - `sap_list_agents` with `limit <= 20`, `view: "compact"`, and
27
+ `includeProtocolIndexes: false` for a small current directory page.
21
28
  - Use `sap_discover_agents` for paid hosted agent directory search. It supports
22
29
  `query`, `wallet`, `agentPda`, `protocol`, `capability`, `capabilities`,
23
30
  `capabilityMode`, `hasX402Endpoint`, `limit`, `cursor`, and `view`.
24
31
  - Use `sap_list_all_agents` for global directory requests or when the user asks
25
32
  for the whole SAP ecosystem. Keep the first page small and follow
26
33
  `pagination.nextCursor` only when the previous page is useful.
34
+ - Use paid discovery only when the user needs search, enrichment, full rows,
35
+ large pages, analytics, or global enumeration beyond the free compact page.
27
36
  - Prefer exact filters before broad scans: `wallet` when a wallet is known,
28
37
  `query` for an agent name such as `XONA`, and `capability` for one exact
29
38
  capability such as `creative:imageGeneration`.
@@ -34,6 +43,8 @@ indexes, and filtered agent discovery.
34
43
  the canonical AgentAccount directory.
35
44
  - Do not guess that global enumeration is impossible; try `sap_list_all_agents`
36
45
  first and report the exact failure if it fails.
46
+ - If discovery hits `payment_required`, a transient RPC error, or a missing
47
+ local bridge, call `sap_agent_next_action` before retrying or changing route.
37
48
 
38
49
  ## Common Inputs
39
50
 
@@ -7,6 +7,17 @@ new work.
7
7
 
8
8
  ## Tools
9
9
 
10
+ Hosted unsigned builders:
11
+
12
+ - `sap_escrow_build_create_transaction`
13
+ - `sap_escrow_build_deposit_transaction`
14
+ - `sap_escrow_build_settle_transaction`
15
+ - `sap_escrow_build_finalize_transaction`
16
+ - `sap_escrow_build_withdraw_transaction`
17
+ - `sap_escrow_build_close_transaction`
18
+
19
+ Local-signer direct writes:
20
+
10
21
  - `sap_create_escrow_v2`
11
22
  - `sap_deposit_escrow_v2`
12
23
  - `sap_settle_escrow_v2`
@@ -26,13 +37,20 @@ recommend V1 create, deposit, settle, withdraw, close, or batch-settle flows.
26
37
  ## Flow
27
38
 
28
39
  1. Fetch V2 escrow state before mutating it.
29
- 2. For V2 settlement, inspect pending settlement and dispute state.
30
- 3. Explain amount, depositor, agent PDA, nonce, settlement index, and dispute
40
+ 2. In hosted SAP MCP, never call direct escrow write tools after
41
+ `hosted_local_signer_required`. Use the matching
42
+ `sap_escrow_build_*_transaction` tool, then finalize the unsigned
43
+ transaction locally with `sap_payments_finalize_transaction`.
44
+ 3. In local SAP MCP stdio mode, direct write tools can sign through the active
45
+ local SAP profile. Do not read keypair JSON or create temporary signing
46
+ scripts.
47
+ 4. For V2 settlement, inspect pending settlement and dispute state.
48
+ 5. Explain amount, depositor, agent PDA, nonce, settlement index, and dispute
31
49
  effect before write tools.
32
- 4. Treat `settlementSecurity = 2` / DisputeWindow as the safe default.
50
+ 6. Treat `settlementSecurity = 2` / DisputeWindow as the safe default.
33
51
  Use `settlementSecurity = 1` / CoSigned only when a valid `coSigner` is
34
52
  provided. Never default to SelfReport / `0`.
35
- 5. Amounts are always in the smallest unit of the escrow token: lamports for
53
+ 7. Amounts are always in the smallest unit of the escrow token: lamports for
36
54
  SOL, micro-USDC for USDC.
37
55
 
38
56
  ## Safety
@@ -8,19 +8,31 @@ safe signing behavior.
8
8
 
9
9
  If the user says "Start SAP MCP", "Initialize SAP MCP", "Load SAP", or "SAP
10
10
  mode", treat it as the activation command. Call `sap_agent_start` when it is
11
- available, then call `sap_skills_bundle` with `includeContents: true` and load
12
- the returned SAP MCP skill contents into context.
11
+ available, then call `sap_agent_runtime_status` with the closest intent and
12
+ `sap_skills_bundle` with `includeContents: true`. Load the returned SAP MCP
13
+ skill contents into context before selecting advanced tools.
13
14
 
14
15
  Always inspect runtime context through MCP tools, not by reading config files:
15
16
 
16
17
  1. `sap_agent_start`
17
- 2. `sap_skills_bundle` with `includeContents: true`
18
- 3. `sap_skills_upgrade_plan` when local skills are missing or stale
19
- 4. `sap_runtime_repair_plan` when hosted tools are connected but `sap_payments` is missing
20
- 5. `sap_profile_current`
21
- 6. `sap_profile_list`
22
- 7. `sap_profile_public_key`
23
- 8. `sap_network_stats`
18
+ 2. `sap_agent_runtime_status` with `intent: "connection"`, `"paid-call"`, `"registry-write"`, `"transaction-finalize"`, `"escrow"`, `"identity"`, or `"general"`
19
+ 3. `sap_agent_context` for free compact agent/directory orientation before paid discovery
20
+ 4. `sap_skills_bundle` with `includeContents: true`
21
+ 5. `sap_pricing_catalog` before estimating hosted paid call tiers
22
+ 6. `sap_agent_next_action` before retrying after any SAP MCP error or partial write result
23
+ 7. `sap_skills_upgrade_plan` when local skills are missing or stale
24
+ 8. `sap_runtime_repair_plan` when hosted tools are connected but `sap_payments` is missing
25
+ 9. `sap_protocol_invariants` before SAP registry writes or when treasury, protocol fee, hosted write routing, or local signer routing is unclear
26
+ 10. `sap_agent_identity_plan` before agent registration, profile-image updates, Metaplex identity, SNS linking, or full identity setup
27
+ 11. `sap_profile_current`
28
+ 12. `sap_profile_list`
29
+ 13. `sap_profile_public_key`
30
+ 14. `sap_network_stats`
31
+
32
+ For simple "are you connected?" checks, do not dump tool counts or inspect
33
+ local files. Use `sap_agent_runtime_status` first and answer with the hosted
34
+ endpoint, accountless/non-custodial model, local bridge readiness if visible,
35
+ and the next exact action.
24
36
 
25
37
  The server profile is the source of truth. Environment variables from the MCP
26
38
  client must not override profile-owned RPC or wallet settings unless
@@ -35,6 +47,11 @@ and error strings unchanged.
35
47
 
36
48
  ## Discovery Rules
37
49
 
50
+ - Use free exact/base reads first when the wallet, PDA, or a small orientation
51
+ page is enough: `sap_agent_context`, `sap_get_agent`, `sap_get_agent_profile`,
52
+ `sap_get_agent_stats`, `sap_is_agent_active`, `sap_get_global_state`, and
53
+ `sap_list_agents` with `limit <= 20`, `view: "compact"`, and
54
+ `includeProtocolIndexes: false`.
38
55
  - Use `sap_get_network_overview` for live ecosystem counters.
39
56
  - Use `sap_discover_agents` for targeted paid hosted discovery. Prefer
40
57
  `query`, `wallet`, `agentPda`, `protocol`, `capability`, `capabilities`,
@@ -42,7 +59,9 @@ and error strings unchanged.
42
59
  - Use `sap_list_all_agents` when the user asks for all current SAP ecosystem
43
60
  agents. It performs global on-chain `AgentAccount` enumeration and returns
44
61
  `pagination.nextCursor` when more pages are available.
45
- - Use `sap_list_agents` as a compatibility alias for `sap_discover_agents`.
62
+ - Use `sap_list_agents` for a free compact orientation page first. Larger
63
+ pages, `view: "full"`, hydration, protocol index summaries, and global scans
64
+ are paid read-premium.
46
65
  - Use `sap_fetch_protocol_index` when a specific protocol ID is known.
47
66
  - If a capability lookup returns zero results, retry with `query` or `wallet`
48
67
  before saying an agent is absent. AgentAccount rows are canonical; indexes can
@@ -70,11 +89,13 @@ Use the bundled routing map for local MCP tool selection:
70
89
  - `USER_DOCS/05_SKILLS_AND_TOOLS.md`
71
90
 
72
91
  SAP MCP startup and skill bootstrap tools are free context/setup tools. Call
73
- `sap_agent_start`, `sap_skills_list`, `sap_skills_bundle`,
74
- `sap_skills_upgrade_plan`, `sap_runtime_repair_plan`, and local
75
- `sap_skills_install` directly. Do not route startup, skill listing, bundling,
92
+ `sap_agent_start`, `sap_agent_runtime_status`, `sap_agent_context`,
93
+ `sap_agent_next_action`, `sap_pricing_catalog`,
94
+ `sap_skills_list`, `sap_skills_bundle`, `sap_skills_upgrade_plan`,
95
+ `sap_runtime_repair_plan`, and local `sap_skills_install` directly. Do not
96
+ route startup, runtime status, pricing catalog, skill listing, bundling,
76
97
  upgrade planning, runtime repair planning, or installation through
77
- `sap_x402_paid_call`. On hosted remote MCP, use
98
+ `sap_x402_paid_call` or `sap_payments_call_paid_tool`. On hosted remote MCP, use
78
99
  `sap_skills_bundle` to download skill contents; the hosted server cannot
79
100
  install files onto the caller's local machine. Local installation belongs to the
80
101
  wizard, desktop app, addon installer, or a local stdio SAP MCP process.
@@ -128,12 +149,13 @@ actions. The hosted MCP server is not a wallet custodian.
128
149
 
129
150
  For hosted paid tools, use the native x402 flow. If the client runtime cannot
130
151
  attach `PAYMENT-SIGNATURE` itself, use the local SAP MCP `sap_payments` bridge.
131
- Call `sap_payments_readiness` first to verify the active profile, signer,
132
- SOL/USDC balance, policy limits, and bridge status. Then call
133
- `sap_payments_call_paid_tool` for the hosted paid tool. This is not a separate
134
- hosted signing plugin: it is the local SAP MCP process using the user's
135
- configured SAP profile wallet or external signer to sign the x402 payment
136
- payload, retry the hosted tool call, and return the receipt.
152
+ Call `sap_agent_runtime_status` first for routing, then
153
+ `sap_payments_readiness` to verify the active profile, signer, SOL/USDC
154
+ balance, policy limits, and bridge status. Then call `sap_payments_call_paid_tool`
155
+ for the hosted paid tool. This is not a separate hosted signing plugin: it is
156
+ the local SAP MCP process using the user's configured SAP profile wallet or
157
+ external signer to sign the x402 payment payload, retry the hosted tool call,
158
+ and return the receipt.
137
159
  `sap_x402_paid_call` is a backward-compatible alias only for older runtime
138
160
  snippets. Neither helper must be treated as a remote hosted signing service.
139
161
 
@@ -180,9 +202,36 @@ charged. The tool requires a local user signature or has no hosted unsigned
180
202
  builder yet. For `sap_register_agent`, call
181
203
  `sap_payments.sap_payments_register_agent` with the same registration fields and
182
204
  `confirm: true`; it runs the SAP registry write through the local signer bridge
183
- without charging a hosted x402 access fee. For other direct writes, do not retry
184
- the same hosted tool; use the local SAP MCP profile or an unsigned hosted
185
- builder plus `sap_payments_finalize_transaction` when one exists.
205
+ without charging a hosted x402 access fee. For `sap_update_agent`, call
206
+ `sap_payments.sap_payments_update_agent` with the intended replacement fields
207
+ and `confirm: true`; use it for public agent image/profile metadata updates via
208
+ `agentUri` or `metadataUri`. For Escrow V2, call the matching
209
+ `sap_escrow_build_*_transaction` hosted builder and finalize with
210
+ `sap_payments_finalize_transaction`. For other direct writes, do not retry the
211
+ same hosted tool; use the local SAP MCP profile or an unsigned hosted builder
212
+ plus `sap_payments_finalize_transaction` when one exists.
213
+
214
+ For registry lifecycle completion, do not treat a transaction signature alone
215
+ as enough. After `sap_payments_register_agent`, verify `success`,
216
+ `agentRegistered`, `agentPda`, `confirmationStatus`, `protocolComplete`, and
217
+ the returned `protocolFee.status`. `success: true` means both the agent account
218
+ and protocol fee invariant were verified. If `success` is false while
219
+ `agentRegistered` is true, report that the account may exist but the SAP
220
+ protocol registration lifecycle is not complete. After
221
+ `sap_payments_update_agent`, fetch the agent again and confirm the changed
222
+ fields before saying an image, metadata, pricing, or capability update is done.
223
+
224
+ Before any write-like operation, use this routing order:
225
+
226
+ 1. Hosted read or paid hosted read: direct hosted tool, or
227
+ `sap_payments_call_paid_tool` when x402 is required.
228
+ 2. Hosted unsigned transaction builder: finalize with
229
+ `sap_payments_finalize_transaction` and `submit: true` when the user confirms.
230
+ 3. SAP registry registration/update: use `sap_payments_register_agent` or
231
+ `sap_payments_update_agent`; do not retry hosted accountless writes.
232
+ 4. External x402 HTTP provider: use `sap_payments_call_external_x402`.
233
+ 5. Missing bridge: call `sap_runtime_repair_plan`, then tell the user to run the
234
+ pinned repair command or desktop wizard repair path.
186
235
 
187
236
  When summarizing a hosted connection, use language like:
188
237
  "server is non-custodial; user signatures come from the local SAP profile or
@@ -204,6 +253,18 @@ call `sap_runtime_repair_plan`. Do not ask the user to manually rebuild their
204
253
  runtime config unless the repair plan has already failed or runtime startup logs
205
254
  show a concrete package/runtime error.
206
255
 
256
+ For agent identity work, load the matching focused skills before acting:
257
+
258
+ - register, update, profile image, capability, pricing, or x402 endpoint:
259
+ `sap-agent-registry`
260
+ - NFT-backed identity, MPL Core, Metaplex metadata, creator/collection flows:
261
+ `sap-nft-metaplex`
262
+ - `.sol` domain ownership, records, or primary identity:
263
+ `sap-sns`
264
+
265
+ The canonical field and pipeline reference is
266
+ `docs/16_SAP_AGENT_IDENTITY_PIPELINE.md`. Follow it before registry writes.
267
+
207
268
  ## Profile Tools
208
269
 
209
270
  | Tool | Purpose |
@@ -37,7 +37,7 @@ Profile, config, runtime context, and raw transaction lifecycle:
37
37
 
38
38
  SAP registry and discovery:
39
39
 
40
- `sap_register_agent`, `sap_update_agent`, `sap_deactivate_agent`,
40
+ `sap_protocol_invariants`, `sap_agent_identity_plan`, `sap_register_agent`, `sap_update_agent`, `sap_deactivate_agent`,
41
41
  `sap_reactivate_agent`, `sap_close_agent`, `sap_get_agent`,
42
42
  `sap_get_agent_profile`, `sap_get_agent_stats`, `sap_get_global_state`,
43
43
  `sap_get_network_overview`, `sap_discover_agents`, `sap_list_agents`,
@@ -49,12 +49,30 @@ SAP registry and discovery:
49
49
  `sap_deactivate_tool`, `sap_reactivate_tool`,
50
50
  `sap_report_tool_invocations`, `sap_report_calls`.
51
51
 
52
- Use `sap_discover_agents` for targeted paid hosted agent search by `query`,
53
- `wallet`, `agentPda`, `protocol`, `capability`, `capabilities`, or
54
- `hasX402Endpoint`. Use `sap_list_all_agents` for user requests such as "give me
55
- a list of all agents in the SAP ecosystem rn"; start with a small `limit` and
56
- continue with `pagination.nextCursor`. If a capability lookup returns zero,
57
- retry with `query` or `wallet` before reporting that the agent is absent.
52
+ Use free exact/base reads before paid discovery when possible:
53
+ `sap_agent_context`, `sap_get_agent`, `sap_get_agent_profile`,
54
+ `sap_get_agent_stats`, `sap_is_agent_active`, `sap_get_global_state`, and
55
+ `sap_list_agents` with `limit <= 20`, `view: "compact"`, and
56
+ `includeProtocolIndexes: false`.
57
+ Use `sap_discover_agents` for targeted paid hosted search by `query`, `wallet`,
58
+ `agentPda`, `protocol`, `capability`, `capabilities`, or `hasX402Endpoint`.
59
+ Use paid `sap_list_all_agents` for user requests such as "give me a list of all
60
+ agents in the SAP ecosystem rn"; start with a small `limit` and continue with
61
+ `pagination.nextCursor`. If a capability lookup returns zero, retry with
62
+ `query` or `wallet` before reporting that the agent is absent.
63
+
64
+ Use `sap_agent_next_action` before retrying any SAP MCP error or partial write
65
+ result. It normalizes `payment_required`, `hosted_local_signer_required`,
66
+ transient Solana RPC failures, missing local bridge tools, and unconfirmed
67
+ submitted signatures into the next safe tool route.
68
+
69
+ Use `sap_protocol_invariants` before registry writes when the program id,
70
+ protocol treasury, source-level 0.1 SOL registration fee invariant, hosted
71
+ write route, or local signer route is unclear. Use `sap_agent_identity_plan`
72
+ before registration,
73
+ profile/image updates, Metaplex identity bridging, SNS linking, or x402
74
+ endpoint publishing. It is a free planner and should run before any local
75
+ signer write.
58
76
 
59
77
  SAP memory and sessions:
60
78
 
@@ -75,6 +93,12 @@ SAP payments, x402, subscriptions, Escrow V2, settlement, disputes, staking:
75
93
  `sap_x402_prepare_payment`, `sap_x402_get_balance`,
76
94
  `sap_create_subscription`, `sap_fund_subscription`,
77
95
  `sap_cancel_subscription`, `sap_fetch_subscription`,
96
+ `sap_escrow_build_create_transaction`,
97
+ `sap_escrow_build_deposit_transaction`,
98
+ `sap_escrow_build_settle_transaction`,
99
+ `sap_escrow_build_finalize_transaction`,
100
+ `sap_escrow_build_withdraw_transaction`,
101
+ `sap_escrow_build_close_transaction`,
78
102
  `sap_create_escrow_v2`, `sap_deposit_escrow_v2`,
79
103
  `sap_settle_escrow_v2`, `sap_finalize_settlement_v2`,
80
104
  `sap_file_dispute_v2`, `sap_withdraw_escrow_v2`, `sap_close_escrow_v2`,
@@ -86,6 +110,13 @@ SAP payments, x402, subscriptions, Escrow V2, settlement, disputes, staking:
86
110
  Use `sap_fetch_escrow` only for legacy read-only inspection. V1 escrow write
87
111
  tools are not part of the active SAP MCP surface.
88
112
 
113
+ In hosted mode, prefer `sap_escrow_build_*_transaction` for Escrow V2 writes
114
+ and finalize the returned unsigned transaction locally with
115
+ `sap_payments_finalize_transaction`. Use direct `sap_create_escrow_v2`,
116
+ `sap_deposit_escrow_v2`, `sap_settle_escrow_v2`,
117
+ `sap_finalize_settlement_v2`, `sap_withdraw_escrow_v2`, and
118
+ `sap_close_escrow_v2` only when running a local SAP MCP profile with a signer.
119
+
89
120
  ## `sap-sns`
90
121
 
91
122
  SAP SNS and direct SNS domain workflows:
@@ -32,6 +32,28 @@ flows.
32
32
  2. Validate collection, creator, metadata URI, royalties, and authority.
33
33
  3. Preview transaction-producing outputs before signing.
34
34
 
35
+ ## SAP Bridged Identity
36
+
37
+ When the user wants an SAP agent picture, NFT-backed identity, MPL Core asset,
38
+ or Metaplex-linked profile:
39
+
40
+ 1. Publish the image and metadata to a public URI. Desktop file paths are never
41
+ valid on-chain metadata.
42
+ 2. If creating a Metaplex NFT/MPL Core identity asset, mint or update that asset
43
+ with the same public metadata and keep the owner/authority clear.
44
+ 3. Register or update the SAP agent with `metadataUri`/`agentUri` pointing to
45
+ the public metadata document or profile page.
46
+ 4. In the metadata JSON, include a `metaplex` object with the asset or
47
+ collection address when available.
48
+ 5. Hosted users must use local `sap_payments_register_agent` or
49
+ `sap_payments_update_agent` for SAP registry writes. Do not call hosted
50
+ `sap_register_agent` or hosted `sap_update_agent` after
51
+ `hosted_local_signer_required`.
52
+
53
+ Load `sap-agent-registry` together with this skill when the user says “register
54
+ my agent”, “add my picture”, “link my NFT identity”, or “bridge SAP with
55
+ Metaplex”.
56
+
35
57
  ## Safety
36
58
 
37
59
  Minting, listing, buying, authority changes, and metadata updates are high-risk.
@@ -19,6 +19,8 @@ This skill corresponds to upstream SAP SDK v1.0.x domains such as
19
19
 
20
20
  Use:
21
21
 
22
+ - `sap_protocol_invariants`
23
+ - `sap_agent_identity_plan`
22
24
  - `sap_register_agent`
23
25
  - `sap_update_agent`
24
26
  - `sap_deactivate_agent`
@@ -34,6 +36,32 @@ Use `sap_discover_agents` for targeted hosted directory reads by `query`,
34
36
  `wallet`, `agentPda`, `protocol`, `capability`, `capabilities`, or
35
37
  `hasX402Endpoint`. Use `sap_list_all_agents` for global current ecosystem
36
38
  requests, keep pages small, and continue with `pagination.nextCursor`.
39
+ For first-pass orientation, prefer free reads: `sap_agent_context`,
40
+ `sap_get_agent`, `sap_get_agent_profile`, `sap_get_agent_stats`,
41
+ `sap_is_agent_active`, `sap_get_global_state`, and `sap_list_agents` with `limit <= 20`,
42
+ `view: "compact"`, and `includeProtocolIndexes: false`. Use paid discovery
43
+ only when the user needs search, enrichment, full rows, large pages, analytics,
44
+ or global enumeration beyond the compact page.
45
+
46
+ Before registering or updating an agent profile, call free
47
+ `sap_protocol_invariants` when treasury, registration fee, hosted write route,
48
+ or local signer route is unclear. Then call `sap_agent_identity_plan`. The
49
+ planner tells the agent which fields are missing, whether the action should use
50
+ hosted reads or local signing, whether Metaplex or SNS identity is involved,
51
+ and how to verify the write afterward.
52
+
53
+ Hosted accountless SAP MCP cannot sign wallet-owned registry writes. If hosted
54
+ `sap_register_agent` or `sap_update_agent` returns
55
+ `hosted_local_signer_required`, do not retry the hosted write. Use local
56
+ `sap_payments_register_agent` or `sap_payments_update_agent` with
57
+ `confirm: true`. After registration, verify `success`, `agentPda`,
58
+ `confirmationStatus`, and `protocolFee.status`; after update, fetch the agent
59
+ profile again and compare the changed fields.
60
+
61
+ If any SAP operation returns `payment_required`, `hosted_local_signer_required`,
62
+ `BlockhashNotFound`, timeout, missing `sap_payments`, or a submitted signature
63
+ that did not confirm, call `sap_agent_next_action` before retrying. Follow its
64
+ `safeToRetryNow` and `nextTool` fields.
37
65
 
38
66
  ## Memory
39
67