Your Python tool is getting hammered. Charge 21 sats per call.
Drop-in L402 Lightning wrapper for any async Python tool. CrewAI, AutoGen, LangChain. No Stripe key on disk. No custody.
A free MCP tool is a free GPU lottery for whoever finds it. The fix is not blocking. The fix is pricing the call.
pip install powforge
Before and after
Take any async def tool function. Wrap it. The wrapped callable returns a 402-style payment envelope on the first hit and the real tool output once the caller has paid the invoice.
Before — no gate
async def expensive_tool(query: str) -> dict:
# GPU minutes burn here.
# Anyone who finds the tool gets to call it.
return {"answer": run_model(query)}
After — L402 gated
from powforge import wrap_with_l402
paid_tool = wrap_with_l402(
expensive_tool,
lnbits_url="https://lnbits.example.com",
lnbits_api_key=LNBITS_INVOICE_KEY,
sats_amount=21,
)
# First call: returns {error: "payment_required",
# invoice: "lnbc...", payment_hash: "...", sats: 21}
# Paid call: returns whatever expensive_tool returns.
result = await paid_tool(query, payment_proof=hash)
The invoice is minted from your LNBits wallet. The sats land in your wallet directly. The library never holds funds.
Or as a CrewAI / AutoGen / LangChain tool
If you register tools as {name, description, func} dicts, skip the wrapper and use the factory. The returned dict drops straight into the frameworks that accept that shape.
from powforge import create_l402_tool
tool = create_l402_tool(
name="expensive_tool",
description="Run the expensive model. 21 sats per call.",
func=expensive_tool,
lnbits_url="https://lnbits.example.com",
lnbits_api_key=LNBITS_INVOICE_KEY,
sats_amount=21,
)
# tool == {"name": ..., "description": ..., "func": <async gated>}
# Register `tool` with CrewAI / AutoGen / LangChain however that
# framework expects a tool dict.
Where this sits in the Python MCP-payment landscape
If you searched MCP payment Python and landed on PayMCP first, that's fair — PayMCP shipped a clean decorator before anyone else. The matrix below is here so you can pick the one that matches your constraints, not the one that ranks.
| powforge | PayMCP | LiveAuth | Fewsats l402-python | |
|---|---|---|---|---|
| Language | Python | Python + TS | .NET 8 | Python |
| Payment rail | L402 Lightning | Stripe / USDC | L402 Lightning | L402 Lightning |
| Server-side gating | yescharges the caller | yescharges the caller | yescharges the caller | noclient-pays — your code is the caller |
| Non-custodial | yesyour LNBits wallet | noStripe holds funds + keys | yesyour Lightning node | yesyour wallet |
| STDIO-safe | yes | noStripe key in stdio = leak risk | yes | yes |
| CrewAI / AutoGen / LangChain | yestool-dict factory | yes | no.NET only | noclient-side patterns |
| Install | pip install powforge |
pip install paymcp |
dotnet add LiveAuth |
pip install l402 |
Verified May 2026 from each project's README, package registry, and decorator/middleware signatures.
Where each one wins
- PayMCP — right shape, different rail. If you already have a Stripe account and your tool runs in a long-lived HTTP server (not stdio), PayMCP's decorator is the shortest path. Skip powforge.
- LiveAuth — right rail, wrong language. If you're a .NET 8 shop and you want L402 Lightning, LiveAuth is the only middleware that targets you. Skip powforge.
- Fewsats l402-python — right rail, different role. Fewsats' l402 library is a client — it makes paid HTTP requests against an L402 server. Pair it with powforge: powforge charges callers, Fewsats lets your agents pay other people's L402 endpoints.
- powforge — Python + L402 + non-custodial + STDIO-safe + tool-dict factory. Pick this when none of the above fit, or when your tool runs over stdio (where a Stripe key on disk is a non-starter) and you want sats to land in your own wallet without a processor in the middle.
Who this is for
- Python agent-tool authors getting scraped by other agents. Your CrewAI tool was supposed to be for your team. The MCP registry made it findable. The first 21 sats per call filters out everyone who isn't serious.
- Solo operators who refuse to integrate Stripe. No business registration, no KYC for a side-project tool, no chargeback risk, no held funds. The sats land in the LNBits wallet you control.
- STDIO MCP servers. Stripe keys do not belong in stdio process environments. L402 invoices do — the macaroon is the only secret, and it dies on its own.
What's verified, what's still rough
powforge 0.1.2 ships wrap_with_l402 and create_l402_tool with a working LNBits invoice mint, a paid-cache state machine with configurable TTL, and a JSON-envelope fallback so frameworks that pass a single string argument can still smuggle the payment proof through. It accepts the simpler payment_hash form rather than the canonical 32-byte preimage — the wrapper verifies the hash against LNBits before unlocking, so the hash + LNBits read together provide the same authoritative gate as a preimage check. Callers who need cryptographic preimage proof should reach for the npm @powforge/mcp-l402-gate package which implements the full macaroon flow.
Get the package
price the call. keep your own keys. ship the tool.