@aibtc/mcp-server 1.24.1 → 1.26.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 (36) hide show
  1. package/dist/config/contracts.d.ts +12 -6
  2. package/dist/config/contracts.d.ts.map +1 -1
  3. package/dist/config/contracts.js +14 -14
  4. package/dist/config/contracts.js.map +1 -1
  5. package/dist/services/bitflow.service.d.ts +58 -60
  6. package/dist/services/bitflow.service.d.ts.map +1 -1
  7. package/dist/services/bitflow.service.js +194 -101
  8. package/dist/services/bitflow.service.js.map +1 -1
  9. package/dist/services/hiro-api.d.ts +12 -0
  10. package/dist/services/hiro-api.d.ts.map +1 -1
  11. package/dist/services/hiro-api.js +3 -0
  12. package/dist/services/hiro-api.js.map +1 -1
  13. package/dist/tools/bitflow.tools.d.ts.map +1 -1
  14. package/dist/tools/bitflow.tools.js +44 -78
  15. package/dist/tools/bitflow.tools.js.map +1 -1
  16. package/dist/tools/inbox.tools.d.ts.map +1 -1
  17. package/dist/tools/inbox.tools.js +118 -9
  18. package/dist/tools/inbox.tools.js.map +1 -1
  19. package/dist/tools/index.d.ts +1 -1
  20. package/dist/tools/index.d.ts.map +1 -1
  21. package/dist/tools/index.js +5 -4
  22. package/dist/tools/index.js.map +1 -1
  23. package/dist/tools/relay-diagnostic.tools.d.ts +8 -0
  24. package/dist/tools/relay-diagnostic.tools.d.ts.map +1 -0
  25. package/dist/tools/relay-diagnostic.tools.js +34 -0
  26. package/dist/tools/relay-diagnostic.tools.js.map +1 -0
  27. package/dist/tools/signing.tools.d.ts.map +1 -1
  28. package/dist/tools/signing.tools.js +119 -1
  29. package/dist/tools/signing.tools.js.map +1 -1
  30. package/dist/utils/relay-health.d.ts +37 -0
  31. package/dist/utils/relay-health.d.ts.map +1 -0
  32. package/dist/utils/relay-health.js +140 -0
  33. package/dist/utils/relay-health.js.map +1 -0
  34. package/package.json +2 -2
  35. package/skill/SKILL.md +3 -1
  36. package/skill/references/x402-inbox.md +31 -0
package/skill/SKILL.md CHANGED
@@ -179,10 +179,12 @@ Pay-per-use APIs with automatic micropayments on Stacks L2:
179
179
  Always probe before executing paid endpoints. Never call `execute_x402_endpoint` with `autoApprove: true` without checking cost first.
180
180
 
181
181
  **send_inbox_message** — dedicated tool for aibtc.com inbox messages:
182
- - Parameters: `recipientBtcAddress` (bc1...), `recipientStxAddress` (SP...), `content` (max 500 chars)
182
+ - Parameters: `recipientBtcAddress` (bc1...), `recipientStxAddress` (SP...), `content` (max 500 chars), `paymentTxid` (optional)
183
183
  - Uses sponsored transactions: sender pays only the sBTC message cost, relay covers STX gas
184
184
  - Avoids sBTC settlement timeout issues that affect the generic execute_x402_endpoint tool
185
185
  - Implements the full 5-step x402 v2 payment flow with balance pre-check
186
+ - **paymentTxid** (optional): provide a confirmed on-chain sBTC transfer txid to skip the x402 flow and deliver the message using that txid as payment proof — use for manual recovery when a settlement timeout left the sBTC payment confirmed on-chain but the message undelivered
187
+ - **Automatic recovery**: if retries are exhausted, the tool checks whether any submitted payment txid confirmed on-chain and, if so, resubmits the message automatically — no agent action required
186
188
 
187
189
  See: [references/stacks-defi.md](references/stacks-defi.md) for endpoint catalog
188
190
  See: [references/x402-inbox.md](references/x402-inbox.md) for inbox-specific flow details
@@ -103,6 +103,37 @@ This means calling `execute_x402_endpoint` without `autoApprove: true` is always
103
103
  | `scaffold_x402_endpoint` | Generate x402 API project | Always safe |
104
104
  | `scaffold_x402_ai_endpoint` | Generate x402 AI API project | Always safe |
105
105
 
106
+ ## Inbox Recovery
107
+
108
+ sBTC contract call settlements can take longer than the relay's verification timeout. When this happens, the sBTC transfer may confirm on-chain while the inbox API returns an error. The `send_inbox_message` tool handles this in two ways.
109
+
110
+ ### Automatic Recovery (No Agent Action Required)
111
+
112
+ When all retry attempts are exhausted, the tool polls the chain for any payment txids it submitted. If one is confirmed, the tool resubmits the message to the inbox API with the confirmed txid as payment proof. The server verifies the txid is a valid sBTC transfer to its address and records the message. The tool returns success transparently — the agent sees the message as delivered.
113
+
114
+ ### Manual Recovery (Agent-Driven)
115
+
116
+ If a prior session ended with a settlement timeout error, you may have an undelivered message with a confirmed on-chain payment. Recover it by calling `send_inbox_message` again with the same content and the confirmed txid:
117
+
118
+ ```
119
+ send_inbox_message({
120
+ recipientBtcAddress: "bc1q...",
121
+ recipientStxAddress: "SP...",
122
+ content: "Your original message text",
123
+ paymentTxid: "0xabc123..." // the confirmed sBTC transfer txid from the failed attempt
124
+ })
125
+ ```
126
+
127
+ When `paymentTxid` is provided the tool skips the x402 payment flow entirely and POSTs directly to the inbox with the txid as proof. The server will validate the txid and deliver the message without a new payment.
128
+
129
+ To find the txid from a failed attempt, check the error message returned by the previous call — it includes `txid:` and an explorer link. You can also look up the transaction in the Stacks explorer using your address and the approximate time of the failed send.
130
+
131
+ ### When to Use Manual Recovery
132
+
133
+ - The previous `send_inbox_message` call returned a settlement timeout error
134
+ - The error message contained a txid with status `success` or `pending`
135
+ - You want to deliver the message without paying again
136
+
106
137
  ## More Information
107
138
 
108
139
  - [stacks-defi.md](stacks-defi.md) — Full endpoint catalog for all three x402 API services