@aibtc/mcp-server 1.7.0 → 1.13.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 (143) hide show
  1. package/README.md +84 -9
  2. package/dist/config/bitcoin-constants.d.ts +32 -0
  3. package/dist/config/bitcoin-constants.d.ts.map +1 -0
  4. package/dist/config/bitcoin-constants.js +32 -0
  5. package/dist/config/bitcoin-constants.js.map +1 -0
  6. package/dist/config/contracts.d.ts +12 -3
  7. package/dist/config/contracts.d.ts.map +1 -1
  8. package/dist/config/contracts.js +7 -1
  9. package/dist/config/contracts.js.map +1 -1
  10. package/dist/endpoints/registry.d.ts +3 -3
  11. package/dist/endpoints/registry.d.ts.map +1 -1
  12. package/dist/endpoints/registry.js +187 -3
  13. package/dist/endpoints/registry.js.map +1 -1
  14. package/dist/services/bitflow.service.d.ts +2 -1
  15. package/dist/services/bitflow.service.d.ts.map +1 -1
  16. package/dist/services/bitflow.service.js +3 -1
  17. package/dist/services/bitflow.service.js.map +1 -1
  18. package/dist/services/bns.service.d.ts +21 -5
  19. package/dist/services/bns.service.d.ts.map +1 -1
  20. package/dist/services/bns.service.js +145 -51
  21. package/dist/services/bns.service.js.map +1 -1
  22. package/dist/services/defi.service.d.ts +16 -6
  23. package/dist/services/defi.service.d.ts.map +1 -1
  24. package/dist/services/defi.service.js +99 -27
  25. package/dist/services/defi.service.js.map +1 -1
  26. package/dist/services/hiro-api.d.ts +26 -0
  27. package/dist/services/hiro-api.d.ts.map +1 -1
  28. package/dist/services/hiro-api.js +8 -0
  29. package/dist/services/hiro-api.js.map +1 -1
  30. package/dist/services/inscription-parser.d.ts +122 -0
  31. package/dist/services/inscription-parser.d.ts.map +1 -0
  32. package/dist/services/inscription-parser.js +163 -0
  33. package/dist/services/inscription-parser.js.map +1 -0
  34. package/dist/services/nft.service.d.ts +2 -1
  35. package/dist/services/nft.service.d.ts.map +1 -1
  36. package/dist/services/nft.service.js +3 -1
  37. package/dist/services/nft.service.js.map +1 -1
  38. package/dist/services/ordinal-indexer.d.ts +128 -0
  39. package/dist/services/ordinal-indexer.d.ts.map +1 -0
  40. package/dist/services/ordinal-indexer.js +128 -0
  41. package/dist/services/ordinal-indexer.js.map +1 -0
  42. package/dist/services/sbtc.service.d.ts +2 -1
  43. package/dist/services/sbtc.service.d.ts.map +1 -1
  44. package/dist/services/sbtc.service.js +3 -1
  45. package/dist/services/sbtc.service.js.map +1 -1
  46. package/dist/services/tokens.service.d.ts +2 -1
  47. package/dist/services/tokens.service.d.ts.map +1 -1
  48. package/dist/services/tokens.service.js +3 -1
  49. package/dist/services/tokens.service.js.map +1 -1
  50. package/dist/services/wallet-manager.d.ts +20 -12
  51. package/dist/services/wallet-manager.d.ts.map +1 -1
  52. package/dist/services/wallet-manager.js +41 -62
  53. package/dist/services/wallet-manager.js.map +1 -1
  54. package/dist/tools/bitcoin.tools.d.ts.map +1 -1
  55. package/dist/tools/bitcoin.tools.js +214 -34
  56. package/dist/tools/bitcoin.tools.js.map +1 -1
  57. package/dist/tools/bitflow.tools.d.ts.map +1 -1
  58. package/dist/tools/bitflow.tools.js +8 -3
  59. package/dist/tools/bitflow.tools.js.map +1 -1
  60. package/dist/tools/bns.tools.d.ts.map +1 -1
  61. package/dist/tools/bns.tools.js +87 -7
  62. package/dist/tools/bns.tools.js.map +1 -1
  63. package/dist/tools/contract.tools.d.ts.map +1 -1
  64. package/dist/tools/contract.tools.js +19 -4
  65. package/dist/tools/contract.tools.js.map +1 -1
  66. package/dist/tools/defi.tools.d.ts.map +1 -1
  67. package/dist/tools/defi.tools.js +43 -0
  68. package/dist/tools/defi.tools.js.map +1 -1
  69. package/dist/tools/index.d.ts +8 -1
  70. package/dist/tools/index.d.ts.map +1 -1
  71. package/dist/tools/index.js +49 -32
  72. package/dist/tools/index.js.map +1 -1
  73. package/dist/tools/nft.tools.d.ts.map +1 -1
  74. package/dist/tools/nft.tools.js +8 -3
  75. package/dist/tools/nft.tools.js.map +1 -1
  76. package/dist/tools/ordinals.tools.d.ts +15 -0
  77. package/dist/tools/ordinals.tools.d.ts.map +1 -0
  78. package/dist/tools/ordinals.tools.js +401 -0
  79. package/dist/tools/ordinals.tools.js.map +1 -0
  80. package/dist/tools/query.tools.d.ts.map +1 -1
  81. package/dist/tools/query.tools.js +71 -0
  82. package/dist/tools/query.tools.js.map +1 -1
  83. package/dist/tools/sbtc.tools.d.ts.map +1 -1
  84. package/dist/tools/sbtc.tools.js +8 -3
  85. package/dist/tools/sbtc.tools.js.map +1 -1
  86. package/dist/tools/signing.tools.d.ts +25 -0
  87. package/dist/tools/signing.tools.d.ts.map +1 -0
  88. package/dist/tools/signing.tools.js +776 -0
  89. package/dist/tools/signing.tools.js.map +1 -0
  90. package/dist/tools/tokens.tools.d.ts.map +1 -1
  91. package/dist/tools/tokens.tools.js +8 -3
  92. package/dist/tools/tokens.tools.js.map +1 -1
  93. package/dist/tools/transfer.tools.d.ts.map +1 -1
  94. package/dist/tools/transfer.tools.js +8 -3
  95. package/dist/tools/transfer.tools.js.map +1 -1
  96. package/dist/tools/wallet-management.tools.d.ts.map +1 -1
  97. package/dist/tools/wallet-management.tools.js +36 -11
  98. package/dist/tools/wallet-management.tools.js.map +1 -1
  99. package/dist/tools/wallet.tools.d.ts.map +1 -1
  100. package/dist/tools/wallet.tools.js +23 -8
  101. package/dist/tools/wallet.tools.js.map +1 -1
  102. package/dist/tools/yield-hunter.tools.d.ts.map +1 -1
  103. package/dist/tools/yield-hunter.tools.js +53 -48
  104. package/dist/tools/yield-hunter.tools.js.map +1 -1
  105. package/dist/transactions/bitcoin-builder.d.ts.map +1 -1
  106. package/dist/transactions/bitcoin-builder.js +1 -16
  107. package/dist/transactions/bitcoin-builder.js.map +1 -1
  108. package/dist/transactions/builder.d.ts +9 -5
  109. package/dist/transactions/builder.d.ts.map +1 -1
  110. package/dist/transactions/builder.js +8 -2
  111. package/dist/transactions/builder.js.map +1 -1
  112. package/dist/transactions/inscription-builder.d.ts +183 -0
  113. package/dist/transactions/inscription-builder.d.ts.map +1 -0
  114. package/dist/transactions/inscription-builder.js +230 -0
  115. package/dist/transactions/inscription-builder.js.map +1 -0
  116. package/dist/utils/bitcoin.d.ts +38 -0
  117. package/dist/utils/bitcoin.d.ts.map +1 -1
  118. package/dist/utils/bitcoin.js +59 -0
  119. package/dist/utils/bitcoin.js.map +1 -1
  120. package/dist/utils/fee.d.ts +41 -0
  121. package/dist/utils/fee.d.ts.map +1 -0
  122. package/dist/utils/fee.js +69 -0
  123. package/dist/utils/fee.js.map +1 -0
  124. package/dist/utils/index.d.ts +2 -0
  125. package/dist/utils/index.d.ts.map +1 -1
  126. package/dist/utils/index.js +2 -0
  127. package/dist/utils/index.js.map +1 -1
  128. package/dist/utils/storage.d.ts +12 -4
  129. package/dist/utils/storage.d.ts.map +1 -1
  130. package/dist/utils/storage.js.map +1 -1
  131. package/dist/utils/tokens.d.ts +13 -0
  132. package/dist/utils/tokens.d.ts.map +1 -0
  133. package/dist/utils/tokens.js +24 -0
  134. package/dist/utils/tokens.js.map +1 -0
  135. package/dist/yield-hunter/index.d.ts.map +1 -1
  136. package/dist/yield-hunter/index.js +10 -15
  137. package/dist/yield-hunter/index.js.map +1 -1
  138. package/package.json +7 -3
  139. package/skill/README.md +108 -0
  140. package/skill/SKILL.md +187 -0
  141. package/skill/references/pillar-wallet.md +213 -0
  142. package/skill/references/stacks-defi.md +258 -0
  143. package/skill/references/troubleshooting.md +211 -0
@@ -0,0 +1,213 @@
1
+ # Pillar Smart Wallet
2
+
3
+ Pillar is an sBTC smart wallet with built-in DeFi integration via Zest Protocol.
4
+
5
+ ## Two Modes
6
+
7
+ ### Browser Handoff Mode (`pillar_*` tools)
8
+
9
+ For human users with passkey authentication:
10
+ 1. MCP creates operation intent
11
+ 2. Opens Pillar in browser
12
+ 3. Sign with passkey (biometric/PIN)
13
+ 4. MCP polls for completion
14
+
15
+ ### Agent Direct Mode (`pillar_direct_*` tools)
16
+
17
+ For autonomous agents - no browser needed:
18
+ 1. Generate signing key: `pillar_key_generate`
19
+ 2. Create wallet: `pillar_direct_create_wallet`
20
+ 3. Execute operations: `pillar_direct_send`, `pillar_direct_boost`, etc.
21
+ 4. Keys auto-unlock using derived password from `PILLAR_API_KEY`
22
+
23
+ **Recommended for agents**: Use `pillar_direct_*` tools for headless automation.
24
+
25
+ ## Connection
26
+
27
+ Connect to your existing Pillar wallet:
28
+
29
+ ```
30
+ "Connect my Pillar wallet"
31
+ ```
32
+
33
+ Uses `pillar_connect` - opens browser, auto-connects if logged in, returns your wallet address.
34
+
35
+ Check connection status:
36
+
37
+ ```
38
+ "Am I connected to Pillar?"
39
+ ```
40
+
41
+ Uses `pillar_status` - shows wallet address if connected.
42
+
43
+ ## Sending sBTC
44
+
45
+ Send to BNS names, Pillar wallet names, or Stacks addresses:
46
+
47
+ ```
48
+ "Send 10000 sats to muneeb.btc"
49
+ "Send 50000 sats to my-friend wallet on Pillar"
50
+ "Send 25000 sats to SP2..."
51
+ ```
52
+
53
+ Uses `pillar_send` with recipient types:
54
+ - `bns` - BNS names (alice.btc)
55
+ - `wallet` - Pillar wallet names
56
+ - `address` - Raw Stacks addresses (SP...)
57
+
58
+ ## Funding Your Wallet
59
+
60
+ Three funding methods available:
61
+
62
+ ### From Exchange (Coinbase, Binance, etc.)
63
+
64
+ ```
65
+ "Fund my Pillar wallet from an exchange"
66
+ ```
67
+
68
+ Uses `pillar_fund` with `method: "exchange"` - generates a deposit address.
69
+
70
+ ### From Leather/Xverse (BTC)
71
+
72
+ ```
73
+ "Deposit BTC from my Leather wallet"
74
+ ```
75
+
76
+ Uses `pillar_fund` with `method: "btc"` - auto-converts BTC to sBTC.
77
+
78
+ ### From Leather/Xverse (sBTC)
79
+
80
+ ```
81
+ "Transfer sBTC from my Xverse wallet"
82
+ ```
83
+
84
+ Uses `pillar_fund` with `method: "sbtc"` - direct sBTC transfer.
85
+
86
+ ## Yield with Zest Protocol
87
+
88
+ ### Supply sBTC
89
+
90
+ Deposit sBTC to earn yield:
91
+
92
+ ```
93
+ "Supply my sBTC to Zest"
94
+ ```
95
+
96
+ Uses `pillar_supply` - deposits to Zest Protocol lending pool.
97
+
98
+ ### Boost Position
99
+
100
+ Create leveraged exposure (up to 1.5x):
101
+
102
+ ```
103
+ "Boost my sBTC position"
104
+ "Boost 100000 sats"
105
+ ```
106
+
107
+ Uses `pillar_boost` - supplies sBTC, borrows against it, re-supplies. Large amounts (>100k sats) automatically use DCA mode.
108
+
109
+ ### Check Position
110
+
111
+ View your current position:
112
+
113
+ ```
114
+ "What's my Pillar position?"
115
+ ```
116
+
117
+ Uses `pillar_position` - shows balance, collateral, borrowed amount, LTV, liquidation price.
118
+
119
+ ### Unwind Position
120
+
121
+ Close or reduce your leverage:
122
+
123
+ ```
124
+ "Unwind 50% of my position"
125
+ ```
126
+
127
+ Uses `pillar_unwind` - repays borrowed sBTC and withdraws collateral.
128
+
129
+ ## Tool Reference
130
+
131
+ ### Browser Handoff Tools
132
+
133
+ **Connection & Transactions:**
134
+ | Tool | Description |
135
+ |------|-------------|
136
+ | `pillar_connect` | Connect to wallet (opens browser) |
137
+ | `pillar_disconnect` | Clear local session |
138
+ | `pillar_status` | Check connection |
139
+ | `pillar_send` | Send sBTC |
140
+ | `pillar_fund` | Fund wallet |
141
+
142
+ **DeFi (Zest Protocol):**
143
+ | Tool | Description |
144
+ |------|-------------|
145
+ | `pillar_supply` | Supply to Zest |
146
+ | `pillar_boost` | Leverage position |
147
+ | `pillar_unwind` | Close position |
148
+ | `pillar_auto_compound` | Configure auto-compound |
149
+ | `pillar_position` | View position |
150
+
151
+ **Wallet Management:**
152
+ | Tool | Description |
153
+ |------|-------------|
154
+ | `pillar_create_wallet` | Create new wallet |
155
+ | `pillar_add_admin` | Add backup admin |
156
+ | `pillar_invite` | Get referral link |
157
+
158
+ **DCA Partnerships:**
159
+ | Tool | Description |
160
+ |------|-------------|
161
+ | `pillar_dca_invite` | Invite DCA partner |
162
+ | `pillar_dca_partners` | View DCA partners |
163
+ | `pillar_dca_leaderboard` | View leaderboard |
164
+ | `pillar_dca_status` | Check DCA status |
165
+
166
+ ### Agent Direct Tools (Recommended for Agents)
167
+
168
+ **Key Management:**
169
+ | Tool | Description |
170
+ |------|-------------|
171
+ | `pillar_key_generate` | Generate signing keypair |
172
+ | `pillar_key_unlock` | Unlock signing key |
173
+ | `pillar_key_lock` | Lock signing key |
174
+ | `pillar_key_info` | Show key status |
175
+
176
+ **Direct Operations:**
177
+ | Tool | Description |
178
+ |------|-------------|
179
+ | `pillar_direct_create_wallet` | Create wallet + register key |
180
+ | `pillar_direct_send` | Send sBTC |
181
+ | `pillar_direct_supply` | Supply to Zest |
182
+ | `pillar_direct_boost` | Leverage position |
183
+ | `pillar_direct_unwind` | Close position |
184
+ | `pillar_direct_withdraw_collateral` | Withdraw sBTC from Zest |
185
+ | `pillar_direct_auto_compound` | Configure auto-compound |
186
+ | `pillar_direct_add_admin` | Add backup admin |
187
+ | `pillar_direct_position` | View position |
188
+ | `pillar_direct_quote` | Get boost quote |
189
+
190
+ **Direct DCA Tools:**
191
+ | Tool | Description |
192
+ |------|-------------|
193
+ | `pillar_direct_dca_invite` | Invite DCA partner |
194
+ | `pillar_direct_dca_partners` | View DCA partners |
195
+ | `pillar_direct_dca_leaderboard` | View leaderboard |
196
+ | `pillar_direct_dca_status` | Check DCA status |
197
+
198
+ ## Environment Variables
199
+
200
+ | Variable | Description |
201
+ |----------|-------------|
202
+ | `PILLAR_API_URL` | API base URL (default: https://pillarbtc.com) |
203
+ | `PILLAR_API_KEY` | Bearer token for auth |
204
+
205
+ ## More Information
206
+
207
+ - [Pillar Website](https://pillarbtc.com)
208
+ - [Twitter @pillar_btc](https://x.com/pillar_btc)
209
+ - [CLAUDE.md Pillar Section](../../CLAUDE.md#pillar-smart-wallet)
210
+
211
+ ---
212
+
213
+ *Back to: [SKILL.md](../SKILL.md)*
@@ -0,0 +1,258 @@
1
+ # Stacks L2 DeFi
2
+
3
+ Stacks is a Bitcoin L2 with smart contracts. This reference covers STX transfers, DEX swaps, lending protocols, and x402 paid endpoints.
4
+
5
+ ## STX Transfers
6
+
7
+ Transfer STX tokens to any Stacks address:
8
+
9
+ ```
10
+ "Send 2 STX to ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM"
11
+ ```
12
+
13
+ Uses `transfer_stx` - amounts in micro-STX (1 STX = 1,000,000 micro-STX).
14
+
15
+ Check STX balance:
16
+
17
+ ```
18
+ "What's my STX balance?"
19
+ ```
20
+
21
+ Uses `get_stx_balance`.
22
+
23
+ ## ALEX DEX (Mainnet Only)
24
+
25
+ Decentralized exchange for token swaps on Stacks.
26
+
27
+ ### Discover Pools
28
+
29
+ Find available trading pairs:
30
+
31
+ ```
32
+ "What pools are available on ALEX?"
33
+ ```
34
+
35
+ Uses `alex_list_pools` - shows all tradable token pairs.
36
+
37
+ ### Get Quote
38
+
39
+ Check expected output before swapping:
40
+
41
+ ```
42
+ "How much ALEX for 10 STX?"
43
+ ```
44
+
45
+ Uses `alex_get_swap_quote` with token symbols (STX, ALEX, etc).
46
+
47
+ ### Execute Swap
48
+
49
+ Swap tokens:
50
+
51
+ ```
52
+ "Swap 0.1 STX for ALEX"
53
+ ```
54
+
55
+ Uses `alex_swap` - handles routing, wrapping, and post-conditions automatically.
56
+
57
+ ### ALEX Tool Reference
58
+
59
+ | Tool | Description |
60
+ |------|-------------|
61
+ | `alex_list_pools` | List all trading pools |
62
+ | `alex_get_swap_quote` | Get expected output |
63
+ | `alex_swap` | Execute token swap |
64
+ | `alex_get_pool_info` | Get pool reserves |
65
+
66
+ ## Zest Protocol (Mainnet Only)
67
+
68
+ Lending and borrowing protocol for earning yield on assets.
69
+
70
+ ### Supported Assets
71
+
72
+ | Symbol | Description |
73
+ |--------|-------------|
74
+ | sBTC | Wrapped Bitcoin |
75
+ | aeUSDC | Bridged USDC |
76
+ | stSTX | Staked STX |
77
+ | wSTX | Wrapped STX |
78
+ | USDH | Stablecoin |
79
+ | sUSDT | Bridged USDT |
80
+ | USDA | Arkadiko stablecoin |
81
+ | DIKO | Arkadiko governance token |
82
+ | ALEX | ALEX token |
83
+ | stSTX-BTC | Staked STX/BTC LP |
84
+
85
+ ### Check Position
86
+
87
+ View your lending position:
88
+
89
+ ```
90
+ "What's my Zest position for stSTX?"
91
+ ```
92
+
93
+ Uses `zest_get_position` with asset symbol.
94
+
95
+ ### Supply Assets
96
+
97
+ Deposit to earn interest:
98
+
99
+ ```
100
+ "Supply 1000 stSTX to Zest"
101
+ ```
102
+
103
+ Uses `zest_supply` - amounts in smallest units (check decimals per asset).
104
+
105
+ ### Borrow Assets
106
+
107
+ Borrow against collateral:
108
+
109
+ ```
110
+ "Borrow 100 aeUSDC from Zest"
111
+ ```
112
+
113
+ Uses `zest_borrow` - ensure sufficient collateral first.
114
+
115
+ ### Repay Loan
116
+
117
+ Repay borrowed assets:
118
+
119
+ ```
120
+ "Repay 50 aeUSDC on Zest"
121
+ ```
122
+
123
+ Uses `zest_repay`.
124
+
125
+ ### Withdraw Assets
126
+
127
+ Withdraw supplied assets:
128
+
129
+ ```
130
+ "Withdraw 500 stSTX from Zest"
131
+ ```
132
+
133
+ Uses `zest_withdraw`.
134
+
135
+ ### Zest Tool Reference
136
+
137
+ | Tool | Description |
138
+ |------|-------------|
139
+ | `zest_list_assets` | List supported assets |
140
+ | `zest_get_position` | Check supply/borrow |
141
+ | `zest_supply` | Deposit assets |
142
+ | `zest_withdraw` | Withdraw assets |
143
+ | `zest_borrow` | Borrow assets |
144
+ | `zest_repay` | Repay loan |
145
+
146
+ ## x402 Protocol
147
+
148
+ Pay-per-use APIs with automatic micropayments. The agent handles HTTP 402 payment challenges automatically.
149
+
150
+ ### API Services
151
+
152
+ Three complementary x402 API services are available:
153
+
154
+ #### STX402 Directory (stx402.com)
155
+
156
+ Meta layer for the x402 ecosystem:
157
+
158
+ | Category | Endpoints |
159
+ |----------|-----------|
160
+ | **Registry** | `/registry/list`, `/registry/probe`, `/registry/register` |
161
+ | **Agent Identity** | `/agent/info`, `/agent/lookup`, `/agent/metadata` |
162
+ | **Reputation** | `/agent/reputation/summary`, `/agent/reputation/feedback` |
163
+ | **Links** | `/links/create`, `/links/stats`, `/links/expand/{slug}` |
164
+
165
+ [API Docs](https://stx402.com/docs) · [Guide](https://stx402.com/guide) · [Toolbox](https://stx402.com/toolbox)
166
+
167
+ #### x402 AIBTC API (x402.aibtc.com)
168
+
169
+ Utility services for agents:
170
+
171
+ | Category | Endpoints |
172
+ |----------|-----------|
173
+ | **Inference** | `/inference/openrouter/chat`, `/inference/cloudflare/chat` |
174
+ | **Stacks** | `/stacks/address`, `/stacks/decode`, `/stacks/profile` |
175
+ | **Hashing** | `/hashing/sha256`, `/hashing/keccak256`, `/hashing/hash160` |
176
+ | **Storage** | `/storage/kv/*`, `/storage/paste/*`, `/storage/db/*`, `/storage/memory/*` |
177
+
178
+ [API Docs](https://x402.aibtc.com/docs) · [Staging](https://x402.aibtc.dev)
179
+
180
+ #### x402 Biwas API (x402.biwas.xyz)
181
+
182
+ DeFi analytics and market data:
183
+
184
+ | Category | Endpoints |
185
+ |----------|-----------|
186
+ | **Pools** | `/api/pools/trending`, `/api/pools/all` |
187
+ | **Market Data** | `/api/tokens/prices`, `/api/tokens/trending` |
188
+ | **Wallet Analysis** | `/api/wallet/holdings`, `/api/wallet/history` |
189
+ | **Security** | `/api/security/audit`, `/api/security/score` |
190
+
191
+ [API Docs](https://x402.biwas.xyz/docs)
192
+
193
+ ### Usage
194
+
195
+ Discover endpoints:
196
+
197
+ ```
198
+ "List x402 endpoints for inference"
199
+ "What storage APIs are available?"
200
+ ```
201
+
202
+ Execute endpoint:
203
+
204
+ ```
205
+ "Chat with Claude via x402"
206
+ "Store this data in x402 KV"
207
+ ```
208
+
209
+ Uses `list_x402_endpoints` to discover, `execute_x402_endpoint` to call.
210
+
211
+ ### Payment
212
+
213
+ - **Tokens**: STX, sBTC, USDCx
214
+ - **Pricing**: Standard tier (~0.001 STX) or dynamic (LLM pass-through + 20%)
215
+ - **Flow**: Request → 402 response → sign payment → retry with proof
216
+
217
+ ### x402 Tool Reference
218
+
219
+ | Tool | Description |
220
+ |------|-------------|
221
+ | `list_x402_endpoints` | Discover APIs by source/category |
222
+ | `execute_x402_endpoint` | Call endpoint with auto-payment |
223
+ | `scaffold_x402_endpoint` | Generate x402 API project |
224
+ | `scaffold_x402_ai_endpoint` | Generate x402 AI API project |
225
+
226
+ ## Smart Contract Calls
227
+
228
+ Call any Stacks smart contract:
229
+
230
+ ```
231
+ "Call get-balance on token contract"
232
+ ```
233
+
234
+ Uses `call_contract` for write operations, `call_read_only_function` for read-only.
235
+
236
+ ### Contract Tool Reference
237
+
238
+ | Tool | Description |
239
+ |------|-------------|
240
+ | `call_contract` | Call contract function (signs tx) |
241
+ | `call_read_only_function` | Read-only call (no signing) |
242
+ | `deploy_contract` | Deploy Clarity contract |
243
+ | `get_contract_info` | Get contract ABI |
244
+ | `get_transaction_status` | Check tx status |
245
+
246
+ ## More Information
247
+
248
+ - [Stacks Docs](https://docs.stacks.co)
249
+ - [ALEX DEX](https://alexgo.io)
250
+ - [Zest Protocol](https://zestprotocol.com)
251
+ - [x402 Protocol](https://www.x402.org)
252
+ - [STX402 Docs](https://stx402.com/docs)
253
+ - [x402 AIBTC Docs](https://x402.aibtc.com/docs)
254
+ - [CLAUDE.md DeFi Sections](../../CLAUDE.md#defi---alex-dex-mainnet-only)
255
+
256
+ ---
257
+
258
+ *Back to: [SKILL.md](../SKILL.md)*
@@ -0,0 +1,211 @@
1
+ # Troubleshooting
2
+
3
+ Common issues and solutions when using the Bitcoin wallet tools.
4
+
5
+ ## Wallet Issues
6
+
7
+ ### "Wallet not unlocked"
8
+
9
+ **Symptom**: Transaction fails with unlock error.
10
+
11
+ **Solution**: Run `wallet_unlock` with your password before sending transactions.
12
+
13
+ ```
14
+ "Unlock my wallet"
15
+ ```
16
+
17
+ After completing transactions, lock for security:
18
+
19
+ ```
20
+ "Lock my wallet"
21
+ ```
22
+
23
+ ### "No wallet configured"
24
+
25
+ **Symptom**: Tools fail without wallet.
26
+
27
+ **Solution**: Create or import a wallet first:
28
+
29
+ ```
30
+ "Create a new wallet"
31
+ "Import wallet from mnemonic"
32
+ ```
33
+
34
+ ### "Wrong password"
35
+
36
+ **Symptom**: Unlock fails.
37
+
38
+ **Solution**: Use `wallet_list` to find and confirm the correct wallet `id` (not just the name). If needed, run `wallet_switch <walletId>`, then retry `wallet_unlock` with that wallet ID and the correct password.
39
+
40
+ ## Balance Issues
41
+
42
+ ### "Insufficient balance"
43
+
44
+ **Symptom**: Transfer fails due to low balance.
45
+
46
+ **Solution**: Check balance includes fees:
47
+
48
+ ```
49
+ "What's my BTC balance?"
50
+ "What are current fees?"
51
+ ```
52
+
53
+ For Bitcoin, you need: amount + (fee_rate * ~200 vBytes).
54
+
55
+ ### "Unconfirmed balance"
56
+
57
+ **Symptom**: Balance shows but can't spend.
58
+
59
+ **Solution**: Wait for confirmations. `get_btc_balance` shows confirmed vs unconfirmed. Most transfers need 1+ confirmations.
60
+
61
+ ## Transaction Issues
62
+
63
+ ### "Transaction pending"
64
+
65
+ **Symptom**: Transaction broadcast but not confirmed.
66
+
67
+ **Solution**: Use the `explorerUrl` returned by `transfer_btc` to check status on mempool.space. Bitcoin transactions can take 10 min to 1+ hour depending on fee rate. Use "fast" fees for quicker confirmation.
68
+
69
+ ### "Transaction failed"
70
+
71
+ **Symptom**: Broadcast error.
72
+
73
+ **Possible causes**:
74
+ - Insufficient balance
75
+ - Invalid address
76
+ - Network issues
77
+
78
+ **Solution**: Check error message, verify address format, retry.
79
+
80
+ ### "Invalid address"
81
+
82
+ **Symptom**: Address rejected.
83
+
84
+ **Solution**: Verify address matches network:
85
+
86
+ | Network | BTC Address | STX Address |
87
+ |---------|-------------|-------------|
88
+ | Mainnet | `bc1...` | `SP...` |
89
+ | Testnet | `tb1...` | `ST...` |
90
+
91
+ ## Network Issues
92
+
93
+ ### "Network timeout"
94
+
95
+ **Symptom**: API calls fail.
96
+
97
+ **Solution**:
98
+ 1. Check internet connection
99
+ 2. Retry after a moment
100
+ 3. Check mempool.space (BTC) or Hiro API (Stacks) status
101
+
102
+ ### "Rate limited"
103
+
104
+ **Symptom**: Too many requests error.
105
+
106
+ **Solution**: Wait a few seconds between calls. Avoid rapid polling.
107
+
108
+ ## Pillar Issues
109
+
110
+ ### Browser Handoff Mode
111
+
112
+ #### "Browser didn't open"
113
+
114
+ **Symptom**: Pillar operation stuck.
115
+
116
+ **Solution**: Manually open https://pillarbtc.com and check if logged in.
117
+
118
+ #### "Operation timed out"
119
+
120
+ **Symptom**: Pillar action never completes.
121
+
122
+ **Solution**:
123
+ 1. Check browser for pending approval
124
+ 2. Ensure you're logged into Pillar
125
+ 3. Cancel and retry
126
+
127
+ ### Agent Direct Mode
128
+
129
+ #### "No signing key found"
130
+
131
+ **Symptom**: `pillar_direct_*` tools fail.
132
+
133
+ **Solution**: Create a signing key and wallet first:
134
+
135
+ ```
136
+ "Create a Pillar wallet for my agent"
137
+ ```
138
+
139
+ Uses `pillar_direct_create_wallet` - generates key, deploys wallet, registers pubkey.
140
+
141
+ #### "Signing key locked"
142
+
143
+ **Symptom**: Operations fail with lock error.
144
+
145
+ **Solution**: Keys auto-unlock if `PILLAR_API_KEY` is set. If not:
146
+
147
+ ```
148
+ "Unlock my Pillar signing key"
149
+ ```
150
+
151
+ #### "Wallet pending"
152
+
153
+ **Symptom**: Operations fail, wallet not ready.
154
+
155
+ **Solution**: Wait 20-30 seconds after `pillar_direct_create_wallet` for on-chain deployment to complete.
156
+
157
+ ## Stacks/DeFi Issues
158
+
159
+ ### "Mainnet only"
160
+
161
+ **Symptom**: ALEX or Zest tools fail on testnet.
162
+
163
+ **Solution**: ALEX DEX and Zest Protocol are mainnet-only. Switch network or use testnet alternatives.
164
+
165
+ ### "Contract call failed"
166
+
167
+ **Symptom**: Smart contract error.
168
+
169
+ **Solution**: Check error message for:
170
+ - Insufficient tokens
171
+ - Invalid arguments
172
+ - Contract paused
173
+
174
+ ### "Slippage too high"
175
+
176
+ **Symptom**: Swap rejected.
177
+
178
+ **Solution**:
179
+ 1. Get fresh quote
180
+ 2. Increase slippage tolerance
181
+ 3. Try smaller amount
182
+
183
+ ## Getting Help
184
+
185
+ ### Debug Information
186
+
187
+ Gather this info before reporting:
188
+
189
+ ```
190
+ "Check wallet status"
191
+ "Get network status"
192
+ ```
193
+
194
+ ### Report Issues
195
+
196
+ - [GitHub Issues](https://github.com/aibtcdev/aibtc-mcp-server/issues)
197
+ - Include: error message, command attempted, network (mainnet/testnet)
198
+
199
+ ### Environment Check
200
+
201
+ Verify configuration:
202
+
203
+ ```
204
+ "Get wallet info"
205
+ ```
206
+
207
+ Shows: wallet address, network, API URL.
208
+
209
+ ---
210
+
211
+ *Back to: [SKILL.md](../SKILL.md)*