{"components":{"securitySchemes":{"L402":{"description":"Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e","in":"header","name":"Authorization","type":"apiKey"}}},"info":{"description":"Focused Bitcoin intelligence and developer utilities for autonomous agents, paid per call over L402.","title":"loop-mcp Bitcoin Agent Tools","version":"2.5.0"},"openapi":"3.0.3","paths":{"/l402/btc_price":{"get":{"description":"Get the current Bitcoin spot price in USD, EUR, GBP, CAD, CHF, AUD and JPY. Use it to convert between BTC or sats and fiat, or to quote a price; for whether to broadcast now use btc_send_decision, and for fee timing use optimal_send_window. Takes no input. Read-only: each call makes one live HTTPS read of mempool.space; the result is not stored. Returns the upstream object as served (time in Unix seconds, one whole-unit price per currency) plus source (the URL read), fetched_at (UTC, RFC 3339) and source_sha256 (SHA-256 of the upstream body). Returns an upstream error if mempool.space is unreachable or sends invalid JSON.","operationId":"get-btc-price","parameters":[],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Bitcoin Price","x-l402":{"currency":"BTC","enabled":true,"price_sats":10}}},"/l402/btc_send_decision":{"get":{"description":"Returns a composited send-or-wait recommendation for a Bitcoin transaction. Fetches live mempool and fee data, then outputs a machine-actionable verdict (SEND_NOW, WAIT, or URGENT_ONLY) with fee rates in sat/vB, mempool pressure level, and estimated savings if you wait. Ideal for agents that need a single decision call instead of parsing multiple raw mempool endpoints.","operationId":"get-btc-send-decision","parameters":[{"description":"How time-sensitive is your transaction? low=economy, medium=default, high=next-block.","in":"query","name":"urgency","required":false,"schema":{"enum":["low","medium","high"],"type":"string"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Bitcoin Send Decision","x-l402":{"currency":"BTC","enabled":true,"price_sats":15}}},"/l402/business_ratios":{"get":{"description":"Compute cash runway in months, cash buffer days, current ratio, quick ratio, debt to equity, DSO, DIO, DPO and cash conversion cycle from any subset of a business's own cash, monthly flow and balance sheet figures. Arithmetic only, no network. Each value carries its formula and the inputs it used; a value that cannot be computed is null with a reason. Use it to check a company's liquidity, leverage or working-capital cycle from figures you already have; it does not fetch filings or market data. All inputs are optional numbers in one currency unit (monthly figures per month, annual figures for the last twelve months); pass only what you know. Returns inputs, ratios (each with value, unit, formula, inputs and, when null, reason), rounded_to_decimals (4) and about (provider, contact, description). Same input, same output.","operationId":"get-business-ratios","parameters":[{"description":"Cost of goods sold for the last twelve months.","in":"query","name":"annual_cogs","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Revenue for the last twelve months.","in":"query","name":"annual_revenue","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Cash on hand. Every figure uses the same currency unit. May be negative.","in":"query","name":"cash","required":false,"schema":{"type":"number"}},{"description":"Total current assets.","in":"query","name":"current_assets","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Total current liabilities.","in":"query","name":"current_liabilities","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Total equity. May be negative.","in":"query","name":"equity","required":false,"schema":{"type":"number"}},{"description":"Inventory at cost.","in":"query","name":"inventory","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Cash received per month.","in":"query","name":"monthly_inflows","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Cash paid out per month.","in":"query","name":"monthly_outflows","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Accounts payable.","in":"query","name":"payables","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Accounts receivable.","in":"query","name":"receivables","required":false,"schema":{"minimum":0,"type":"number"}},{"description":"Total liabilities.","in":"query","name":"total_liabilities","required":false,"schema":{"minimum":0,"type":"number"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Business Ratios","x-l402":{"currency":"BTC","enabled":true,"price_sats":10}}},"/l402/l402_recheck":{"get":{"description":"Re-check one listed L402 endpoint now, after its operator changed something. Input: id, an endpoint id from the newest Agent Payments Index probe file (the hosts page at https://loopxxi.com/agent-payments-index/hosts and the probe file list each endpoint with its id and its last daily result). The tool sends one live request to that endpoint with the method the list gives (GET or POST), no request body, no buyer headers and the user agent LoopXXI-Index-Recheck/1. It does not follow redirects and stops after 10 seconds. Returns the same fields as a row of the daily probe file (status, outcome, challenge scheme, whether a macaroon and an invoice came back, the invoice amount and network), a plain likely cause and fix, checked_at, and the last daily result for comparison. The macaroon and the invoice string are never returned. A timeout, a refused connection or an error status from the endpoint is a valid result, and the call is charged. A failure on our side is not charged. At most one live request per endpoint per 10 minutes, 30 per host per hour and 60 per hour in all; inside a limit the call is refused before an invoice, with the age of the last result and the time to retry. We do not sell a stored answer. The daily probe stays at one request per endpoint per day; a re-check is a separate request that a buyer asked for. Re-check results are not published and are not added to the daily files.","operationId":"get-l402-recheck","parameters":[{"description":"Endpoint id from the newest Agent Payments Index probe file.","in":"query","name":"id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Re-check one L402 endpoint","x-l402":{"currency":"BTC","enabled":true,"price_sats":21}}},"/l402/lightning_address_resolve":{"get":{"description":"Resolve a Lightning Address (user@domain.com) to a payable BOLT11 invoice for a given amount. Handles the full LNURL-pay protocol internally. Returns the invoice plus min/max sendable amounts for validation.","operationId":"get-lightning-address-resolve","parameters":[{"description":"Lightning Address in user@domain.com format.","in":"query","name":"address","required":true,"schema":{"type":"string"}},{"description":"Amount you want to send, in satoshis. At most 100000000 (1 BTC).","in":"query","name":"amount_sats","required":true,"schema":{"maximum":100000000,"minimum":1,"type":"integer"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Lightning Address Resolve","x-l402":{"currency":"BTC","enabled":true,"price_sats":10}}},"/l402/optimal_send_window":{"get":{"description":"Bitcoin transaction timing intelligence. Returns a congestion forecast for the next 1-4h, a recommended UTC send window when fees are projected at/below your target, a fee trajectory (rising/stable/falling) with a calibrated confidence score, next-block minimum fee, confirmation targets for 3/6/144 blocks, and an RBF-viability flag. A synthesis layer above raw fee data — the decision an autonomous payment agent needs before broadcasting. Source: mempool.space.","operationId":"get-optimal-send-window","parameters":[{"description":"How far ahead to search for the optimal window (1-6h, default 4).","in":"query","name":"hours_ahead","required":false,"schema":{"maximum":6,"minimum":1,"type":"integer"}},{"description":"Your fee ceiling in sat/vB. The recommended window targets at-or-below this rate. Omit to get the lowest-projected window.","in":"query","name":"target_sat_vb","required":false,"schema":{"type":"number"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Optimal Send Window","x-l402":{"currency":"BTC","enabled":true,"price_sats":25}}},"/l402/tx_decode_explain":{"get":{"description":"Fetch a Bitcoin transaction by txid and return a structured, agent-ready summary: type (P2WPKH/P2TR/P2SH/etc.), input/output counts, fees, fee rate in sat/vB, confirmation status, RBF flag, SegWit/Taproot flags, and a one-line agent_summary string ready for LLM context injection. Saves 500-2000 tokens vs parsing raw TX JSON.","operationId":"get-tx-decode-explain","parameters":[{"description":"Bitcoin transaction ID (64 hex characters).","in":"query","name":"txid","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tool result as JSON: tool, paid, and result."},"400":{"description":"invalid_argument. A query value does not match its parameter type."},"402":{"description":"L402 payment required. The body and WWW-Authenticate carry a BOLT11 invoice and a macaroon. Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."}},"security":[{"L402":[]}],"summary":"Transaction Decode and Explain","x-l402":{"currency":"BTC","enabled":true,"price_sats":25}}},"/read":{"get":{"description":"Lists available pay-per-read articles with slug, title, and price_sats.","operationId":"list-read-articles","responses":{"200":{"description":"JSON array of articles."}},"summary":"List pay-per-read articles"}},"/read/{slug}":{"get":{"description":"Returns an L402 challenge when unpaid, or the full markdown article when presented with a paid L402 proof. Invoice expiry (expires_at, 1 hour) limits paying; once paid, the macaroon remains redeemable for 90 days (redeem_until). An expired unpaid macaroon returns 410 invoice_expired.","operationId":"get-read-article","parameters":[{"description":"Allowlisted article slug from GET /read.","in":"path","name":"slug","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Paid article as JSON: slug, title, content_type, body. Re-readable with the same paid Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e until redeem_until (90 days from issue)."},"401":{"description":"invalid_payment_proof (forged signature, wrong slug, wrong preimage, or past 90-day redemption window), payment_not_settled, or payment_amount_mismatch."},"402":{"description":"L402 payment required. Body and WWW-Authenticate carry invoice, macaroon, payment_hash, price_sats, what_you_get, instructions, expires_at (1h invoice deadline), and redeem_until (90-day redemption window once paid). Retry with Authorization: L402 \u003cmacaroon\u003e:\u003cpreimage\u003e."},"404":{"description":"not_found. Unknown article slug."},"410":{"description":"invoice_expired. Signature-valid read:\u003cslug\u003e macaroon whose invoice expired unpaid. Request GET /read/{slug} without Authorization for a fresh invoice."},"429":{"description":"rate_limited. Too many unpaid invoice requests."},"503":{"description":"content_unavailable or payment_verification_unavailable."}},"security":[{"L402":[]}],"summary":"Pay-per-read article"}},"/read/{slug}/status":{"get":{"description":"Polls payment status for a read:\u003cslug\u003e macaroon sent as Authorization: L402 \u003cmacaroon\u003e. Paid macaroons return {paid: true, preimage} for 90 days from issue; expired unpaid macaroons return 410 invoice_expired.","operationId":"get-read-article-status","parameters":[{"description":"Allowlisted article slug from GET /read.","in":"path","name":"slug","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{paid: false} while invoice is active and unpaid, or {paid: true, preimage} once settled (valid for 90 days from issue)."},"401":{"description":"invalid_macaroon. Bad signature, wrong slug, or older than 90 days."},"404":{"description":"not_found. Unknown article slug."},"410":{"description":"invoice_expired. Signature-valid macaroon whose invoice expired unpaid; safe to request a new invoice."},"429":{"description":"rate_limited. Per-IP or per-payment-hash status poll limit exceeded."}},"summary":"Check read-gate invoice payment status"}}},"servers":[{"url":"https://mcp.loopxxi.com"}]}