@aibtc/mcp-server 1.7.0 → 1.9.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.
- package/README.md +84 -9
- package/dist/endpoints/registry.d.ts +3 -3
- package/dist/endpoints/registry.d.ts.map +1 -1
- package/dist/endpoints/registry.js +187 -3
- package/dist/endpoints/registry.js.map +1 -1
- package/dist/services/wallet-manager.d.ts +15 -12
- package/dist/services/wallet-manager.d.ts.map +1 -1
- package/dist/services/wallet-manager.js +26 -61
- package/dist/services/wallet-manager.js.map +1 -1
- package/dist/tools/index.d.ts +8 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +45 -32
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/wallet-management.tools.d.ts.map +1 -1
- package/dist/tools/wallet-management.tools.js +35 -5
- package/dist/tools/wallet-management.tools.js.map +1 -1
- package/dist/tools/wallet.tools.d.ts.map +1 -1
- package/dist/tools/wallet.tools.js +11 -5
- package/dist/tools/wallet.tools.js.map +1 -1
- package/dist/transactions/builder.d.ts +2 -3
- package/dist/transactions/builder.d.ts.map +1 -1
- package/dist/transactions/builder.js.map +1 -1
- package/dist/utils/storage.d.ts +15 -4
- package/dist/utils/storage.d.ts.map +1 -1
- package/dist/utils/storage.js +30 -0
- package/dist/utils/storage.js.map +1 -1
- package/package.json +6 -3
- package/skill/README.md +108 -0
- package/skill/SKILL.md +187 -0
- package/skill/references/pillar-wallet.md +213 -0
- package/skill/references/stacks-defi.md +258 -0
- package/skill/references/troubleshooting.md +211 -0
|
@@ -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)*
|