Skip to main content

macaroonnetwork-mcp

MCP client for Macaroon Network — a marketplace where AI agents discover and pay for live data.

Payment rail status, read before use: the live marketplace's primary payment rail is x402 (USDC on Base mainnet) — nearly every listing is settled that way today. L402 (Bitcoin Lightning) is also supported but is inactive for most live listings. This package's buyer code handles both: macaroons_execute understands the real x402 challenge shape (a base64-JSON payment-required header carrying accepts[] terms) exactly as it arrives from the live registry, alongside the existing L402 www-authenticate flow — whichever rail a listing actually gates on, this package raises the matching typed result instead of an unhandled 402. As with L402, this package never holds a wallet or signs anything itself for x402 either: it hands back the real payment terms for you to sign with your own wallet/CDP infrastructure. (Note: this x402 support has not yet been published to PyPI as of this writing — pip install macaroonnetwork-mcp still gets the L402-only 0.2.0 release until the next publish; build from this repo's mcp-distribution/ if you need it now.)

What this does

Four tools:

  • macaroons_search — semantic search over the live marketplace registry by natural-language intent, including Christian evidence capabilities. Free.
  • macaroons_metadata — free freshness/content-hash metadata for a feed target, before deciding whether to buy. Free.
  • macaroons_purchase — pays via the Lightning L402 rail (feed-changes purchases only; see "Paying" below).
  • macaroons_execute — pays via whichever rail the target listing actually uses, x402 or L402, and receives the real, predicate-verified result. See "Paying" below — by default this package holds no wallet and doesn't attempt payment for you on either rail.

Paying

This package never holds a private key or wallet credential by default, on either payment rail.

x402 (USDC on Base) — macaroons_execute only

When an x402-gated listing needs payment, macaroons_execute returns an x402_payment_required result instead of failing:

{
  "x402_payment_required": true,
  "resource_url": "https://api.macaroonnetwork.com/execute/...",
  "amount_atomic": "3000",
  "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "network": "eip155:8453",
  "pay_to": "0x33cc...",
  "extra_name": "USD Coin",
  "extra_version": "2",
  "max_timeout_seconds": 60,
  "x402_version": 2,
  "instructions": "Sign an exact x402 payment of amount_atomic atomic units of asset on network to pay_to with your own wallet/CDP infra, then call this same tool again with identical arguments PLUS payment_signature set to the resulting signed proof."
}

Sign the exact-scheme USDC payment described above with your own wallet or Coinbase CDP infrastructure, then call macaroons_execute again with identical arguments plus payment_signature set to the resulting signed proof. Unlike the L402 flow below, this is a single retry — x402's "exact" scheme settles synchronously, there's no invoice-polling step.

L402 (Bitcoin Lightning)

When an L402-gated listing needs payment, macaroons_purchase/ macaroons_execute return a payment_required result instead of failing:

{
  "payment_required": true,
  "invoice": "lnbc...",
  "macaroon": "eyJ...",
  "amount_msat": 250000,
  "instructions": "Pay this BOLT11 invoice with your own Lightning wallet, then call this same tool again with identical arguments PLUS resume_macaroon set to the macaroon above."
}

Pay the invoice with whatever Lightning wallet you actually have, then call the same tool again with resume_macaroon set to the macaroon above. A plain retry without resume_macaroon mints a brand-new invoice instead of resuming the one you just paid — always pass it back.

If you run your own real LND node and want this package to auto-pay from it instead of returning payment_required, set:

MACAROONS_BUYER_LND_MODE=external
LND_BUYER_HOST=your-node:10009
LND_BUYER_TLS=/path/to/tls.cert
LND_BUYER_MACAROON=/path/to/admin.macaroon

This shells out to a real lncli binary on your machine — install LND's lncli separately, it isn't bundled here. There is no equivalent auto-pay mode for x402: no offline/local-key signing path exists in this package for either rail, by design (see the payment-rail status note above).

Install

pip install macaroonnetwork-mcp

Use with an MCP client

{
  "mcpServers": {
    "macaroonnetwork": {
      "command": "macaroonnetwork-mcp"
    }
  }
}

Talks to https://api.macaroonnetwork.com by default. Override with MACAROONS_REGISTRY_URL / MACAROONS_FEED_URL env vars to point at a local dev stack instead. MACAROONS_SESSION_BUDGET_SATS (default 1000) caps total spend per server process; each tool call also takes a max_spend_sats per-call cap (default 100).

License

MIT

Release files for macaroonnetwork-mcp 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for macaroonnetwork-mcp 0.3.0
File Size Uploaded
macaroonnetwork_mcp-0.3.0.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for macaroonnetwork-mcp 0.3.0
File Interpreter ABI Platform
macaroonnetwork_mcp-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.6 kB

Release files / macaroonnetwork_mcp-0.3.0.tar.gz

Download URL macaroonnetwork_mcp-0.3.0.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27455941cefef308e584f75135daf2aa8d7f867d5dcf6256efc687c643eae18a
BLAKE2b-256 checksum
How to use checksums
cfa287bce37e9424f03b6889b0a1d67603cc78dba0b2352aa074c1c408e43856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / macaroonnetwork_mcp-0.3.0-py3-none-any.whl

Download URL macaroonnetwork_mcp-0.3.0-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08e86c5e1130f2a1f5f4cb4ecce511cb0864eda9420a91cae0c93613a73aa89c
BLAKE2b-256 checksum
How to use checksums
d6e91cabafcef27b3f18d51e09fd70027e954ba0b252eedebb08f18def1af47c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release history Release notifications | RSS feed

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page