agenticbtc-mcp 1.0.12 → 1.0.13

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.js +20 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenticbtc-mcp",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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
@@ -774,9 +774,9 @@ server.tool(
774
774
  // Tool: Universal send_payment — auto-detects recipient type
775
775
  server.tool(
776
776
  "send_payment",
777
- "Send a payment to any recipient. Automatically detects recipient type: BOLT11 Lightning invoice (lnbc.../lntb...), Lightning address (user@domain.com), or Strike handle ($username). Routes through the optimal payment rail.",
777
+ "Send a payment to any recipient. Automatically detects recipient type: BOLT11 Lightning invoice (lnbc.../lntb...), Lightning address (user@domain.com), Strike handle ($username), or on-chain Bitcoin address (bc1.../1.../3...). Routes through the optimal payment rail.",
778
778
  {
779
- recipient: z.string().describe("Where to send: Lightning invoice (lnbc.../lntb...), Lightning address (user@domain.com), or Strike handle ($username)"),
779
+ recipient: z.string().describe("Where to send: Lightning invoice (lnbc.../lntb...), Lightning address (user@domain.com), Strike handle ($username), or on-chain BTC address (bc1.../1.../3...)"),
780
780
  amount_sats: z.number().optional().describe("Amount in satoshis (required for Lightning address and Strike handle; optional for BOLT11 invoices which encode the amount)"),
781
781
  amount_usd: z.number().optional().describe("Amount in USD (for Strike handle payments; alternative to amount_sats)"),
782
782
  memo: z.string().optional().default("").describe("Optional payment memo or comment"),
@@ -787,6 +787,8 @@ server.tool(
787
787
  const isBolt11 = /^lnbc|^lntb|^lnbcrt/i.test(recipient);
788
788
  const isStrikeHandle = recipient.startsWith("$");
789
789
  const isLightningAddress = !isBolt11 && !isStrikeHandle && recipient.includes("@");
790
+ const isOnChainBTC = !isBolt11 && !isStrikeHandle && !isLightningAddress &&
791
+ /^(bc1|tb1|[13][a-km-zA-HJ-NP-Z1-9]{25,34})/i.test(recipient);
790
792
 
791
793
  // Resolve agent for spending policy
792
794
  let resolvedAgent = null;
@@ -904,8 +906,23 @@ server.tool(
904
906
  }
905
907
  return { content: [{ type: "text", text: `Payment failed: ${data?.detail || data?.error || JSON.stringify(data)}` }] };
906
908
 
909
+ } else if (isOnChainBTC) {
910
+ if (!amount_sats && !amount_usd) return { content: [{ type: "text", text: "Error: amount_sats or amount_usd required for on-chain BTC payments" }] };
911
+ if (resolvedAgent && amount_sats) {
912
+ const policy = await checkSpendingPolicy(resolvedAgent.id, amount_sats);
913
+ if (!policy.allowed) return { content: [{ type: "text", text: `Payment blocked: ${policy.reason}` }] };
914
+ }
915
+ const body = { recipient, memo: memo || `On-chain BTC to ${recipient.slice(0, 20)}...` };
916
+ if (amount_sats) body.amount_sats = amount_sats;
917
+ if (amount_usd) body.amount_usd = amount_usd;
918
+ const { status, data } = await apiCall("/api/v1/send", { method: "POST", body: JSON.stringify(body) });
919
+ if (status === 200 && data.success) {
920
+ return { content: [{ type: "text", text: JSON.stringify({ success: true, type: "onchain_btc", recipient, amount_sats: data.amount_sats, fee_sats: data.fee_sats || 0, payment_id: data.payment_id, rail: "coinbase", message: `On-chain BTC sent via Coinbase ⛓️` }) }] };
921
+ }
922
+ return { content: [{ type: "text", text: `Payment failed: ${data?.detail || data?.error || JSON.stringify(data)}` }] };
923
+
907
924
  } else {
908
- return { content: [{ type: "text", text: `Error: Unrecognized recipient format. Use a BOLT11 invoice (lnbc.../lntb...), Lightning address (user@domain.com), or Strike handle ($username).` }] };
925
+ return { content: [{ type: "text", text: `Error: Unrecognized recipient format. Use a BOLT11 invoice (lnbc.../lntb...), Lightning address (user@domain.com), Strike handle ($username), or on-chain Bitcoin address (bc1.../1.../3...).` }] };
909
926
  }
910
927
  }
911
928
  );