agenticbtc-mcp 1.0.6 → 1.0.7
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/package.json +1 -1
- package/src/server.js +13 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenticbtc-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Privacy-intelligent payments for AI agents — your privacy, your choice. Universal payment router with Lightning, Strike, Coinbase, PayPal, Venmo support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bitcoin",
|
package/src/server.js
CHANGED
|
@@ -259,55 +259,35 @@ server.tool(
|
|
|
259
259
|
agent: z.string().optional().describe("Agent wallet name or ID (optional)"),
|
|
260
260
|
},
|
|
261
261
|
async ({ amount_sats, description, agent }) => {
|
|
262
|
-
if (!LND_HOST) {
|
|
263
|
-
return { content: [{ type: "text", text: "Error: LND node not configured. Set AGENTBTC_LND_HOST environment variable." }] };
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// Resolve agent if provided (for logging/tracking)
|
|
267
|
-
let agentName = null;
|
|
268
|
-
if (agent) {
|
|
269
|
-
const resolved = await resolveAgent(agent);
|
|
270
|
-
if (!resolved) {
|
|
271
|
-
return { content: [{ type: "text", text: `Error: Agent '${agent}' not found` }] };
|
|
272
|
-
}
|
|
273
|
-
agentName = resolved.name;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
262
|
try {
|
|
277
|
-
//
|
|
278
|
-
|
|
263
|
+
// Route through the AgenticBTC API so the invoice is stored in the DB
|
|
264
|
+
// and the settlement poller can credit the agent wallet on payment
|
|
265
|
+
const { status, data } = await apiCall("/api/v1/invoices", {
|
|
279
266
|
method: "POST",
|
|
280
|
-
headers: {
|
|
281
|
-
"Grpc-Metadata-macaroon": LND_MACAROON,
|
|
282
|
-
"Content-Type": "application/json",
|
|
283
|
-
},
|
|
284
267
|
body: JSON.stringify({
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
expiry: "3600",
|
|
268
|
+
amount_sats,
|
|
269
|
+
description,
|
|
288
270
|
}),
|
|
289
271
|
});
|
|
290
|
-
const data = await res.json();
|
|
291
272
|
|
|
292
|
-
if (
|
|
273
|
+
if (status === 200 && data.invoice) {
|
|
293
274
|
return {
|
|
294
275
|
content: [{
|
|
295
276
|
type: "text",
|
|
296
277
|
text: JSON.stringify({
|
|
297
278
|
success: true,
|
|
298
|
-
invoice: data.
|
|
299
|
-
amount_sats
|
|
300
|
-
description: description,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
expires: "1 hour",
|
|
279
|
+
invoice: data.invoice,
|
|
280
|
+
amount_sats,
|
|
281
|
+
description: data.description || description,
|
|
282
|
+
payment_hash: data.payment_hash,
|
|
283
|
+
expires: data.expires_in || "1 hour",
|
|
304
284
|
}, null, 2),
|
|
305
285
|
}],
|
|
306
286
|
};
|
|
307
287
|
}
|
|
308
|
-
return { content: [{ type: "text", text: `Error creating invoice: ${JSON.stringify(data)}` }] };
|
|
288
|
+
return { content: [{ type: "text", text: `Error creating invoice: ${data?.detail || JSON.stringify(data)}` }] };
|
|
309
289
|
} catch (e) {
|
|
310
|
-
return { content: [{ type: "text", text: `
|
|
290
|
+
return { content: [{ type: "text", text: `Error: ${e.message}` }] };
|
|
311
291
|
}
|
|
312
292
|
}
|
|
313
293
|
);
|