@aibtc/mcp-server 1.40.0 → 1.41.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 (51) hide show
  1. package/dist/services/credentials.d.ts +31 -0
  2. package/dist/services/credentials.d.ts.map +1 -0
  3. package/dist/services/credentials.js +162 -0
  4. package/dist/services/credentials.js.map +1 -0
  5. package/dist/services/erc8004.service.d.ts +28 -0
  6. package/dist/services/erc8004.service.d.ts.map +1 -1
  7. package/dist/services/erc8004.service.js +115 -0
  8. package/dist/services/erc8004.service.js.map +1 -1
  9. package/dist/services/unisat-indexer.d.ts +97 -0
  10. package/dist/services/unisat-indexer.d.ts.map +1 -0
  11. package/dist/services/unisat-indexer.js +178 -0
  12. package/dist/services/unisat-indexer.js.map +1 -0
  13. package/dist/tools/bounty-scanner.tools.d.ts +29 -0
  14. package/dist/tools/bounty-scanner.tools.d.ts.map +1 -0
  15. package/dist/tools/bounty-scanner.tools.js +405 -0
  16. package/dist/tools/bounty-scanner.tools.js.map +1 -0
  17. package/dist/tools/credentials.tools.d.ts +9 -0
  18. package/dist/tools/credentials.tools.d.ts.map +1 -0
  19. package/dist/tools/credentials.tools.js +151 -0
  20. package/dist/tools/credentials.tools.js.map +1 -0
  21. package/dist/tools/identity.tools.d.ts +22 -0
  22. package/dist/tools/identity.tools.d.ts.map +1 -0
  23. package/dist/tools/identity.tools.js +404 -0
  24. package/dist/tools/identity.tools.js.map +1 -0
  25. package/dist/tools/index.d.ts.map +1 -1
  26. package/dist/tools/index.js +15 -0
  27. package/dist/tools/index.js.map +1 -1
  28. package/dist/tools/runes.tools.d.ts +25 -0
  29. package/dist/tools/runes.tools.d.ts.map +1 -0
  30. package/dist/tools/runes.tools.js +464 -0
  31. package/dist/tools/runes.tools.js.map +1 -0
  32. package/dist/tools/skill-mappings.d.ts.map +1 -1
  33. package/dist/tools/skill-mappings.js +40 -0
  34. package/dist/tools/skill-mappings.js.map +1 -1
  35. package/dist/tools/souldinals.tools.d.ts +18 -0
  36. package/dist/tools/souldinals.tools.d.ts.map +1 -0
  37. package/dist/tools/souldinals.tools.js +551 -0
  38. package/dist/tools/souldinals.tools.js.map +1 -0
  39. package/dist/tools/stacking-lottery.tools.d.ts.map +1 -1
  40. package/dist/tools/stacking-lottery.tools.js +7 -4
  41. package/dist/tools/stacking-lottery.tools.js.map +1 -1
  42. package/dist/transactions/rune-transfer-builder.d.ts +46 -0
  43. package/dist/transactions/rune-transfer-builder.d.ts.map +1 -0
  44. package/dist/transactions/rune-transfer-builder.js +130 -0
  45. package/dist/transactions/rune-transfer-builder.js.map +1 -0
  46. package/dist/transactions/runestone-builder.d.ts +40 -0
  47. package/dist/transactions/runestone-builder.d.ts.map +1 -0
  48. package/dist/transactions/runestone-builder.js +76 -0
  49. package/dist/transactions/runestone-builder.js.map +1 -0
  50. package/package.json +1 -1
  51. package/skill/SKILL.md +1 -1
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Unisat Indexer Service
3
+ *
4
+ * Provides rune and inscription indexing via Unisat Open API:
5
+ * - Mainnet: https://open-api.unisat.io
6
+ * - Testnet: https://open-api-testnet.unisat.io
7
+ *
8
+ * Auth: Authorization: Bearer ${UNISAT_API_KEY}
9
+ */
10
+ import { MempoolApi } from "./mempool-api.js";
11
+ export class UnisatApiError extends Error {
12
+ statusCode;
13
+ constructor(message, statusCode) {
14
+ super(message);
15
+ this.statusCode = statusCode;
16
+ this.name = "UnisatApiError";
17
+ }
18
+ }
19
+ // ---------------------------------------------------------------------------
20
+ // UnisatIndexer
21
+ // ---------------------------------------------------------------------------
22
+ export class UnisatIndexer {
23
+ network;
24
+ mempoolApi;
25
+ apiBase;
26
+ constructor(network) {
27
+ this.network = network;
28
+ this.mempoolApi = new MempoolApi(network);
29
+ this.apiBase =
30
+ network === "mainnet"
31
+ ? "https://open-api.unisat.io"
32
+ : "https://open-api-testnet.unisat.io";
33
+ }
34
+ headers() {
35
+ const headers = {
36
+ "Content-Type": "application/json",
37
+ };
38
+ if (process.env.UNISAT_API_KEY) {
39
+ headers["Authorization"] = `Bearer ${process.env.UNISAT_API_KEY}`;
40
+ }
41
+ return headers;
42
+ }
43
+ // -------------------------------------------------------------------------
44
+ // Runes
45
+ // -------------------------------------------------------------------------
46
+ /**
47
+ * Get rune balances for a Bitcoin address.
48
+ */
49
+ async getRuneBalances(address) {
50
+ const all = [];
51
+ let start = 0;
52
+ const limit = 100;
53
+ while (true) {
54
+ const url = `${this.apiBase}/v1/indexer/address/${address}/runes/balance-list?start=${start}&limit=${limit}`;
55
+ const response = await fetch(url, { headers: this.headers() });
56
+ if (!response.ok) {
57
+ const errorText = await response.text().catch(() => "Unknown error");
58
+ throw new UnisatApiError(`Unisat API error: ${response.status} ${response.statusText} - ${errorText}`, response.status);
59
+ }
60
+ const json = (await response.json());
61
+ if (json.code !== 0) {
62
+ throw new UnisatApiError(`Unisat API error: ${json.msg}`, json.code);
63
+ }
64
+ all.push(...json.data.detail);
65
+ if (all.length >= json.data.total) {
66
+ break;
67
+ }
68
+ start += limit;
69
+ }
70
+ return all;
71
+ }
72
+ /**
73
+ * Get rune-bearing UTXOs for a specific rune on a Bitcoin address.
74
+ */
75
+ async getRuneUtxos(address, runeid) {
76
+ const all = [];
77
+ let start = 0;
78
+ const limit = 100;
79
+ while (true) {
80
+ const url = `${this.apiBase}/v1/indexer/address/${address}/runes/${runeid}/utxo?start=${start}&limit=${limit}`;
81
+ const response = await fetch(url, { headers: this.headers() });
82
+ if (!response.ok) {
83
+ const errorText = await response.text().catch(() => "Unknown error");
84
+ throw new UnisatApiError(`Unisat API error: ${response.status} ${response.statusText} - ${errorText}`, response.status);
85
+ }
86
+ const json = (await response.json());
87
+ if (json.code !== 0) {
88
+ throw new UnisatApiError(`Unisat API error: ${json.msg}`, json.code);
89
+ }
90
+ all.push(...json.data.utxo);
91
+ if (all.length >= json.data.total) {
92
+ break;
93
+ }
94
+ start += limit;
95
+ }
96
+ return all;
97
+ }
98
+ /**
99
+ * Get all rune-bearing UTXOs for all runes on a Bitcoin address.
100
+ */
101
+ async getAllRuneUtxos(address) {
102
+ const balances = await this.getRuneBalances(address);
103
+ const allUtxos = [];
104
+ for (const balance of balances) {
105
+ const utxos = await this.getRuneUtxos(address, balance.runeid);
106
+ allUtxos.push(...utxos);
107
+ }
108
+ return allUtxos;
109
+ }
110
+ // -------------------------------------------------------------------------
111
+ // Inscriptions
112
+ // -------------------------------------------------------------------------
113
+ /**
114
+ * Get all inscriptions for a Bitcoin address via Unisat API.
115
+ */
116
+ async getInscriptionsForAddress(address) {
117
+ const all = [];
118
+ let cursor = 0;
119
+ const size = 100;
120
+ while (true) {
121
+ const url = `${this.apiBase}/v1/indexer/address/${address}/inscription-data?cursor=${cursor}&size=${size}`;
122
+ const response = await fetch(url, { headers: this.headers() });
123
+ if (!response.ok) {
124
+ const errorText = await response.text().catch(() => "Unknown error");
125
+ throw new UnisatApiError(`Unisat API error: ${response.status} ${response.statusText} - ${errorText}`, response.status);
126
+ }
127
+ const json = (await response.json());
128
+ if (json.code !== 0) {
129
+ throw new UnisatApiError(`Unisat API error: ${json.msg}`, json.code);
130
+ }
131
+ all.push(...json.data.inscription);
132
+ if (all.length >= json.data.total) {
133
+ break;
134
+ }
135
+ cursor += size;
136
+ }
137
+ return all;
138
+ }
139
+ // -------------------------------------------------------------------------
140
+ // UTXO Classification
141
+ // -------------------------------------------------------------------------
142
+ /**
143
+ * Classify UTXOs into cardinal, inscription, and rune categories.
144
+ */
145
+ async classifyUtxos(address) {
146
+ const [utxos, inscriptions, runeUtxos] = await Promise.all([
147
+ this.mempoolApi.getUtxos(address),
148
+ this.getInscriptionsForAddress(address),
149
+ this.getAllRuneUtxos(address),
150
+ ]);
151
+ const inscriptionOutputs = new Set(inscriptions.map((ins) => ins.output));
152
+ const runeOutputs = new Set(runeUtxos.map((u) => `${u.txid}:${u.vout}`));
153
+ const cardinal = [];
154
+ const inscription = [];
155
+ const rune = [];
156
+ for (const utxo of utxos) {
157
+ const outputRef = `${utxo.txid}:${utxo.vout}`;
158
+ if (inscriptionOutputs.has(outputRef)) {
159
+ inscription.push(utxo);
160
+ }
161
+ else if (runeOutputs.has(outputRef)) {
162
+ rune.push(utxo);
163
+ }
164
+ else {
165
+ cardinal.push(utxo);
166
+ }
167
+ }
168
+ return { cardinal, inscription, rune };
169
+ }
170
+ /**
171
+ * Get cardinal UTXOs (safe to spend — no inscriptions or runes).
172
+ */
173
+ async getCardinalUtxos(address) {
174
+ const classified = await this.classifyUtxos(address);
175
+ return classified.cardinal;
176
+ }
177
+ }
178
+ //# sourceMappingURL=unisat-indexer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unisat-indexer.js","sourceRoot":"","sources":["../../src/services/unisat-indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA6F9C,MAAM,OAAO,cAAe,SAAQ,KAAK;IAGrB;IAFlB,YACE,OAAe,EACC,UAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,eAAU,GAAV,UAAU,CAAQ;QAGlC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E,MAAM,OAAO,aAAa;IACP,OAAO,CAAU;IACjB,UAAU,CAAa;IACvB,OAAO,CAAS;IAEjC,YAAY,OAAgB;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO;YACV,OAAO,KAAK,SAAS;gBACnB,CAAC,CAAC,4BAA4B;gBAC9B,CAAC,CAAC,oCAAoC,CAAC;IAC7C,CAAC;IAEO,OAAO;QACb,MAAM,OAAO,GAA2B;YACtC,cAAc,EAAE,kBAAkB;SACnC,CAAC;QACF,IAAI,OAAO,CAAC,GAAG,CA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AC,IAAI,EAAE,CAAC,CAC5C,CAAC;QAEF,MAAM,QAAQ,GAAW,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAW,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAW,EAAE,CAAC;QAExB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,SAAS,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9C,IAAI,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;iBAAM,IAAI,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAe;QACpC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,UAAU,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Bounty Scanner Tools
3
+ *
4
+ * Tools for interacting with the bounty.drx4.xyz sBTC bounty board.
5
+ * Agents can list open bounties, view details, score against their capabilities,
6
+ * claim tasks, check status, and review their submission history.
7
+ *
8
+ * Read-only tools (no auth required):
9
+ * - bounty_list — List bounties with optional filters
10
+ * - bounty_get — Full detail for a single bounty by ID
11
+ * - bounty_match — Score open bounties against agent capability tags
12
+ * - bounty_status — Check claim/submission status for a bounty
13
+ * - bounty_my_claims — List all claims/submissions for current wallet
14
+ * - bounty_stats — Platform aggregate stats
15
+ *
16
+ * Authenticated tool (requires unlocked wallet with bc1q address):
17
+ * - bounty_claim — Claim a bounty (BIP-322 signed)
18
+ *
19
+ * Authentication: BIP-322 simple signature (P2WPKH, bc1q addresses preferred).
20
+ * Message format: "agent-bounties | {action} | {btc_address} | {resource} | {timestamp}"
21
+ * Headers: X-BTC-Address, X-Signature, X-Timestamp
22
+ *
23
+ * Status flow: open → claimed → submitted → approved → paid (or cancelled)
24
+ *
25
+ * Reference: https://bounty.drx4.xyz/api
26
+ */
27
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
28
+ export declare function registerBountyScannerTools(server: McpServer): void;
29
+ //# sourceMappingURL=bounty-scanner.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounty-scanner.tools.d.ts","sourceRoot":"","sources":["../../src/tools/bounty-scanner.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkEpE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmYlE"}
@@ -0,0 +1,405 @@
1
+ /**
2
+ * Bounty Scanner Tools
3
+ *
4
+ * Tools for interacting with the bounty.drx4.xyz sBTC bounty board.
5
+ * Agents can list open bounties, view details, score against their capabilities,
6
+ * claim tasks, check status, and review their submission history.
7
+ *
8
+ * Read-only tools (no auth required):
9
+ * - bounty_list — List bounties with optional filters
10
+ * - bounty_get — Full detail for a single bounty by ID
11
+ * - bounty_match — Score open bounties against agent capability tags
12
+ * - bounty_status — Check claim/submission status for a bounty
13
+ * - bounty_my_claims — List all claims/submissions for current wallet
14
+ * - bounty_stats — Platform aggregate stats
15
+ *
16
+ * Authenticated tool (requires unlocked wallet with bc1q address):
17
+ * - bounty_claim — Claim a bounty (BIP-322 signed)
18
+ *
19
+ * Authentication: BIP-322 simple signature (P2WPKH, bc1q addresses preferred).
20
+ * Message format: "agent-bounties | {action} | {btc_address} | {resource} | {timestamp}"
21
+ * Headers: X-BTC-Address, X-Signature, X-Timestamp
22
+ *
23
+ * Status flow: open → claimed → submitted → approved → paid (or cancelled)
24
+ *
25
+ * Reference: https://bounty.drx4.xyz/api
26
+ */
27
+ import { z } from "zod";
28
+ import { p2wpkh, NETWORK as BTC_MAINNET, TEST_NETWORK as BTC_TESTNET, } from "@scure/btc-signer";
29
+ import { NETWORK } from "../config/networks.js";
30
+ import { getAccount } from "../services/x402.service.js";
31
+ import { createJsonResponse, createErrorResponse } from "../utils/index.js";
32
+ import { bip322Sign } from "../utils/bip322.js";
33
+ const BOUNTY_BASE = "https://bounty.drx4.xyz/api";
34
+ /**
35
+ * Build BIP-322 auth headers for bounty.drx4.xyz write operations.
36
+ * Message format: "agent-bounties | {action} | {btc_address} | {resource} | {timestamp}"
37
+ *
38
+ * @param action - Action string (e.g. "claim-bounty")
39
+ * @param resource - Resource path (e.g. "bounties/{uuid}")
40
+ * @param account - Pre-fetched account with BTC keys
41
+ */
42
+ function buildBountyAuthHeaders(action, resource, account) {
43
+ const timestamp = new Date().toISOString();
44
+ const message = `agent-bounties | ${action} | ${account.btcAddress} | ${resource} | ${timestamp}`;
45
+ const btcNetwork = NETWORK === "testnet" ? BTC_TESTNET : BTC_MAINNET;
46
+ const scriptPubKey = p2wpkh(account.btcPublicKey, btcNetwork).script;
47
+ const signature = bip322Sign(message, account.btcPrivateKey, scriptPubKey);
48
+ const headers = {
49
+ "X-BTC-Address": account.btcAddress,
50
+ "X-Signature": signature,
51
+ "X-Timestamp": timestamp,
52
+ "Content-Type": "application/json",
53
+ };
54
+ if (account.address) {
55
+ headers["X-STX-Address"] = account.address;
56
+ }
57
+ return headers;
58
+ }
59
+ // ============================================================================
60
+ // Tool Registration
61
+ // ============================================================================
62
+ export function registerBountyScannerTools(server) {
63
+ // --------------------------------------------------------------------------
64
+ // bounty_list — List bounties with optional filters
65
+ // --------------------------------------------------------------------------
66
+ server.registerTool("bounty_list", {
67
+ description: `List bounties on the bounty.drx4.xyz sBTC bounty board.
68
+
69
+ Returns bounties matching the given filters in reverse chronological order.
70
+
71
+ Filters:
72
+ - status: "open", "claimed", "submitted", "approved", "paid", "cancelled" (default: all)
73
+ - tags: comma-separated tag filter (e.g. "stacks,defi")
74
+ - creator: filter by creator BTC address
75
+ - min_amount: minimum reward in satoshis
76
+ - max_amount: maximum reward in satoshis
77
+ - limit: max results (default 20)
78
+ - offset: pagination offset
79
+
80
+ No authentication required.`,
81
+ inputSchema: {
82
+ status: z
83
+ .enum(["open", "claimed", "submitted", "approved", "paid", "cancelled"])
84
+ .optional()
85
+ .describe("Filter by bounty status"),
86
+ tags: z
87
+ .string()
88
+ .optional()
89
+ .describe("Comma-separated tag filter (e.g. 'stacks,defi')"),
90
+ creator: z
91
+ .string()
92
+ .optional()
93
+ .describe("Filter by creator BTC address"),
94
+ min_amount: z
95
+ .number()
96
+ .optional()
97
+ .describe("Minimum reward in satoshis"),
98
+ max_amount: z
99
+ .number()
100
+ .optional()
101
+ .describe("Maximum reward in satoshis"),
102
+ limit: z
103
+ .number()
104
+ .min(1)
105
+ .max(100)
106
+ .optional()
107
+ .describe("Max results (default 20, max 100)"),
108
+ offset: z
109
+ .number()
110
+ .min(0)
111
+ .optional()
112
+ .describe("Pagination offset (default 0)"),
113
+ },
114
+ }, async ({ status, tags, creator, min_amount, max_amount, limit, offset }) => {
115
+ try {
116
+ const params = new URLSearchParams();
117
+ if (status)
118
+ params.set("status", status);
119
+ if (tags)
120
+ params.set("tags", tags);
121
+ if (creator)
122
+ params.set("creator", creator);
123
+ if (min_amount !== undefined)
124
+ params.set("min_amount", String(min_amount));
125
+ if (max_amount !== undefined)
126
+ params.set("max_amount", String(max_amount));
127
+ if (limit !== undefined)
128
+ params.set("limit", String(limit));
129
+ if (offset !== undefined)
130
+ params.set("offset", String(offset));
131
+ const query = params.toString();
132
+ const url = `${BOUNTY_BASE}/bounties${query ? `?${query}` : ""}`;
133
+ const res = await fetch(url);
134
+ if (!res.ok) {
135
+ const text = await res.text();
136
+ throw new Error(`Failed to list bounties (${res.status}): ${text}`);
137
+ }
138
+ const data = await res.json();
139
+ return createJsonResponse(data);
140
+ }
141
+ catch (error) {
142
+ return createErrorResponse(error);
143
+ }
144
+ });
145
+ // --------------------------------------------------------------------------
146
+ // bounty_get — Full detail for a single bounty by ID
147
+ // --------------------------------------------------------------------------
148
+ server.registerTool("bounty_get", {
149
+ description: `Get full details for a single bounty on bounty.drx4.xyz.
150
+
151
+ Returns the bounty description, reward amount, tags, status, all claims,
152
+ submissions, payments, and available actions for the current agent.
153
+
154
+ No authentication required.`,
155
+ inputSchema: {
156
+ id: z
157
+ .string()
158
+ .describe("Bounty UUID or identifier"),
159
+ },
160
+ }, async ({ id }) => {
161
+ try {
162
+ const res = await fetch(`${BOUNTY_BASE}/bounties/${encodeURIComponent(id)}`);
163
+ if (!res.ok) {
164
+ const text = await res.text();
165
+ throw new Error(`Failed to fetch bounty ${id} (${res.status}): ${text}`);
166
+ }
167
+ const data = await res.json();
168
+ return createJsonResponse(data);
169
+ }
170
+ catch (error) {
171
+ return createErrorResponse(error);
172
+ }
173
+ });
174
+ // --------------------------------------------------------------------------
175
+ // bounty_match — Score open bounties against agent capability tags
176
+ // --------------------------------------------------------------------------
177
+ server.registerTool("bounty_match", {
178
+ description: `Score open bounties against an agent's capability profile.
179
+
180
+ Fetches all open bounties and ranks them by tag overlap with the provided
181
+ capability_tags. Returns bounties sorted by match score (highest first),
182
+ with a match_score field showing how many tags matched.
183
+
184
+ Use this to discover which open bounties are most relevant to your skills.
185
+ Provide tags that describe your capabilities (e.g. ["stacks", "clarity", "defi"]).
186
+
187
+ No authentication required.`,
188
+ inputSchema: {
189
+ capability_tags: z
190
+ .array(z.string())
191
+ .min(1)
192
+ .describe("Array of capability tags to match against (e.g. ['stacks', 'clarity', 'defi'])"),
193
+ limit: z
194
+ .number()
195
+ .min(1)
196
+ .max(50)
197
+ .optional()
198
+ .describe("Max results to return (default 10)"),
199
+ },
200
+ }, async ({ capability_tags, limit }) => {
201
+ try {
202
+ const res = await fetch(`${BOUNTY_BASE}/bounties?status=open&limit=100`);
203
+ if (!res.ok) {
204
+ const text = await res.text();
205
+ throw new Error(`Failed to fetch open bounties (${res.status}): ${text}`);
206
+ }
207
+ const data = await res.json();
208
+ const bounties = data.bounties ?? [];
209
+ const capabilitySet = new Set(capability_tags.map((t) => t.toLowerCase()));
210
+ const scored = bounties.map((bounty) => {
211
+ const bountyTags = Array.isArray(bounty.tags)
212
+ ? bounty.tags.map((t) => t.toLowerCase())
213
+ : [];
214
+ const matchScore = bountyTags.filter((tag) => capabilitySet.has(tag)).length;
215
+ return { ...bounty, match_score: matchScore };
216
+ });
217
+ scored.sort((a, b) => b.match_score - a.match_score);
218
+ const maxResults = limit ?? 10;
219
+ return createJsonResponse({
220
+ matches: scored.slice(0, maxResults),
221
+ total_open: bounties.length,
222
+ capability_tags,
223
+ });
224
+ }
225
+ catch (error) {
226
+ return createErrorResponse(error);
227
+ }
228
+ });
229
+ // --------------------------------------------------------------------------
230
+ // bounty_claim — Claim a bounty (requires bc1q wallet, BIP-322 auth)
231
+ // --------------------------------------------------------------------------
232
+ server.registerTool("bounty_claim", {
233
+ description: `Claim a bounty on bounty.drx4.xyz.
234
+
235
+ Submits a claim for an open bounty. Requires an unlocked wallet with BTC keys.
236
+ The request is authenticated via BIP-322 signing.
237
+
238
+ After claiming, use bounty_get to see the bounty detail and track next steps.
239
+ The status flow is: open → claimed → submitted → approved → paid.
240
+
241
+ Fields:
242
+ - id: bounty UUID to claim
243
+ - notes: optional notes about your approach or qualifications`,
244
+ inputSchema: {
245
+ id: z
246
+ .string()
247
+ .describe("Bounty UUID to claim"),
248
+ notes: z
249
+ .string()
250
+ .optional()
251
+ .describe("Optional notes about your approach or qualifications"),
252
+ },
253
+ }, async ({ id, notes }) => {
254
+ try {
255
+ const account = await getAccount();
256
+ if (!account.btcAddress || !account.btcPrivateKey || !account.btcPublicKey) {
257
+ throw new Error("Bitcoin keys not available. Unlock a wallet with BTC key derivation to claim bounties.");
258
+ }
259
+ const resource = `bounties/${id}`;
260
+ const authHeaders = buildBountyAuthHeaders("claim-bounty", resource, account);
261
+ const payload = {
262
+ btc_address: account.btcAddress,
263
+ };
264
+ if (account.address) {
265
+ payload.stx_address = account.address;
266
+ }
267
+ if (notes) {
268
+ payload.notes = notes;
269
+ }
270
+ const res = await fetch(`${BOUNTY_BASE}/bounties/${encodeURIComponent(id)}/claim`, {
271
+ method: "POST",
272
+ headers: authHeaders,
273
+ body: JSON.stringify(payload),
274
+ });
275
+ const responseText = await res.text();
276
+ let responseData;
277
+ try {
278
+ responseData = JSON.parse(responseText);
279
+ }
280
+ catch {
281
+ responseData = { raw: responseText };
282
+ }
283
+ if (!res.ok) {
284
+ throw new Error(`Failed to claim bounty ${id} (${res.status}): ${responseText}`);
285
+ }
286
+ return createJsonResponse({
287
+ success: true,
288
+ message: "Bounty claimed successfully",
289
+ claim: responseData,
290
+ claimed_by: account.btcAddress,
291
+ bounty_id: id,
292
+ });
293
+ }
294
+ catch (error) {
295
+ return createErrorResponse(error);
296
+ }
297
+ });
298
+ // --------------------------------------------------------------------------
299
+ // bounty_status — Check claim/submission status for a bounty
300
+ // --------------------------------------------------------------------------
301
+ server.registerTool("bounty_status", {
302
+ description: `Check the current status of a bounty on bounty.drx4.xyz.
303
+
304
+ Returns the bounty's current status in the workflow, along with any claims
305
+ and submission details. The status flow is:
306
+ open → claimed → submitted → approved → paid (or cancelled at any point by creator).
307
+
308
+ No authentication required.`,
309
+ inputSchema: {
310
+ id: z
311
+ .string()
312
+ .describe("Bounty UUID to check status for"),
313
+ },
314
+ }, async ({ id }) => {
315
+ try {
316
+ const res = await fetch(`${BOUNTY_BASE}/bounties/${encodeURIComponent(id)}`);
317
+ if (!res.ok) {
318
+ const text = await res.text();
319
+ throw new Error(`Failed to fetch bounty status for ${id} (${res.status}): ${text}`);
320
+ }
321
+ const data = await res.json();
322
+ // Extract and surface the most relevant status fields
323
+ return createJsonResponse({
324
+ id: data.id,
325
+ status: data.status,
326
+ title: data.title,
327
+ reward_sats: data.reward_sats,
328
+ creator: data.creator,
329
+ tags: data.tags,
330
+ claims: data.claims,
331
+ submissions: data.submissions,
332
+ payments: data.payments,
333
+ created_at: data.created_at,
334
+ updated_at: data.updated_at,
335
+ status_flow: "open → claimed → submitted → approved → paid (or cancelled)",
336
+ });
337
+ }
338
+ catch (error) {
339
+ return createErrorResponse(error);
340
+ }
341
+ });
342
+ // --------------------------------------------------------------------------
343
+ // bounty_my_claims — List all claims/submissions for current wallet
344
+ // --------------------------------------------------------------------------
345
+ server.registerTool("bounty_my_claims", {
346
+ description: `List all bounty claims and submissions for the current wallet's BTC address.
347
+
348
+ Returns the agent profile from bounty.drx4.xyz including all bounties created
349
+ and claims submitted. If no address is provided, uses the current wallet's BTC address.
350
+
351
+ No authentication required.`,
352
+ inputSchema: {
353
+ btc_address: z
354
+ .string()
355
+ .optional()
356
+ .describe("BTC address to look up (bc1q...). Omit to use the current wallet's BTC address."),
357
+ },
358
+ }, async ({ btc_address }) => {
359
+ try {
360
+ let address = btc_address;
361
+ if (!address) {
362
+ const account = await getAccount();
363
+ if (!account.btcAddress) {
364
+ throw new Error("No BTC address found. Provide a btc_address or unlock a wallet with BTC key derivation.");
365
+ }
366
+ address = account.btcAddress;
367
+ }
368
+ const res = await fetch(`${BOUNTY_BASE}/agents/${encodeURIComponent(address)}`);
369
+ if (!res.ok) {
370
+ const text = await res.text();
371
+ throw new Error(`Failed to fetch agent profile for ${address} (${res.status}): ${text}`);
372
+ }
373
+ const data = await res.json();
374
+ return createJsonResponse(data);
375
+ }
376
+ catch (error) {
377
+ return createErrorResponse(error);
378
+ }
379
+ });
380
+ // --------------------------------------------------------------------------
381
+ // bounty_stats — Platform aggregate stats
382
+ // --------------------------------------------------------------------------
383
+ server.registerTool("bounty_stats", {
384
+ description: `Get aggregate platform statistics from bounty.drx4.xyz.
385
+
386
+ Returns totals for bounties, agents, claims, submissions, and sBTC paid out.
387
+
388
+ No authentication required.`,
389
+ inputSchema: {},
390
+ }, async () => {
391
+ try {
392
+ const res = await fetch(`${BOUNTY_BASE}/stats`);
393
+ if (!res.ok) {
394
+ const text = await res.text();
395
+ throw new Error(`Failed to fetch bounty stats (${res.status}): ${text}`);
396
+ }
397
+ const data = await res.json();
398
+ return createJsonResponse(data);
399
+ }
400
+ catch (error) {
401
+ return createErrorResponse(error);
402
+ }
403
+ });
404
+ }
405
+ //# sourceMappingURL=bounty-scanner.tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bounty-scanner.tools.js","sourceRoot":"","sources":["../../src/tools/bounty-scanner.tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EACN,OAAO,IAAI,WAAW,EACtB,YAAY,IAAI,WAAW,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,GAAG,6BAA6B,CAAC;AAgBlD;;;;;;;GAOG;AACH,SAAS,sBAAsB,CAC7B,MAAc,EACd,QAAgB,EAChB,OAAuB;IAEvB,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,oBAAoB,MAAM,MAAM,OAAO,CAAC,UAAU,MAAM,QAAQ,MAAM,SAAS,EAAE,CAAC;IAElG,MAAM,UAAU,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;IACrE,MAAM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AC"}
@@ -0,0 +1,9 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ /**
3
+ * Register credential management tools with the MCP server.
4
+ *
5
+ * Provides encrypted credential storage (AES-256-GCM + scrypt KDF)
6
+ * at ~/.aibtc/credentials.enc. Password from ARC_CREDS_PASSWORD env var.
7
+ */
8
+ export declare function registerCredentialsTools(server: McpServer): void;
9
+ //# sourceMappingURL=credentials.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.tools.d.ts","sourceRoot":"","sources":["../../src/tools/credentials.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAepE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAkKhE"}