DEV Community

Cover image for I built a pay-per-search API discovery engine — no API keys, just crypto (x402)
x402 Discovery Index
x402 Discovery Index

Posted on

I built a pay-per-search API discovery engine — no API keys, just crypto (x402)

AI agents are getting good at calling APIs. The problem is they still need a human in the loop to find the right API, sign up for an account, generate a key, fund a balance, and paste credentials into
a config file. That's fine for a one-time integration — but it's a complete non-starter for an autonomous agent that needs to discover and use new APIs on the fly.

 I wanted to fix that. Here's what I built.

 ## The problem

 When an agent needs a capability it doesn't have — weather data, image generation, price feeds, web scraping — it has no good way to go find a paid API on its own. Every API monetization model today
 assumes a human is doing the signup. There's no standard way for a machine to say "I want this capability, here's payment, give me the result."

 That's the gap I'm trying to close.

 ## What is x402?

 x402 is an open protocol that brings the [HTTP 402 Payment Required](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402) status code to life. When a client hits an x402-enabled endpoint without
  paying, the server returns a `402` with a machine-readable payment request. The client pays on-chain (USDC on Base mainnet, typically), attaches a payment proof header, and retries — all in a single
 round-trip. No accounts, no API keys, no dashboards. Just a wallet and an HTTP client.

 ## What x402search does

 [x402search](https://x402search.xyz) is a discovery engine for x402-enabled APIs. It indexes 13,000+ APIs across the x402 ecosystem and exposes them via an MCP (Model Context Protocol) tool that Claude,
 Cursor, Windsurf, and any MCP-compatible agent can call natively.

 Each search costs **$0.01 USDC** on Base mainnet — paid automatically by the agent using the x402 protocol. No signup. No rate limit tiers. No API key to rotate. The agent pays for what it uses, finds
 what it needs, and moves on.

 The search tool understands natural language queries and supports filters for network (`eip155:8453` for Base) and max price. Results come back with endpoint URLs, descriptions, pricing, and the payment
 metadata needed to actually call the API.

 ## Install in 2 lines

 Add this to your MCP config (Claude Desktop, Cursor, Windsurf, etc.):
Enter fullscreen mode Exit fullscreen mode
 ```json
 {
   "mcpServers": {
     "x402search": {
       "command": "npx",
       "args": ["-y", "x402search-mcp"],
       "env": {
         "WALLET_PRIVATE_KEY": "<YOUR_PRIVATE_KEY>"
       }
     }
   }
 }
 ```
Enter fullscreen mode Exit fullscreen mode
 Your wallet needs a small amount of USDC on Base mainnet. At $0.01 per search, $1 gets you 100 queries. The MCP server handles payment automatically — the agent just calls `search_x402_apis` with a query
  string.

 ## How it works under the hood

 When the agent calls `search_x402_apis`, the MCP server sends a POST to `https://x402search.xyz/v1/search`. The server returns a `402` with a payment request: network `eip155:8453`, amount `10000` (0.01
 USDC in 6-decimal format), recipient address, and a nonce.

 The x402 client library signs and submits a USDC transfer on Base mainnet, attaches the `X-Payment` header with the proof, and retries the request. The server verifies the on-chain payment and returns
 the search results. The whole flow is a couple of seconds — no polling, no webhooks.

 Under the hood the MCP server uses `@x402/axios` to wrap a standard Axios instance, `@x402/evm` to handle the EVM signing with `viem`, and `@modelcontextprotocol/sdk` to expose the tool over stdio. The
 private key stays local — it never leaves the agent's environment.

 ## Current status

 The indexer is live and running against the [CDP Bazaar](https://github.com/coinbase/cdp-bazaar) dataset with 12,845+ resources indexed. The search API is running on Base mainnet and accepting real
 payments. The MCP package is published on npm.

 What's next:
 - Broader index coverage beyond CDP Bazaar
 - Keyword + semantic hybrid search
 - An agent that can not just *find* APIs but autonomously compose multi-step workflows across them
 - A public leaderboard of the most-queried capabilities

 ## Try it

 The package is on npm: [x402search-mcp](https://www.npmjs.com/package/x402search-mcp)

 Source is on GitHub: [x402-index/x402search-mcp](https://github.com/x402-index/x402search-mcp)

 Live index at: [x402search.xyz](https://x402search.xyz)

 If you're building with MCP or exploring the x402 ecosystem, drop a star and let me know what you're working on. I'm especially curious about use cases where agents need to *compose* multiple paid APIs
 in a single task — that's where this gets interesting.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)