@aibtc/mcp-server 1.33.4 → 1.34.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/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/styx.tools.d.ts +20 -0
- package/dist/tools/styx.tools.d.ts.map +1 -0
- package/dist/tools/styx.tools.js +401 -0
- package/dist/tools/styx.tools.js.map +1 -0
- package/package.json +2 -1
- package/skill/SKILL.md +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAwBpE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4DxD"}
|
package/dist/tools/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { registerTokenTools } from "./tokens.tools.js";
|
|
|
7
7
|
import { registerNftTools } from "./nft.tools.js";
|
|
8
8
|
import { registerStackingTools } from "./stacking.tools.js";
|
|
9
9
|
import { registerBnsTools } from "./bns.tools.js";
|
|
10
|
+
import { registerStyxTools } from "./styx.tools.js";
|
|
10
11
|
import { registerQueryTools } from "./query.tools.js";
|
|
11
12
|
import { registerEndpointTools } from "./endpoint.tools.js";
|
|
12
13
|
import { registerDefiTools } from "./defi.tools.js";
|
|
@@ -48,6 +49,8 @@ export function registerAllTools(server) {
|
|
|
48
49
|
registerDefiTools(server);
|
|
49
50
|
// Bitflow DEX (disabled until API key integration is complete)
|
|
50
51
|
// registerBitflowTools(server);
|
|
52
|
+
// Styx BTC→sBTC conversion
|
|
53
|
+
registerStyxTools(server);
|
|
51
54
|
// Scaffolding (generate x402 endpoint projects)
|
|
52
55
|
registerScaffoldTools(server);
|
|
53
56
|
// OpenRouter AI (call AI models directly)
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,+DAA+D;AAC/D,6DAA6D;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;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AC,MAAM,CAAC,CAAC;IAE1B,mBAAmB;IACnB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,iBAAiB;IACjB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,iBAAiB;IACjB,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE9B,cAAc;IACd,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEzB,qBAAqB;IACrB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAE3B,iBAAiB;IACjB,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE9B,iCAAiC;IACjC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE1B,+DAA+D;IAC/D,gCAAgC;IAEhC,2BAA2B;IAC3B,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE1B,gDAAgD;IAChD,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE9B,0CAA0C;IAC1C,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAEhC,+CAA+C;IAC/C,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAEjC,yCAAyC;IACzC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE5B,mDAAmD;IACnD,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAElC,+CAA+C;IAC/C,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styx BTC→sBTC conversion tools
|
|
3
|
+
*
|
|
4
|
+
* Headless BTC→sBTC conversion via the Styx protocol (btc2sbtc.com).
|
|
5
|
+
* Uses @faktoryfun/styx-sdk for deposit reservation and tracking,
|
|
6
|
+
* @scure/btc-signer for local PSBT construction and signing,
|
|
7
|
+
* mempool.space for broadcast.
|
|
8
|
+
*
|
|
9
|
+
* Tools:
|
|
10
|
+
* - styx_pool_status: Pool liquidity info
|
|
11
|
+
* - styx_pools: All available pools
|
|
12
|
+
* - styx_fees: Bitcoin fee estimates
|
|
13
|
+
* - styx_price: BTC price in USD
|
|
14
|
+
* - styx_deposit: Full headless deposit flow
|
|
15
|
+
* - styx_status: Deposit status by ID or txid
|
|
16
|
+
* - styx_history: Deposit history for a Stacks address
|
|
17
|
+
*/
|
|
18
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
19
|
+
export declare function registerStyxTools(server: McpServer): void;
|
|
20
|
+
//# sourceMappingURL=styx.tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styx.tools.d.ts","sourceRoot":"","sources":["../../src/tools/styx.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BpE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0bzD"}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Styx BTC→sBTC conversion tools
|
|
3
|
+
*
|
|
4
|
+
* Headless BTC→sBTC conversion via the Styx protocol (btc2sbtc.com).
|
|
5
|
+
* Uses @faktoryfun/styx-sdk for deposit reservation and tracking,
|
|
6
|
+
* @scure/btc-signer for local PSBT construction and signing,
|
|
7
|
+
* mempool.space for broadcast.
|
|
8
|
+
*
|
|
9
|
+
* Tools:
|
|
10
|
+
* - styx_pool_status: Pool liquidity info
|
|
11
|
+
* - styx_pools: All available pools
|
|
12
|
+
* - styx_fees: Bitcoin fee estimates
|
|
13
|
+
* - styx_price: BTC price in USD
|
|
14
|
+
* - styx_deposit: Full headless deposit flow
|
|
15
|
+
* - styx_status: Deposit status by ID or txid
|
|
16
|
+
* - styx_history: Deposit history for a Stacks address
|
|
17
|
+
*/
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import * as btc from "@scure/btc-signer";
|
|
20
|
+
import { hex } from "@scure/base";
|
|
21
|
+
import { styxSDK, MIN_DEPOSIT_SATS, } from "@faktoryfun/styx-sdk";
|
|
22
|
+
import { NETWORK } from "../config/networks.js";
|
|
23
|
+
import { createJsonResponse, createErrorResponse } from "../utils/index.js";
|
|
24
|
+
import { getWalletManager } from "../services/wallet-manager.js";
|
|
25
|
+
import { MempoolApi, getMempoolTxUrl } from "../services/mempool-api.js";
|
|
26
|
+
import { OrdinalIndexer } from "../services/ordinal-indexer.js";
|
|
27
|
+
const FEE_PRIORITIES = ["low", "medium", "high"];
|
|
28
|
+
function getBtcNetwork() {
|
|
29
|
+
return NETWORK === "testnet" ? btc.TEST_NETWORK : btc.NETWORK;
|
|
30
|
+
}
|
|
31
|
+
export function registerStyxTools(server) {
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// styx_pool_status
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
server.registerTool("styx_pool_status", {
|
|
36
|
+
description: "Get current Styx pool liquidity and status. " +
|
|
37
|
+
"Shows realAvailable and estimatedAvailable BTC in the pool.",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
pool: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Pool ID: "main" (300k sat max) or "aibtc" (1M sat max). Defaults to "main".'),
|
|
43
|
+
},
|
|
44
|
+
}, async ({ pool = "main" }) => {
|
|
45
|
+
try {
|
|
46
|
+
const status = await styxSDK.getPoolStatus(pool);
|
|
47
|
+
return createJsonResponse({
|
|
48
|
+
pool,
|
|
49
|
+
realAvailable: status.realAvailable,
|
|
50
|
+
estimatedAvailable: status.estimatedAvailable,
|
|
51
|
+
estimatedAvailableSats: Math.round(status.estimatedAvailable * 1e8),
|
|
52
|
+
lastUpdated: status.lastUpdated,
|
|
53
|
+
network: NETWORK,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return createErrorResponse(error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// styx_pools
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
server.registerTool("styx_pools", {
|
|
64
|
+
description: "List all available Styx pools with their configurations. " +
|
|
65
|
+
"Pools: main (up to 300k sats, sbtc/usda/pepe), aibtc (up to 1M sats, sbtc/aibtc). " +
|
|
66
|
+
"Minimum deposit: 10,000 sats for both pools.",
|
|
67
|
+
inputSchema: {},
|
|
68
|
+
}, async () => {
|
|
69
|
+
try {
|
|
70
|
+
const pools = await styxSDK.getAvailablePools();
|
|
71
|
+
return createJsonResponse({ pools, network: NETWORK });
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return createErrorResponse(error);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// styx_fees
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
server.registerTool("styx_fees", {
|
|
81
|
+
description: "Get current Bitcoin network fee estimates (sat/vB) from Styx: low, medium, high.",
|
|
82
|
+
inputSchema: {},
|
|
83
|
+
}, async () => {
|
|
84
|
+
try {
|
|
85
|
+
const fees = await styxSDK.getFeeEstimates();
|
|
86
|
+
return createJsonResponse({ ...fees, network: NETWORK });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return createErrorResponse(error);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// styx_price
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
server.registerTool("styx_price", {
|
|
96
|
+
description: "Get current BTC price in USD from Styx.",
|
|
97
|
+
inputSchema: {},
|
|
98
|
+
}, async () => {
|
|
99
|
+
try {
|
|
100
|
+
const price = await styxSDK.getBTCPrice();
|
|
101
|
+
return createJsonResponse({ priceUsd: price, network: NETWORK });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
return createErrorResponse(error);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// styx_deposit
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
server.registerTool("styx_deposit", {
|
|
111
|
+
description: "Full headless BTC→sBTC deposit via the Styx protocol. " +
|
|
112
|
+
"Flow: reserve pool liquidity → build PSBT locally → sign with wallet keys → " +
|
|
113
|
+
"broadcast to mempool.space → update deposit status. " +
|
|
114
|
+
"Requires an unlocked wallet with sufficient BTC balance. " +
|
|
115
|
+
"On mainnet, ordinal UTXOs are automatically filtered out to protect inscriptions. " +
|
|
116
|
+
"Minimum deposit: 10,000 sats. Pool limits: main=300k sats, aibtc=1M sats.",
|
|
117
|
+
inputSchema: {
|
|
118
|
+
amount: z
|
|
119
|
+
.coerce
|
|
120
|
+
.number()
|
|
121
|
+
.int()
|
|
122
|
+
.min(MIN_DEPOSIT_SATS)
|
|
123
|
+
.describe(`Amount to deposit in satoshis (min ${MIN_DEPOSIT_SATS}). Example: 50000`),
|
|
124
|
+
stxReceiver: z
|
|
125
|
+
.string()
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("Stacks address to receive sBTC. Uses active wallet address if omitted."),
|
|
128
|
+
btcSender: z
|
|
129
|
+
.string()
|
|
130
|
+
.optional()
|
|
131
|
+
.describe("BTC address sending funds. Must match the active wallet's BTC address. " +
|
|
132
|
+
"Uses active wallet if omitted."),
|
|
133
|
+
pool: z
|
|
134
|
+
.string()
|
|
135
|
+
.optional()
|
|
136
|
+
.describe('Pool ID: "main" or "aibtc". Defaults to "main".'),
|
|
137
|
+
fee: z
|
|
138
|
+
.enum(["low", "medium", "high"])
|
|
139
|
+
.optional()
|
|
140
|
+
.describe('Fee priority: "low", "medium", or "high". Defaults to "medium".'),
|
|
141
|
+
},
|
|
142
|
+
}, async ({ amount, stxReceiver, btcSender, pool = "main", fee = "medium" }) => {
|
|
143
|
+
let depositId;
|
|
144
|
+
let broadcastTxid;
|
|
145
|
+
try {
|
|
146
|
+
// amount is validated by z.coerce.number().int().min(MIN_DEPOSIT_SATS) — no manual checks needed
|
|
147
|
+
const amountSats = amount;
|
|
148
|
+
// Validate fee priority (belt-and-suspenders since zod enum already validates)
|
|
149
|
+
const feePriority = fee;
|
|
150
|
+
if (!FEE_PRIORITIES.includes(feePriority)) {
|
|
151
|
+
throw new Error(`Invalid fee value "${fee}". Must be one of: ${FEE_PRIORITIES.join(", ")}`);
|
|
152
|
+
}
|
|
153
|
+
// Get wallet
|
|
154
|
+
const walletManager = getWalletManager();
|
|
155
|
+
const account = walletManager.getActiveAccount();
|
|
156
|
+
if (!account) {
|
|
157
|
+
throw new Error("Wallet is not unlocked. Unlock your wallet first.");
|
|
158
|
+
}
|
|
159
|
+
if (!account.btcAddress || !account.btcPrivateKey || !account.btcPublicKey) {
|
|
160
|
+
throw new Error("Bitcoin keys not available. Unlock your wallet again.");
|
|
161
|
+
}
|
|
162
|
+
// Validate btcSender if provided — must match the active wallet
|
|
163
|
+
if (btcSender && btcSender !== account.btcAddress) {
|
|
164
|
+
throw new Error(`btcSender "${btcSender}" must match the active wallet BTC address ` +
|
|
165
|
+
`(${account.btcAddress}). This tool signs with the active wallet's keys.`);
|
|
166
|
+
}
|
|
167
|
+
const resolvedBtcSender = account.btcAddress;
|
|
168
|
+
const resolvedStxReceiver = stxReceiver || account.address;
|
|
169
|
+
// Check pool liquidity
|
|
170
|
+
const poolStatus = await styxSDK.getPoolStatus(pool);
|
|
171
|
+
const availableSats = Math.round(poolStatus.estimatedAvailable * 1e8);
|
|
172
|
+
if (amountSats > availableSats) {
|
|
173
|
+
throw new Error(`Insufficient pool liquidity: need ${amountSats} sats, pool has ~${availableSats} sats`);
|
|
174
|
+
}
|
|
175
|
+
// Step 1: Reserve pool liquidity
|
|
176
|
+
const btcAmount = (amountSats / 1e8).toFixed(8);
|
|
177
|
+
depositId = await styxSDK.createDeposit({
|
|
178
|
+
btcAmount: parseFloat(btcAmount),
|
|
179
|
+
stxReceiver: resolvedStxReceiver,
|
|
180
|
+
btcSender: resolvedBtcSender,
|
|
181
|
+
poolId: pool,
|
|
182
|
+
});
|
|
183
|
+
// Step 2: Prepare transaction (UTXOs, deposit address, OP_RETURN)
|
|
184
|
+
const prepared = await styxSDK.prepareTransaction({
|
|
185
|
+
amount: btcAmount,
|
|
186
|
+
userAddress: resolvedStxReceiver,
|
|
187
|
+
btcAddress: resolvedBtcSender,
|
|
188
|
+
feePriority,
|
|
189
|
+
walletProvider: null,
|
|
190
|
+
poolId: pool,
|
|
191
|
+
});
|
|
192
|
+
// Step 3: Filter ordinal UTXOs on mainnet to protect inscriptions
|
|
193
|
+
let safeUtxos = prepared.utxos;
|
|
194
|
+
let ordinalsFiltered = false;
|
|
195
|
+
if (NETWORK === "mainnet") {
|
|
196
|
+
const indexer = new OrdinalIndexer(NETWORK);
|
|
197
|
+
const cardinalUtxos = await indexer.getCardinalUtxos(resolvedBtcSender);
|
|
198
|
+
const cardinalSet = new Set(cardinalUtxos.map((u) => `${u.txid}:${u.vout}`));
|
|
199
|
+
const filtered = prepared.utxos.filter((u) => cardinalSet.has(`${u.txid}:${u.vout}`));
|
|
200
|
+
if (filtered.length < prepared.utxos.length) {
|
|
201
|
+
const removed = prepared.utxos.length - filtered.length;
|
|
202
|
+
if (filtered.length === 0) {
|
|
203
|
+
throw new Error(`All ${removed} UTXO(s) selected by Styx contain inscriptions. ` +
|
|
204
|
+
"Cannot deposit without risking inscription loss.");
|
|
205
|
+
}
|
|
206
|
+
// Recompute change after removing ordinal inputs
|
|
207
|
+
const originalTotal = prepared.utxos.reduce((sum, u) => sum + u.value, 0);
|
|
208
|
+
const filteredTotal = filtered.reduce((sum, u) => sum + u.value, 0);
|
|
209
|
+
const originalFee = originalTotal - prepared.amountInSatoshis - prepared.changeAmount;
|
|
210
|
+
if (originalFee < 0) {
|
|
211
|
+
throw new Error("Invalid Styx transaction preparation: negative implied fee.");
|
|
212
|
+
}
|
|
213
|
+
const requiredTotal = prepared.amountInSatoshis + originalFee;
|
|
214
|
+
if (filteredTotal < requiredTotal) {
|
|
215
|
+
throw new Error(`After removing ${removed} ordinal UTXO(s), remaining cardinal balance ` +
|
|
216
|
+
`(${filteredTotal} sats) is insufficient for deposit (${amountSats} sats) ` +
|
|
217
|
+
`and fee (${originalFee} sats).`);
|
|
218
|
+
}
|
|
219
|
+
prepared.changeAmount =
|
|
220
|
+
filteredTotal - prepared.amountInSatoshis - originalFee;
|
|
221
|
+
ordinalsFiltered = true;
|
|
222
|
+
}
|
|
223
|
+
safeUtxos = filtered;
|
|
224
|
+
}
|
|
225
|
+
// Step 4: Build PSBT locally with @scure/btc-signer
|
|
226
|
+
const btcNetwork = getBtcNetwork();
|
|
227
|
+
const tx = new btc.Transaction({ allowUnknownOutputs: true });
|
|
228
|
+
const senderP2wpkh = btc.p2wpkh(account.btcPublicKey, btcNetwork);
|
|
229
|
+
for (const utxo of safeUtxos) {
|
|
230
|
+
tx.addInput({
|
|
231
|
+
txid: utxo.txid,
|
|
232
|
+
index: utxo.vout,
|
|
233
|
+
witnessUtxo: {
|
|
234
|
+
script: senderP2wpkh.script,
|
|
235
|
+
amount: BigInt(utxo.value),
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
// OP_RETURN output FIRST (output index 0) — Styx contract requires OP_RETURN at index 0
|
|
240
|
+
// Styx SDK provides a full script hex (starts with 6a = OP_RETURN opcode)
|
|
241
|
+
if (prepared.opReturnData) {
|
|
242
|
+
tx.addOutput({
|
|
243
|
+
script: hex.decode(prepared.opReturnData),
|
|
244
|
+
amount: BigInt(0),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
// Deposit output to Styx address (output index 1)
|
|
248
|
+
tx.addOutputAddress(prepared.depositAddress, BigInt(prepared.amountInSatoshis), btcNetwork);
|
|
249
|
+
// Change output
|
|
250
|
+
if (prepared.changeAmount > 0) {
|
|
251
|
+
tx.addOutputAddress(resolvedBtcSender, BigInt(prepared.changeAmount), btcNetwork);
|
|
252
|
+
}
|
|
253
|
+
// Step 5: Sign and finalize
|
|
254
|
+
tx.sign(account.btcPrivateKey);
|
|
255
|
+
tx.finalize();
|
|
256
|
+
// Step 6: Broadcast
|
|
257
|
+
const mempoolApi = new MempoolApi(NETWORK);
|
|
258
|
+
broadcastTxid = await mempoolApi.broadcastTransaction(tx.hex);
|
|
259
|
+
// Step 7: Update deposit status (retry once on failure)
|
|
260
|
+
let statusUpdateWarning;
|
|
261
|
+
const statusPayload = {
|
|
262
|
+
id: depositId,
|
|
263
|
+
data: { btcTxId: broadcastTxid, status: "broadcast" },
|
|
264
|
+
};
|
|
265
|
+
try {
|
|
266
|
+
await styxSDK.updateDepositStatus(statusPayload);
|
|
267
|
+
}
|
|
268
|
+
catch (statusError) {
|
|
269
|
+
try {
|
|
270
|
+
await styxSDK.updateDepositStatus(statusPayload);
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
statusUpdateWarning =
|
|
274
|
+
"Deposit broadcast succeeded but status update failed after retry. " +
|
|
275
|
+
"Save depositId and txid for manual recovery. " +
|
|
276
|
+
(statusError instanceof Error
|
|
277
|
+
? statusError.message
|
|
278
|
+
: String(statusError));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return createJsonResponse({
|
|
282
|
+
success: true,
|
|
283
|
+
depositId,
|
|
284
|
+
txid: broadcastTxid,
|
|
285
|
+
explorerUrl: getMempoolTxUrl(broadcastTxid, NETWORK),
|
|
286
|
+
amount: { sats: amountSats, btc: btcAmount },
|
|
287
|
+
pool,
|
|
288
|
+
depositAddress: prepared.depositAddress,
|
|
289
|
+
// fee/feeRate are omitted when ordinal filtering occurred — those values were
|
|
290
|
+
// computed against the original UTXO set and no longer reflect the actual tx
|
|
291
|
+
...(ordinalsFiltered
|
|
292
|
+
? { feeNote: "fee metadata omitted — UTXO set was filtered for ordinals" }
|
|
293
|
+
: { fee: prepared.fee, feeRate: prepared.feeRate }),
|
|
294
|
+
status: "broadcast",
|
|
295
|
+
network: NETWORK,
|
|
296
|
+
note: "sBTC will be credited to your Stacks address after Bitcoin confirmation.",
|
|
297
|
+
...(statusUpdateWarning ? { warning: statusUpdateWarning } : {}),
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
// Best-effort: cancel reservation if we never broadcast
|
|
302
|
+
if (depositId && !broadcastTxid) {
|
|
303
|
+
try {
|
|
304
|
+
await styxSDK.updateDepositStatus({
|
|
305
|
+
id: depositId,
|
|
306
|
+
data: { status: "canceled" },
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
catch {
|
|
310
|
+
// Reservation will expire server-side; don't mask the original error
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return createErrorResponse(error);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
// ---------------------------------------------------------------------------
|
|
317
|
+
// styx_status
|
|
318
|
+
// ---------------------------------------------------------------------------
|
|
319
|
+
server.registerTool("styx_status", {
|
|
320
|
+
description: "Check the status of a Styx BTC→sBTC deposit by deposit ID or Bitcoin transaction ID.",
|
|
321
|
+
inputSchema: {
|
|
322
|
+
id: z.string().optional().describe("Styx deposit ID"),
|
|
323
|
+
txid: z.string().optional().describe("Bitcoin transaction ID"),
|
|
324
|
+
},
|
|
325
|
+
}, async ({ id, txid }) => {
|
|
326
|
+
try {
|
|
327
|
+
if (!id && !txid) {
|
|
328
|
+
throw new Error("Provide either id (deposit ID) or txid (Bitcoin transaction ID).");
|
|
329
|
+
}
|
|
330
|
+
let deposit;
|
|
331
|
+
if (id) {
|
|
332
|
+
deposit = await styxSDK.getDepositStatus(id);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
deposit = await styxSDK.getDepositStatusByTxId(txid);
|
|
336
|
+
}
|
|
337
|
+
return createJsonResponse({
|
|
338
|
+
id: deposit.id,
|
|
339
|
+
status: deposit.status,
|
|
340
|
+
btcAmount: deposit.btcAmount,
|
|
341
|
+
sbtcAmount: deposit.sbtcAmount,
|
|
342
|
+
stxReceiver: deposit.stxReceiver,
|
|
343
|
+
btcSender: deposit.btcSender,
|
|
344
|
+
btcTxId: deposit.btcTxId,
|
|
345
|
+
stxTxId: deposit.stxTxId,
|
|
346
|
+
createdAt: deposit.createdAt,
|
|
347
|
+
updatedAt: deposit.updatedAt,
|
|
348
|
+
network: NETWORK,
|
|
349
|
+
explorerUrl: deposit.btcTxId
|
|
350
|
+
? getMempoolTxUrl(deposit.btcTxId, NETWORK)
|
|
351
|
+
: null,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
catch (error) {
|
|
355
|
+
return createErrorResponse(error);
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
// ---------------------------------------------------------------------------
|
|
359
|
+
// styx_history
|
|
360
|
+
// ---------------------------------------------------------------------------
|
|
361
|
+
server.registerTool("styx_history", {
|
|
362
|
+
description: "Get BTC→sBTC deposit history for a Stacks address via Styx. " +
|
|
363
|
+
"Uses the active wallet's Stacks address if no address is provided.",
|
|
364
|
+
inputSchema: {
|
|
365
|
+
address: z
|
|
366
|
+
.string()
|
|
367
|
+
.optional()
|
|
368
|
+
.describe("Stacks address to query. Uses active wallet if omitted."),
|
|
369
|
+
},
|
|
370
|
+
}, async ({ address }) => {
|
|
371
|
+
try {
|
|
372
|
+
let resolvedAddress = address;
|
|
373
|
+
if (!resolvedAddress) {
|
|
374
|
+
const walletManager = getWalletManager();
|
|
375
|
+
const account = walletManager.getActiveAccount();
|
|
376
|
+
if (!account) {
|
|
377
|
+
throw new Error("No address provided and wallet is not unlocked.");
|
|
378
|
+
}
|
|
379
|
+
resolvedAddress = account.address;
|
|
380
|
+
}
|
|
381
|
+
const deposits = await styxSDK.getDepositHistory(resolvedAddress);
|
|
382
|
+
return createJsonResponse({
|
|
383
|
+
address: resolvedAddress,
|
|
384
|
+
count: deposits.length,
|
|
385
|
+
network: NETWORK,
|
|
386
|
+
deposits: deposits.map((d) => ({
|
|
387
|
+
id: d.id,
|
|
388
|
+
status: d.status,
|
|
389
|
+
btcAmount: d.btcAmount,
|
|
390
|
+
sbtcAmount: d.sbtcAmount,
|
|
391
|
+
btcTxId: d.btcTxId,
|
|
392
|
+
createdAt: d.createdAt,
|
|
393
|
+
})),
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
return createErrorResponse(error);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=styx.tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styx.tools.js","sourceRoot":"","sources":["../../src/tools/styx.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EACL,OAAO,EACP,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAE1D,SAAS,aAAa;IACpB,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,8EAA8E;IAC9E,mBAAmB;IACnB,8EAA8E;IAC9E,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,WAAW,EACT,8CAA8C;YA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AAC,MAAM;oBAChB,SAAS,EAAE,CAAC,CAAC,SAAS;oBACtB,UAAU,EAAE,CAAC,CAAC,UAAU;oBACxB,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,SAAS,EAAE,CAAC,CAAC,SAAS;iBACvB,CAAC,CAAC;aACJ,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibtc/mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg, NFTs, and x402 payments.",
|
|
5
5
|
"mcpName": "io.github.aibtcdev/mcp-server",
|
|
6
6
|
"type": "module",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@bitflowlabs/core-sdk": "^3.0.0",
|
|
47
|
+
"@faktoryfun/styx-sdk": "^1.3.5",
|
|
47
48
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
48
49
|
"@noble/curves": "^2.0.1",
|
|
49
50
|
"@scure/base": "^2.0.0",
|
package/skill/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Bitcoin L1 wallet for agents - check balances, send BTC, manage UTX
|
|
|
4
4
|
license: MIT
|
|
5
5
|
metadata:
|
|
6
6
|
author: aibtcdev
|
|
7
|
-
version: 1.
|
|
7
|
+
version: 1.34.0 # x-release-please-version
|
|
8
8
|
npm: "@aibtc/mcp-server"
|
|
9
9
|
github: https://github.com/aibtcdev/aibtc-mcp-server
|
|
10
10
|
---
|