@aibtc/mcp-server 1.70.0 → 1.70.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/README.md CHANGED
@@ -10,7 +10,7 @@ Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg,
10
10
  - **Bitcoin L1** - Check balances, send BTC, manage UTXOs via mempool.space
11
11
  - **Agent's Own Wallet** - Agents get their own wallet to perform blockchain transactions
12
12
  - **Secure Storage** - Wallets encrypted with AES-256-GCM and stored locally
13
- - **150+ Tools** - Bitcoin L1 + comprehensive Stacks L2 operations
13
+ - **350+ Tools** - Bitcoin L1 + comprehensive Stacks L2 operations
14
14
  - **sBTC Support** - Native Bitcoin on Stacks operations
15
15
  - **Token Operations** - SIP-010 fungible token transfers and queries
16
16
  - **NFT Support** - SIP-009 NFT holdings, transfers, and metadata
@@ -276,7 +276,7 @@ Claude: Done! Transaction broadcast: abc123...
276
276
 
277
277
  Both addresses are derived from the same recovery phrase, making it easy to manage both Layer 1 (Bitcoin) and Layer 2 (Stacks) assets.
278
278
 
279
- ## Available Tools (150+ total)
279
+ ## Available Tools (350+ total)
280
280
 
281
281
  ### Wallet Management
282
282
  | Tool | Description |
@@ -542,7 +542,7 @@ Or use any SIP-010 token by contract ID: `SP2X...::token-name`
542
542
 
543
543
  | Environment Variable | Description | Default |
544
544
  |---------------------|-------------|---------|
545
- | `NETWORK` | `mainnet` or `testnet` | `mainnet` (installer) / `testnet` (if unset) |
545
+ | `NETWORK` | `mainnet` or `testnet` | `mainnet` |
546
546
  | `API_URL` | Default x402 API base URL | `https://x402.biwas.xyz` |
547
547
  | `CLIENT_MNEMONIC` | (Optional) Pre-configured mnemonic | - |
548
548
  | `HIRO_API_KEY` | (Optional) Hiro API key for higher rate limits | - |
@@ -550,7 +550,7 @@ Or use any SIP-010 token by contract ID: `SP2X...::token-name`
550
550
  | `SPEND_LIMIT_DAILY_USTX` / `SPEND_LIMIT_SESSION_USTX` | STX spend cap per day / per unlock (micro-STX) | `10000000` (10 STX) |
551
551
  | `SPEND_LIMIT_DAILY_SATS` / `SPEND_LIMIT_SESSION_SATS` | BTC spend cap per day / per unlock (sats) | `50000` |
552
552
 
553
- **Note on `NETWORK`:** The `--install` command writes `NETWORK=mainnet` by default (pass `--testnet` to use testnet). If you omit `NETWORK` from your config entirely, the runtime fallback is `testnet`. Most users should set this explicitly.
553
+ **Note on `NETWORK`:** The `--install` command writes `NETWORK=mainnet` by default (pass `--testnet` to use testnet). If you omit `NETWORK` from your config entirely, the runtime fallback is also `mainnet`.
554
554
 
555
555
  **Note on spending limits:** A default-on safety rail meters every outbound spend (`transfer_stx`, `transfer_btc`, x402/L402 auto-payments) against a cumulative per-session and per-day cap, so a single bad instruction or a malicious endpoint can't drain the wallet. A spend over the cap is blocked and reports the remaining budget. Raise the caps via the env vars above, or disable with `SPEND_LIMIT_ENABLED=false`. See [SECURITY.md](SECURITY.md#limit-blast-radius).
556
556
 
@@ -627,11 +627,13 @@ The skill is automatically included when you install the MCP server. Find it at:
627
627
  skill/
628
628
  ├── SKILL.md # Bitcoin L1 core workflows
629
629
  └── references/
630
+ ├── at-stake.md # El Salvador prediction market & side legions
630
631
  ├── genesis-lifecycle.md # Agent registration & check-in
631
632
  ├── inscription-workflow.md # Bitcoin inscription guide
632
633
  ├── pillar-wallet.md # Pillar smart wallet guide
633
634
  ├── stacks-defi.md # Stacks L2 / DeFi operations
634
- └── troubleshooting.md # Common issues and solutions
635
+ ├── troubleshooting.md # Common issues and solutions
636
+ └── x402-inbox.md # x402 inbox messaging
635
637
  ```
636
638
 
637
639
  ## Development
@@ -12,7 +12,7 @@ export declare const MAINNET_CONTRACTS: {
12
12
  readonly POX_4: "SP000000000000000000002Q6VF78.pox-4";
13
13
  readonly ALEX_AMM_POOL: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.amm-swap-pool-v1-1";
14
14
  readonly ALEX_TOKEN: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex";
15
- readonly ALEX_WSTX: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2";
15
+ readonly ALEX_WSTX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2";
16
16
  readonly ZEST_MARKET: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-4-market";
17
17
  readonly ZEST_DATA: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.protocol-data";
18
18
  readonly ZEST_MARKET_VAULT: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-market-vault";
@@ -75,7 +75,7 @@ export declare function getContracts(network: Network): {
75
75
  readonly POX_4: "SP000000000000000000002Q6VF78.pox-4";
76
76
  readonly ALEX_AMM_POOL: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.amm-swap-pool-v1-1";
77
77
  readonly ALEX_TOKEN: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex";
78
- readonly ALEX_WSTX: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2";
78
+ readonly ALEX_WSTX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2";
79
79
  readonly ZEST_MARKET: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-4-market";
80
80
  readonly ZEST_DATA: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.protocol-data";
81
81
  readonly ZEST_MARKET_VAULT: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-market-vault";
@@ -118,7 +118,7 @@ export declare const WELL_KNOWN_TOKENS: {
118
118
  readonly sBTC: "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token";
119
119
  readonly USDCx: "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx";
120
120
  readonly ALEX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex";
121
- readonly wSTX: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2";
121
+ readonly wSTX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2";
122
122
  };
123
123
  readonly testnet: {
124
124
  readonly STX: "native";
@@ -146,7 +146,7 @@ export declare function getWellKnownTokens(network: Network): {
146
146
  readonly sBTC: "SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token";
147
147
  readonly USDCx: "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx";
148
148
  readonly ALEX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex";
149
- readonly wSTX: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2";
149
+ readonly wSTX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2";
150
150
  } | {
151
151
  readonly STX: "native";
152
152
  readonly sBTC: "ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token";
@@ -16,7 +16,7 @@ export const MAINNET_CONTRACTS = {
16
16
  // ALEX DEX (SDK handles most operations, but we need pool contract for queries)
17
17
  ALEX_AMM_POOL: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.amm-swap-pool-v1-1",
18
18
  ALEX_TOKEN: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex",
19
- ALEX_WSTX: "SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2",
19
+ ALEX_WSTX: "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2",
20
20
  // Zest Protocol v2
21
21
  ZEST_MARKET: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.v0-4-market",
22
22
  ZEST_DATA: "SP1A27KFY4XERQCCRCARCYD1CC5N7M6688BSYADJ7.protocol-data", // read-only helper for v0-4-market positions
@@ -12,7 +12,7 @@ export function registerDefiTools(server) {
12
12
  description: `Get a swap quote from ALEX DEX.
13
13
 
14
14
  Returns the expected output amount for swapping tokenX to tokenY.
15
- Use full contract IDs for tokens (e.g., 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-wstx-v2').
15
+ Use full contract IDs for tokens (e.g., 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-wstx-v2').
16
16
 
17
17
  Note: ALEX DEX is only available on mainnet.`,
18
18
  inputSchema: {
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { createApiClient, API_URL, probeEndpoint, formatPaymentAmount, checkSufficientBalance, generateDedupKey, checkDedupCache, recordTransaction, X402_DEDUP_TTL_MS, NETWORK } from "../services/x402.service.js";
3
3
  import { ALL_ENDPOINTS, searchEndpoints, formatEndpointsTable, getEndpointsBySource, getCategories, } from "../endpoints/registry.js";
4
4
  import { createJsonResponse, createErrorResponse } from "../utils/index.js";
5
- import { X402_HEADERS } from "../utils/x402-protocol.js";
5
+ import { X402_HEADERS, decodePaymentResponse } from "../utils/x402-protocol.js";
6
6
  import { extractPaymentIdFromPaymentSignature, extractTxidFromPaymentSignature, pollTransactionConfirmation, } from "../utils/x402-recovery.js";
7
7
  import { formatCanonicalPaymentStatus } from "../utils/x402-payment-state.js";
8
8
  import { emitPaymentLog } from "../utils/x402-payment-logging.js";
@@ -317,8 +317,13 @@ For aibtc.com inbox messages, use send_inbox_message_direct instead — it signs
317
317
  },
318
318
  });
319
319
  const response = await api.request({ method, url: parsed.requestPath, params, data });
320
+ const paymentResponseTxid = decodePaymentResponse(response.headers?.[X402_HEADERS.PAYMENT_RESPONSE])?.transaction ||
321
+ undefined;
322
+ const paymentBodyTxid = response.data?.payment?.txid;
320
323
  const rawTxid = response.data?.txid ||
321
324
  response.data?.payment_txid ||
325
+ paymentResponseTxid ||
326
+ (typeof paymentBodyTxid === "string" ? paymentBodyTxid : undefined) ||
322
327
  response.headers?.['x-transaction-id'] ||
323
328
  undefined;
324
329
  // Detect whether a payment was made by checking for the payment-signature
@@ -32,6 +32,8 @@ import { registerTeneroTools } from "./tenero.tools.js";
32
32
  import { registerOrdinalsP2PTools } from "./ordinals-p2p.tools.js";
33
33
  import { registerOrdinalsMarketplaceTools } from "./ordinals-marketplace.tools.js";
34
34
  import { registerTaprootMultisigTools } from "./taproot-multisig.tools.js";
35
+ import { registerPsbtTools } from "./psbt.tools.js";
36
+ import { registerSettingsTools } from "./settings.tools.js";
35
37
  import { registerJingswapTools } from "./jingswap.tools.js";
36
38
  import { registerSigningTools } from "./signing.tools.js";
37
39
  import { registerInferenceMarketplaceTools } from "./inference-marketplace.tools.js";
@@ -161,13 +163,17 @@ export function registerAllTools(server) {
161
163
  registerOrdinalsMarketplaceTools(server);
162
164
  // Taproot Multisig (M-of-N coordination via OP_CHECKSIGADD, BIP-341/342)
163
165
  registerTaprootMultisigTools(server);
166
+ // PSBT sign/broadcast/decode (used by the ordinals marketplace, P2P and taproot multisig flows)
167
+ registerPsbtTools(server);
168
+ // Settings (Hiro API key, custom Stacks API URL, server version)
169
+ registerSettingsTools(server);
164
170
  // Jingswap Auction (blind batch auctions for STX/sBTC)
165
171
  registerJingswapTools(server);
166
172
  // Message Signing (BTC BIP-322, Stacks SIWS, SIP-018 structured data, Nostr NIP-01)
167
173
  registerSigningTools(server);
168
174
  // AIBTC Inference Marketplace (list/manage a paid model endpoint via wallet signature)
169
175
  registerInferenceMarketplaceTools(server);
170
- // AIBTC News (signal feed, leaderboard, file signals)
176
+ // AIBTC News (deprecated — API retired; each tool redirects to legion_*)
171
177
  registerNewsTools(server);
172
178
  // AIBTC News Legion (mainnet aibtc-news-gov — inscribe, propose, vote, conclude)
173
179
  registerLegionTools(server);
@@ -1,36 +1,10 @@
1
1
  /**
2
- * AIBTC News Tools
2
+ * AIBTC News tools — deprecated.
3
3
  *
4
- * Tools for interacting with the aibtc.news decentralized intelligence network.
5
- * Agents can read signal feeds, check correspondent standings, and file signals
6
- * authenticated via BIP-322 signatures (bc1q P2WPKH addresses only).
7
- *
8
- * Correspondent tools (read-only, no auth required):
9
- * - news_list_signals — Browse the signal feed with optional filters
10
- * - news_front_page — Get the latest compiled intelligence brief
11
- * - news_leaderboard — Ranked correspondents with signal counts and streaks
12
- * - news_check_status — Signal counts, streak, and earnings for a BTC address
13
- * - news_list_beats — List all registered beats
14
- * - news_list_editors — List editors registered on a beat
15
- *
16
- * Authenticated tools (require unlocked wallet with bc1q/tb1q address):
17
- * - news_file_signal — File a signal on a beat (BIP-322 signed)
18
- * - news_claim_beat — Create or join a beat (BIP-322 signed)
19
- * - news_editor_review_signal — Approve or reject a signal (editor or publisher)
20
- * - news_editor_file_review — Submit structured editorial review for a signal
21
- * - news_editor_check_earnings — Check editor earnings for an address
22
- * - news_register_editor — Register an editor on a beat (publisher only)
23
- * - news_deactivate_editor — Deactivate an editor on a beat (publisher only)
24
- * - news_file_correction — File a correction on a signal
25
- * - news_publisher_compile_brief — Compile the daily intelligence brief (publisher only)
26
- * - news_publisher_set_beat_config — Update beat details and config (publisher only)
27
- * - news_record_editor_payout — Record payout txid for an editor earning (publisher only)
28
- *
29
- * Authentication: BIP-322 simple signature (P2WPKH, bc1q mainnet / tb1q testnet).
30
- * Message format: "METHOD /path:unix_timestamp"
31
- * Headers: X-BTC-Address, X-BTC-Signature, X-BTC-Timestamp
32
- *
33
- * Reference: https://aibtc.news/api (GET /api for full spec)
4
+ * aibtc.news migrated from an off-chain newsroom API to on-chain governance, and
5
+ * every endpoint these tools called now answers 410 Gone. The tool names stay
6
+ * registered so an agent that still calls one is told where the workflow moved
7
+ * (the legion_* tools) instead of getting "unknown tool".
34
8
  */
35
9
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
36
10
  export declare function registerNewsTools(server: McpServer): void;