Skip to main content Switch to mobile version satsgate-mcp 0.15.0 Charge AI agents in Lightning and USDC on the same 402. Payments go straight to your wallet. 500 free unlocks a month.
pip install satsgate-mcp==0.15.0 Copy PIP instructions
Charge AI agents in Lightning and USDC on the same 402. Payments go straight to your wallet. 500 free unlocks a month.
A buyer-side MCP server. An agent (Claude Desktop, Cursor, or any stdio MCP client) can see the price of a Satsgate-paywalled URL, pay it, and read the response.
This package is version 0.15.0. It talks to whatever URL returned the 402. Works with core 0.20.3 or later. The self-hosted proxy is 0.17.0. Works with gate 0.15.2 or later. On a gate host (SATSGATE_MCP_GATE_HOSTS, default gate.satsgate.org) pay_and_fetch pays the gate, keeps the receipt, and repeats the request at redeem_url when that host is on the allowlist. The receipt is not logged. A stored receipt is returned by challenge_status. The body sent to a gate host is not forwarded. A 402 may offer Lightning, x402 (USDC on Base), or both. One 402 lists one USDC network. list_sites includes a public route priced only in USD, with price_currency and price_usd_atomic. This process cannot load a seller's prepaid service balance, and it does not hold a buyer private key. An account tops up on the core with POST /v1/topup/lightning or POST /v1/topup/usdc. On api.satsgate.org a USDC top-up is Base mainnet USDC (a self-hosted core needs SATSGATE_X402_CDP=1; see self-hosting). The USDC path is not an MCP tool.
pip install satsgate-mcp or pip install "satsgate[mcp]".
The console script is satsgate-mcp. satsgate-mcp --help prints the environment variables it reads and exits. satsgate-mcp --version prints satsgate-mcp and the version. With no arguments it speaks MCP on stdio.
USDC payments: Base network only
USDC payments use Base only. Ethereum mainnet, Polygon, Solana, Arbitrum, and any other chain are not accepted.
Merchants: payTo must be an address you control on Base. The USDC is paid to that address on the one network that site is in. Try on Base Sepolia with your agent first, then switch the site to live. Buyers: USDC sent on another network will not be accepted. A balance on Ethereum, Polygon, Solana, or Arbitrum does not pay a Satsgate 402.
Satsgate never custodies, receives, forwards, or refunds buyer funds. The USDC moves from the buyer to the merchant's payTo. Satsgate does not hold a buyer wallet and does not run its own facilitator.
This MCP server does not send that USDC and does not hold a key. It shows the network and the amount printed on the 402. An accept on any other network is reported and is not payable. A test-mode 402 is Base Sepolia and is labeled testing. A live-mode 402 is Base. This server can describe either. It still does not sign. A wallet that signs uses the extra on that 402. Base Sepolia is name USDC. Base is name USD Coin. This server does not substitute a name.
list_sites reads GET /v1/sites on SATSGATE_MCP_CORE_URL (default https://api.satsgate.org). That is the public directory: approved sites that opted in. Set SATSGATE_MCP_REGISTRY only to replace it with a JSON file or another URL.
pip install satsgate-mcp export SATSGATE_MCP_DATA_DIR="$HOME/.local/share/satsgate-mcp" export SATSGATE_MCP_MAX_PAYMENT_SATS=100 export SATSGATE_MCP_DAILY_MAX_SATS=500 satsgate-mcp satsgate-mcp speaks MCP over stdio. Logs go to stderr.
Claude Desktop or Cursor config:
{ "mcpServers": { "satsgate": { "command": "satsgate-mcp", "env": { "SATSGATE_MCP_DATA_DIR": "/absolute/path/to/satsgate-mcp-data", "SATSGATE_MCP_MAX_PAYMENT_SATS": "100", "SATSGATE_MCP_DAILY_MAX_SATS": "500", "SATSGATE_MCP_MAX_PAYMENT_USD": "1", "SATSGATE_MCP_DAILY_MAX_USD": "5" } } } } Put SATSGATE_MCP_NWC_URI in that env block when you want the agent to pay. Do not paste the URI into the chat. The tools have no argument for it, and it is not logged.
A token that still has uses, or whose pass has not ended, is sent again and is not paid again. The macaroon stays in the local sqlite file. It is not returned to the model.
If the server answers a stored token with a fresh 402 token_used_up or token_expired, the tool returns the new quote and does not pay. Call pay_and_fetch again to pay that invoice. Set SATSGATE_MCP_AUTO_PAY=1 to pay that replacement inside the same call, and only when it is inside both caps.
discover followed within 60 seconds by pay_and_fetch for the same URL reuses that invoice instead of minting another one.
pay_and_fetch with mode=human.
Pay the BOLT11 invoice. If the seller's Lightning Address advertises LUD-21 verify, any Lightning wallet can pay it and you do not send a preimage.
check_payment with the payment_hash. If the address does not advertise LUD-21 verify, pass preimage (64 hex characters). The retry then sends Authorization: L402
When SATSGATE_MCP_API_KEY is set and the challenge names a resource, check_payment first calls core GET /v1/paywall/status/{payment_hash} with the macaroon and consume=false. That is the LUD-21 poll. Unpaid is status=pending. Settled, it retries the original URL with the macaroon. The proxy then consumes one use and forwards.
Without a key, check_payment retries the URL directly. The proxy does the core poll. Pending is HTTP 402 payment_pending and does not mint a second invoice.
If the payee wallet does not advertise LUD-21 (Wallet of Satoshi), core returns preimage_required. A macaroon-only poll cannot finish. Pass preimage to check_payment or pay_and_fetch, or use mode=nwc, which pays with the preimage.
A site may enable only Lightning, only x402, or both. x402 is off until the merchant turns it on. If core has no fresh BTC/USD median, a sats-priced route's 402 offers only its primary currency. This client shows the 402 as it arrived. It does not invent a USDC price, and it does not round the amount again. The server already locked the quote and rounded it up (minimum 0.001 USDC, or 1 sat on Lightning).
Supported accepts are Circle USDC on Base Sepolia (eip155:84532, the network tests and the current gate use) and Circle USDC on Base (eip155:8453). Any other network or asset is listed with supported: false. The tool does not raise. A PAYMENT-SIGNATURE is forwarded only when every accept is one of those two and inside both USD caps, because the signature may select any accept.
This server holds no buyer private key. It does not sign, submit, custody, forward, or refund USDC, and it does not run a facilitator. Satsgate does not either. When payable is true, the payment object is what an external wallet has to pay. Call pay_and_fetch again with payment_signature set to that PAYMENT-SIGNATURE: one line, no spaces, at most 8192 bytes. Do not send an L402 Authorization on the same request. An empty payment_signature stays on the Lightning path.
The gate or proxy runs verify, then the origin, then settle. A 2xx returns the body and, when the server sent one, payment_response with success, transaction, tx, network, and payer. The raw header is not returned. If the origin fails, nothing is settled and the seller's prepaid service balance is not debited. The tool says so, sets retry_same_payment_signature true, and the same header can be sent again while the offer is valid. bad_signature and expired need a new signature. x402_replay was already settled, so sending it again does not fetch the resource. x402_rejected is either a failed verify (new signature) or a failed settle of a header you already sent (retry that same header). Local USD spend is recorded only after a 2xx, and the signature is not written to sqlite and is not logged.
Both SATSGATE_MCP_MAX_PAYMENT_USD and SATSGATE_MCP_DAILY_MAX_USD must be set or the tool will not proceed. 0 refuses every positive amount. Unset or over the cap, discover still returns the parsed requirements with payable: false. pay_and_fetch then refuses and does not send the header. The sats caps do not apply to USDC. An over-cap USDC amount does not block paying the Lightning invoice on the same 402.
mode=human still returns the invoice and QR when Lightning is offered. If the address advertises LUD-21 verify, a person can pay from any Lightning wallet and the agent continues with check_payment. If it does not, pass preimage. A dual 402 returns that invoice and the x402 block together. An x402-only URL has no invoice. NWC is not required for it. An sgr_ key is still only for challenge_status and credits_balance. The x402 tools do not call a route that needs an account key.
remote_call_tool calls one tool on a remote MCP server, such as a route of satsgate-proxy priced per tool. Added in 0.14.0.
Each call opens its own connection. The client first tries the 2026-07-28 server/discover. If the server does not answer it, the client uses initialize and the session the server assigns, and ends that session after the call. A server on an earlier MCP version can answer server/discover with an HTTP error such as 400. satsgate-proxy forwards that answer from the server. It is expected, not a failure. satsgate-mcp logs one INFO line on stderr that says so, and does not also log a generic request … -> 400 line for that answer. The HTTP client libraries log only warnings. Then it lists the tools. The handshake and the list are never paid. A tool the server does not list is not called.
An unpaid call to a priced tool gets the price either as an HTTP 402 or as an in-band price notice: a tool result with isError: true and the offer in structuredContent. Both are read the same way.
mode=human returns the invoice and the QR. If the seller's Lightning Address advertises LUD-21 verify, pay it from any Lightning wallet, then call remote_call_tool again with the same url and tool. Do not send a preimage. If it does not, pass preimage. The same invoice is used until it expires. Do not call check_payment for a remote tool. The terminal QR is drawn with block characters a phone camera can scan. The PNG is unchanged.
mode=nwc pays from the environment wallet if the sats caps allow it, then repeats the same call with Authorization: L402
payment_signature sends a PAYMENT-SIGNATURE from an external wallet inside the call, in params._meta["x402/payment"]. The USD caps apply. This process does not sign.
paid: true when this call was paid: by the NWC wallet, by a payment_signature, or, in mode=human, by the person who paid the invoice before this call. false when nothing new was paid.
paid_with: lightning or x402 when paid is true, otherwise null.
paid_sats: the invoice amount for a Lightning payment, otherwise null.
reused_token: true when the call used a stored token. Nothing new was paid.
A call pays at most once. The token is stored per server URL and tool name, not per argument set, and is reused while it has uses or time. A failed tool call takes no use, so the token is kept and the next call retries with it. Parallel calls to the same tool wait for one another, so a token that covers several calls is paid once. This holds inside one satsgate-mcp process. Two processes that share a data directory are not coordinated.
Not supported: requests from the server to the client (sampling, elicitation), a tool that asks for more input, tasks, resources, and prompts. A paid call that times out is not repeated automatically. Call remote_call_tool again to retry with the stored token.
Example: a human offer (placeholders for values that change).
{ "ok": true, "payment_required": true, "url": "http://shop.example/mcp", "method": "POST", "resource": "
{ "ok": true, "url": "http://shop.example/mcp", "tool": "quote", "protocol_version": "2026-07-28", "is_error": false, "content": [ { "text": "acme", "type": "text" } ], "structured_content": { "result": "acme" }, "paid": true, "paid_with": "lightning", "paid_sats": 21, "reused_token": false, "payment_hash": "
SATSGATE_MCP_NWC_URI is nostr+walletconnect://...?relay=...&secret=.... Both caps must be set or every NWC payment is refused. 0 refuses every positive amount. The spend ledger is satsgate-mcp.sqlite in the data dir (mode 0600). A payment is recorded when the wallet returns a preimage, including when the origin then fails. Sats are not refunded.
Only http and https URLs are requested. Userinfo is rejected. Redirects are not followed. Requests time out.
{ "sites": [ {"name": "example", "url": "https://shop.example/blog/post", "description": "One article"} ] } Leave SATSGATE_MCP_REGISTRY unset to use the public directory. The response uses hosted_registry: true, slug, url (the gate URL, https://gate.satsgate.org/
A row that includes status other than approved, or listed other than true, is skipped. The public endpoint does not return those rows. A local file that omits both fields is your own list.
If SATSGATE_MCP_URL_ALLOWLIST is set, the directory host has to be on it. The default host is the host of SATSGATE_MCP_CORE_URL.
Mainnet check from your machine
Use a route priced at 1 to 21 sats. Pay from a wallet that is not the payee.
If it stops before the origin body is printed, it prints a command you can paste. That command resumes the same payment_hash from the data dir and does not mint a new invoice:
SATSGATE_MCP_DATA_DIR="$HOME/.local/share/satsgate-mcp" satsgate-mcp-pay --resume PAYMENT_HASH If it stays on payment_pending until expiry, the invoice was unpaid or the payee has no LUD-21 verify URL. Wallet of Satoshi needs the NWC path below.
export SATSGATE_MCP_NWC_URI='nostr+walletconnect://...' export SATSGATE_MCP_MAX_PAYMENT_SATS=50 export SATSGATE_MCP_DAILY_MAX_SATS=200 satsgate-mcp-pay --nwc 'https://YOUR-PROXY/blog/post' lnget and fetch402 against the proxy
These clients pay the 402 header themselves. They are not the MCP server.
A header-shape check that does not pay is in the contributors' section below. To spend sats:
lnget 'https://YOUR-PROXY/blog/post' npm install @getalby/lightning-tools export NWC_CONNECTION_STRING='nostr+walletconnect://...' node mcp/scripts/fetch402.mjs 'https://YOUR-PROXY/blog/post' lnget and fetch402 retry with Authorization: L402
Confirm the origin saw the request and X-Satsgate-Signature verifies. A tampered path or a stale t= is rejected by the origin snippet.
From a checkout: PYTHONPATH=mcp/src python -m satsgate_mcp.
PYTHONPATH=mcp/src python mcp/scripts/mainnet_l402_clients.py 'https://YOUR-PROXY/blog/post' Project links
Released: Dec 3, 2026
Both files in this release have provenance metadata.
View provenance details
Apache-2.0 View SPDX License List
Development Status 4 - Beta
Programming Language Python :: 3
Release files for satsgate-mcp 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 143.2 kB
Release files / satsgate_mcp-0.15.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Release files / satsgate_mcp-0.15.0-py3-none-any.whl
Security for satsgate-mcp 0.15.0
Both files in this release have been uploaded with provenance metadata.
With provenance satsgate_mcp-0.15.0.tar.gz Dec 3, 2026
With provenance satsgate_mcp-0.15.0-py3-none-any.whl Dec 3, 2026
Attestation for satsgate_mcp-0.15.0.tar.gz
Attestation for satsgate_mcp-0.15.0-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 3, 2026 2 release files Full provenance
Nov 27, 2026 2 release files Full provenance
Nov 18, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 6571ef3











