paid-search-mcp
v0.1.2
Published
Paid MCP, agents pay $0.005 USDC per web search via spawnpay-paywall
Maintainers
Readme
paid-search-mcp
Pay-per-call web search MCP. Each web_search call charges the calling agent
$0.005 USDC via spawnpay, settled instantly on Base L2.
Built with spawnpay-paywall — the actual paywall is two lines.
What it shows
The paywall pattern: any async function can become a paid endpoint by
wrapping it. The MCP itself doesn't change. The backend doesn't change.
A single paywall(...) wrapper turns a free tool into a metered one with
USDC settlement.
const webSearch = paywall(
{ price: 0.005, vendor: 'SP_xxxx', description: 'web_search' },
webSearchImpl,
);That's it. Calls go through, payment settles, results return.
Run
npx paid-search-mcpCaller env:
export SPAWNPAY_API_KEY=spk_live_... # the agent paying for searchesGet a key + free $5 credit at https://spawnpay.ai.
Vendor (you, the MCP author) defaults to the demo vendor. To collect into your own wallet, set:
export VENDOR_SP_CODE=SP_yourCodeMCP client config
{
"mcpServers": {
"paid-search": {
"command": "npx",
"args": ["paid-search-mcp"],
"env": { "SPAWNPAY_API_KEY": "spk_live_..." }
}
}
}Backends
Default backend is wiki+hn (Wikipedia + Hacker News). No auth required,
works out of the box. Swap to a real web-search provider via env:
| SEARCH_BACKEND | Required env | Notes |
|------------------|--------------------|-----------------------------|
| wiki+hn | — | Default. Free, no auth. |
| wiki | — | Wikipedia only. |
| hn | — | Hacker News only. |
| brave | BRAVE_API_KEY | Brave Search API. |
| tavily | TAVILY_API_KEY | Tavily (AI-optimized). |
| serper | SERPER_API_KEY | google.serper.dev. |
The MCP code doesn't change — only the env. Pricing logic stays the same: you charge agents per call, you cover whatever the upstream search API costs.
Pricing knob
export PRICE=0.01 # default 0.005Smoke test
SMOKE_CALLER_KEY=spk_live_... node test-smoke.mjsSpends $0.005 from the caller agent, settles to the demo vendor, prints results. Use a key with at least $0.01 unlocked credit.
