@aibtc/mcp-server 1.37.0 → 1.38.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.
@@ -0,0 +1,428 @@
1
+ /**
2
+ * Ordinals Marketplace Tools
3
+ *
4
+ * MCP tools for buying, selling, and browsing ordinals/inscriptions on
5
+ * the Magic Eden marketplace (api-mainnet.magiceden.dev).
6
+ *
7
+ * Tools:
8
+ * - ordinals_get_listings: Browse inscriptions listed for sale (no wallet required)
9
+ * - ordinals_list_for_sale: List a wallet inscription for sale via ME PSBT flow
10
+ * - ordinals_list_for_sale_submit: Submit the signed listing PSBT to finalize a listing
11
+ * - ordinals_buy: Buy a listed inscription — returns PSBT to sign + broadcast
12
+ * - ordinals_cancel_listing: Cancel an active Magic Eden listing
13
+ *
14
+ * Read operations use the public Magic Eden API (unauthenticated).
15
+ * Write operations use the ME PSBT-based listing flow which requires wallet unlock.
16
+ *
17
+ * Magic Eden API docs: https://api-mainnet.magiceden.dev/swagger
18
+ */
19
+ import { z } from "zod";
20
+ import { NETWORK } from "../config/networks.js";
21
+ import { getWalletManager } from "../services/wallet-manager.js";
22
+ import { createJsonResponse, createErrorResponse } from "../utils/index.js";
23
+ // ---------------------------------------------------------------------------
24
+ // Config
25
+ // ---------------------------------------------------------------------------
26
+ const ME_BASE = "https://api-mainnet.magiceden.dev/v2/ord/btc";
27
+ const ME_API_KEY = process.env.MAGIC_EDEN_API_KEY ?? "";
28
+ // ---------------------------------------------------------------------------
29
+ // HTTP helpers
30
+ // ---------------------------------------------------------------------------
31
+ async function meGet(path) {
32
+ const url = `${ME_BASE}${path}`;
33
+ const res = await fetch(url, {
34
+ headers: {
35
+ Accept: "application/json",
36
+ "User-Agent": "aibtc-mcp-server/1.0",
37
+ ...(ME_API_KEY ? { Authorization: `Bearer ${ME_API_KEY}` } : {}),
38
+ },
39
+ });
40
+ if (!res.ok) {
41
+ const body = await res.text();
42
+ throw new Error(`Magic Eden API ${res.status}: ${body}`);
43
+ }
44
+ return res.json();
45
+ }
46
+ async function mePost(path, body) {
47
+ const url = `${ME_BASE}${path}`;
48
+ const res = await fetch(url, {
49
+ method: "POST",
50
+ headers: {
51
+ "Content-Type": "application/json",
52
+ Accept: "application/json",
53
+ "User-Agent": "aibtc-mcp-server/1.0",
54
+ ...(ME_API_KEY ? { Authorization: `Bearer ${ME_API_KEY}` } : {}),
55
+ },
56
+ body: JSON.stringify(body),
57
+ });
58
+ if (!res.ok) {
59
+ const text = await res.text();
60
+ let message;
61
+ try {
62
+ const parsed = JSON.parse(text);
63
+ message = String(parsed.message ?? text);
64
+ }
65
+ catch {
66
+ message = text;
67
+ }
68
+ throw new Error(`Magic Eden API ${res.status}: ${message}`);
69
+ }
70
+ return res.json();
71
+ }
72
+ // ---------------------------------------------------------------------------
73
+ // Tool registration
74
+ // ---------------------------------------------------------------------------
75
+ export function registerOrdinalsMarketplaceTools(server) {
76
+ // ==========================================================================
77
+ // ordinals_get_listings — public read, no wallet required
78
+ // ==========================================================================
79
+ server.registerTool("ordinals_get_listings", {
80
+ description: `Browse ordinals/inscriptions listed for sale on Magic Eden.
81
+
82
+ Returns active sale listings with price, seller, and inscription details.
83
+ Supports filtering by collection symbol and price range. No wallet required.
84
+
85
+ Note: Without a MAGIC_EDEN_API_KEY environment variable set, requests use the
86
+ shared unauthenticated rate limit of 30 QPM across all users. Set MAGIC_EDEN_API_KEY
87
+ to use an authenticated rate limit.
88
+
89
+ Examples:
90
+ - Browse all listings: ordinals_get_listings {}
91
+ - Filter by collection: ordinals_get_listings { collection: "nodemonkes" }
92
+ - Price range: ordinals_get_listings { minPriceSats: 100000, maxPriceSats: 1000000 }`,
93
+ inputSchema: {
94
+ collection: z
95
+ .string()
96
+ .optional()
97
+ .describe("Magic Eden collection symbol to filter by (e.g. 'nodemonkes', 'bitcoin-puppets')"),
98
+ minPriceSats: z
99
+ .number()
100
+ .int()
101
+ .nonnegative()
102
+ .optional()
103
+ .describe("Minimum listing price in satoshis"),
104
+ maxPriceSats: z
105
+ .number()
106
+ .int()
107
+ .positive()
108
+ .optional()
109
+ .describe("Maximum listing price in satoshis"),
110
+ limit: z
111
+ .number()
112
+ .int()
113
+ .min(1)
114
+ .max(100)
115
+ .optional()
116
+ .default(20)
117
+ .describe("Number of results to return (default 20, max 100)"),
118
+ offset: z
119
+ .number()
120
+ .int()
121
+ .nonnegative()
122
+ .optional()
123
+ .default(0)
124
+ .describe("Pagination offset (default 0)"),
125
+ sortBy: z
126
+ .enum(["priceAsc", "priceDesc", "recentlyListed"])
127
+ .optional()
128
+ .default("recentlyListed")
129
+ .describe("Sort order: priceAsc, priceDesc, or recentlyListed (default)"),
130
+ },
131
+ }, async ({ collection, minPriceSats, maxPriceSats, limit, offset, sortBy }) => {
132
+ try {
133
+ if (NETWORK !== "mainnet") {
134
+ return createJsonResponse({
135
+ note: "Magic Eden ordinals marketplace is only available on mainnet.",
136
+ network: NETWORK,
137
+ listings: [],
138
+ });
139
+ }
140
+ const params = new URLSearchParams();
141
+ params.set("limit", String(limit ?? 20));
142
+ params.set("offset", String(offset ?? 0));
143
+ params.set("sortBy", sortBy ?? "recentlyListed");
144
+ if (collection)
145
+ params.set("collectionSymbol", collection);
146
+ if (minPriceSats !== undefined)
147
+ params.set("minPrice", String(minPriceSats));
148
+ if (maxPriceSats !== undefined)
149
+ params.set("maxPrice", String(maxPriceSats));
150
+ const data = await meGet(`/tokens?${params}`);
151
+ const tokens = data.tokens ?? data;
152
+ return createJsonResponse({
153
+ source: "magic_eden",
154
+ network: NETWORK,
155
+ filters: {
156
+ collection: collection ?? null,
157
+ minPriceSats: minPriceSats ?? null,
158
+ maxPriceSats: maxPriceSats ?? null,
159
+ sortBy: sortBy ?? "recentlyListed",
160
+ },
161
+ limit: limit ?? 20,
162
+ offset: offset ?? 0,
163
+ listings: tokens,
164
+ });
165
+ }
166
+ catch (error) {
167
+ return createErrorResponse(error);
168
+ }
169
+ });
170
+ // ==========================================================================
171
+ // ordinals_list_for_sale — requires wallet (ME PSBT listing)
172
+ // ==========================================================================
173
+ server.registerTool("ordinals_list_for_sale", {
174
+ description: `List a wallet inscription for sale on Magic Eden.
175
+
176
+ Requests a PSBT-based listing transaction from the Magic Eden API.
177
+ The seller signs the PSBT to authorize the sale without moving the inscription.
178
+ Requires an unlocked wallet with Bitcoin (Taproot) keys.
179
+
180
+ Steps:
181
+ 1. Call this tool with inscriptionId and priceSats
182
+ 2. Sign the returned PSBT using psbt_sign
183
+ 3. Submit the signed PSBT back to Magic Eden to complete the listing
184
+
185
+ Note: The inscription must be in the wallet's Taproot (P2TR) address.`,
186
+ inputSchema: {
187
+ inscriptionId: z
188
+ .string()
189
+ .describe("Inscription ID in txid+index format, e.g. abc123...i0"),
190
+ priceSats: z
191
+ .number()
192
+ .int()
193
+ .positive()
194
+ .describe("Listing price in satoshis"),
195
+ receiverAddress: z
196
+ .string()
197
+ .optional()
198
+ .describe("BTC address to receive payment (defaults to wallet's Taproot address)"),
199
+ },
200
+ }, async ({ inscriptionId, priceSats, receiverAddress }) => {
201
+ try {
202
+ if (NETWORK !== "mainnet") {
203
+ return createErrorResponse(new Error("Magic Eden ordinals marketplace listing is only available on mainnet."));
204
+ }
205
+ const walletManager = getWalletManager();
206
+ const account = walletManager.getActiveAccount();
207
+ if (!account) {
208
+ throw new Error("Wallet is not unlocked. Use wallet_unlock first.");
209
+ }
210
+ if (!account.taprootAddress) {
211
+ throw new Error("Taproot address not available. Unlock your wallet first.");
212
+ }
213
+ const sellerAddress = receiverAddress ?? account.taprootAddress;
214
+ // Request a listing PSBT from Magic Eden
215
+ const listingRequest = await mePost("/instructions/sell", {
216
+ inscriptionId,
217
+ price: priceSats,
218
+ sellerReceiveAddress: sellerAddress,
219
+ sellerOrdAddress: account.taprootAddress,
220
+ });
221
+ const result = listingRequest;
222
+ return createJsonResponse({
223
+ status: "psbt_ready",
224
+ message: "Magic Eden listing PSBT generated. Sign the PSBT using psbt_sign, then call " +
225
+ "ordinals_list_for_sale_submit with the signed PSBT to finalize your listing.",
226
+ inscriptionId,
227
+ priceSats,
228
+ sellerAddress,
229
+ psbtBase64: result.psbtBase64 ?? result.psbt ?? null,
230
+ raw: result,
231
+ nextStep: "Use psbt_sign to sign the psbtBase64, then submit the signed PSBT to finalize listing.",
232
+ });
233
+ }
234
+ catch (error) {
235
+ return createErrorResponse(error);
236
+ }
237
+ });
238
+ // ==========================================================================
239
+ // ordinals_list_for_sale_submit — requires signed PSBT from ordinals_list_for_sale
240
+ // ==========================================================================
241
+ server.registerTool("ordinals_list_for_sale_submit", {
242
+ description: `Submit a signed listing PSBT to Magic Eden to finalize an ordinal listing.
243
+
244
+ Call this after signing the PSBT returned by ordinals_list_for_sale.
245
+ The signed PSBT is POST'd to Magic Eden to register the listing on the marketplace.
246
+
247
+ Steps:
248
+ 1. Call ordinals_list_for_sale to get a listing PSBT
249
+ 2. Sign the PSBT using psbt_sign
250
+ 3. Call this tool with the signed PSBT to publish the listing`,
251
+ inputSchema: {
252
+ inscriptionId: z
253
+ .string()
254
+ .describe("The inscription ID being listed"),
255
+ signedPsbt: z
256
+ .string()
257
+ .describe("The signed PSBT in base64 format returned by psbt_sign"),
258
+ },
259
+ }, async ({ inscriptionId, signedPsbt }) => {
260
+ try {
261
+ if (NETWORK !== "mainnet") {
262
+ return createErrorResponse(new Error("Magic Eden ordinals marketplace listing is only available on mainnet."));
263
+ }
264
+ const result = await mePost("/instructions/sell/submit", {
265
+ signedPsbt,
266
+ inscriptionId,
267
+ });
268
+ return createJsonResponse({ status: "listed", result });
269
+ }
270
+ catch (err) {
271
+ return createErrorResponse(`Failed to submit listing: ${err instanceof Error ? err.message : String(err)}`);
272
+ }
273
+ });
274
+ // ==========================================================================
275
+ // ordinals_buy — requires wallet (ME PSBT buy flow)
276
+ // ==========================================================================
277
+ server.registerTool("ordinals_buy", {
278
+ description: `Buy a listed inscription from Magic Eden.
279
+
280
+ Requests a buyer PSBT from the Magic Eden API, funded by the active wallet.
281
+ Returns a PSBT that combines the seller's listing inputs with the buyer's payment
282
+ inputs. The buyer signs the PSBT then broadcasts it to complete the purchase.
283
+
284
+ Requires an unlocked wallet with Bitcoin keys and sufficient BTC balance.
285
+
286
+ Steps:
287
+ 1. Call ordinals_get_listings to find an inscription and its price
288
+ 2. Call ordinals_buy with the inscriptionId and desired buyer address
289
+ 3. Sign the returned PSBT using psbt_sign
290
+ 4. Broadcast using psbt_broadcast`,
291
+ inputSchema: {
292
+ inscriptionId: z
293
+ .string()
294
+ .describe("Inscription ID to purchase, e.g. abc123...i0"),
295
+ buyerAddress: z
296
+ .string()
297
+ .optional()
298
+ .describe("BTC address to receive the inscription (defaults to wallet's Taproot address)"),
299
+ buyerPaymentAddress: z
300
+ .string()
301
+ .optional()
302
+ .describe("BTC address to fund the purchase (defaults to wallet's SegWit address)"),
303
+ feeRate: z
304
+ .number()
305
+ .positive()
306
+ .optional()
307
+ .describe("Fee rate in sat/vB (optional, uses network default if omitted)"),
308
+ },
309
+ }, async ({ inscriptionId, buyerAddress, buyerPaymentAddress, feeRate }) => {
310
+ try {
311
+ if (NETWORK !== "mainnet") {
312
+ return createErrorResponse(new Error("Magic Eden ordinals marketplace is only available on mainnet."));
313
+ }
314
+ const walletManager = getWalletManager();
315
+ const account = walletManager.getActiveAccount();
316
+ if (!account) {
317
+ throw new Error("Wallet is not unlocked. Use wallet_unlock first.");
318
+ }
319
+ if (!account.taprootAddress) {
320
+ throw new Error("Taproot address not available. Unlock your wallet first.");
321
+ }
322
+ if (!account.btcAddress) {
323
+ throw new Error("Bitcoin SegWit address not available. Unlock your wallet first.");
324
+ }
325
+ const receiveAddress = buyerAddress ?? account.taprootAddress;
326
+ const paymentAddress = buyerPaymentAddress ?? account.btcAddress;
327
+ // Fetch token info (including active listing) from ME
328
+ const tokenInfo = await meGet(`/tokens/${inscriptionId}`);
329
+ if (!tokenInfo.listed && !(tokenInfo.listedPrice ?? tokenInfo.price)) {
330
+ return createJsonResponse({
331
+ status: "not_listed",
332
+ message: `Inscription ${inscriptionId} does not appear to be listed for sale on Magic Eden.`,
333
+ inscriptionId,
334
+ tokenInfo,
335
+ });
336
+ }
337
+ const priceSats = Number(tokenInfo.listedPrice ?? tokenInfo.price);
338
+ // Request a buy PSBT from Magic Eden
339
+ const buyRequest = await mePost("/instructions/buy", {
340
+ price: priceSats,
341
+ tokenId: inscriptionId,
342
+ buyerAddress: receiveAddress,
343
+ buyerTokenReceiveAddress: receiveAddress,
344
+ feeRateTier: feeRate ? undefined : "halfHourFee",
345
+ feeRate: feeRate,
346
+ buyerPaymentAddress: paymentAddress,
347
+ buyerPaymentPublicKey: account.btcPublicKey ? Buffer.from(account.btcPublicKey).toString("hex") : undefined,
348
+ });
349
+ const result = buyRequest;
350
+ return createJsonResponse({
351
+ status: "psbt_ready",
352
+ message: "Magic Eden buy PSBT generated. Sign the PSBT using psbt_sign, then broadcast " +
353
+ "using psbt_broadcast to complete the purchase.",
354
+ inscriptionId,
355
+ priceSats,
356
+ buyerReceiveAddress: receiveAddress,
357
+ buyerPaymentAddress: paymentAddress,
358
+ psbtBase64: result.psbtBase64 ?? result.psbt ?? null,
359
+ raw: result,
360
+ nextStep: "Use psbt_sign to sign the psbtBase64, then use psbt_broadcast to send the transaction.",
361
+ });
362
+ }
363
+ catch (error) {
364
+ return createErrorResponse(error);
365
+ }
366
+ });
367
+ // ==========================================================================
368
+ // ordinals_cancel_listing — requires wallet (ME PSBT cancel flow)
369
+ // ==========================================================================
370
+ server.registerTool("ordinals_cancel_listing", {
371
+ description: `Cancel an active Magic Eden listing for an inscription.
372
+
373
+ Requests a cancellation PSBT from Magic Eden. The seller signs the PSBT to
374
+ invalidate the active listing and reclaim the inscription UTXO. No BTC fee
375
+ is required beyond the miner fee for the cancellation transaction itself.
376
+
377
+ Requires an unlocked wallet with Bitcoin (Taproot) keys.
378
+
379
+ Steps:
380
+ 1. Call this tool with the inscriptionId you want to delist
381
+ 2. Sign the returned PSBT using psbt_sign
382
+ 3. Broadcast using psbt_broadcast to finalize the cancellation`,
383
+ inputSchema: {
384
+ inscriptionId: z
385
+ .string()
386
+ .describe("Inscription ID of the active listing to cancel, e.g. abc123...i0"),
387
+ sellerAddress: z
388
+ .string()
389
+ .optional()
390
+ .describe("BTC Taproot address that owns the listing (defaults to wallet's Taproot address)"),
391
+ },
392
+ }, async ({ inscriptionId, sellerAddress }) => {
393
+ try {
394
+ if (NETWORK !== "mainnet") {
395
+ return createErrorResponse(new Error("Magic Eden ordinals marketplace is only available on mainnet."));
396
+ }
397
+ const walletManager = getWalletManager();
398
+ const account = walletManager.getActiveAccount();
399
+ if (!account) {
400
+ throw new Error("Wallet is not unlocked. Use wallet_unlock first.");
401
+ }
402
+ if (!account.taprootAddress) {
403
+ throw new Error("Taproot address not available. Unlock your wallet first.");
404
+ }
405
+ const ownerAddress = sellerAddress ?? account.taprootAddress;
406
+ // Request a cancel listing PSBT from Magic Eden
407
+ const cancelRequest = await mePost("/instructions/cancel", {
408
+ inscriptionId,
409
+ sellerOrdAddress: ownerAddress,
410
+ });
411
+ const result = cancelRequest;
412
+ return createJsonResponse({
413
+ status: "psbt_ready",
414
+ message: "Magic Eden cancellation PSBT generated. Sign the PSBT using psbt_sign, then " +
415
+ "broadcast using psbt_broadcast to finalize the cancellation.",
416
+ inscriptionId,
417
+ sellerAddress: ownerAddress,
418
+ psbtBase64: result.psbtBase64 ?? result.psbt ?? null,
419
+ raw: result,
420
+ nextStep: "Use psbt_sign to sign the psbtBase64, then use psbt_broadcast to send the cancellation transaction.",
421
+ });
422
+ }
423
+ catch (error) {
424
+ return createErrorResponse(error);
425
+ }
426
+ });
427
+ }
428
+ //# sourceMappingURL=ordinals-marketplace.tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordinals-marketplace.tools.js","sourceRoot":"","sources":["../../src/tools/ordinals-marketplace.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,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9E,8DAA8D;gBAChE,aAAa;gBACb,aAAa,EAAE,YAAY;gBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,IAAI,IAAI;gBACpD,GAAG,EAAE,MAAM;gBACX,QAAQ,EACN,qGAAqG;aACxG,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Reputation Tools (ERC-8004)
3
+ *
4
+ * Dedicated MCP tools for on-chain agent reputation management via the
5
+ * ERC-8004 reputation registry. Covers the full feedback lifecycle:
6
+ *
7
+ * Read Tools (no wallet required):
8
+ * - reputation_get_summary - Aggregated reputation score for an agent
9
+ * - reputation_read_feedback - Specific feedback entry by agent + index
10
+ * - reputation_read_all_feedback - Paginated all-feedback with tag filtering
11
+ * - reputation_get_clients - Paginated list of clients who gave feedback
12
+ * - reputation_get_feedback_count - Total feedback count for an agent
13
+ * - reputation_get_approved_limit - Approved index limit for a client
14
+ * - reputation_get_last_index - Last feedback index for a client
15
+ *
16
+ * Write Tools (wallet required):
17
+ * - reputation_give_feedback - Submit feedback for an agent
18
+ * - reputation_revoke_feedback - Revoke own feedback by index
19
+ * - reputation_append_response - Append a response to received feedback
20
+ * - reputation_approve_client - Approve a client with index limit
21
+ */
22
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
23
+ export declare function registerReputationTools(server: McpServer): void;
24
+ //# sourceMappingURL=reputation.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reputation.tools.d.ts","sourceRoot":"","sources":["../../src/tools/reputation.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4gB/D"}