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 • Edited 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 14,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": {
         "EVM_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
Enter fullscreen mode Exit fullscreen mode

Update — March 2026: OpenAI Agents SDK example

x402search now works as an MCP server inside OpenAI Agents SDK. Your agent
can discover paid APIs at runtime — no hardcoded endpoints.

Full working example: https://github.com/x402-index/x402search-agent-example

Proof of payment on-chain: 0x1148ce8c7bf8793ab5a74896e3a850bcf7400cd6502225c15f4f896d59fa3af8

 ## 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

Update: Use x402search with OpenAI Agents SDK

If you're building with OpenAI Agents SDK, you can add x402search as an MCP
server and let your agent discover paid APIs at runtime — no hardcoded endpoints.

Full example repo: https://github.com/x402-index/x402search-agent-example

The agent:

  1. Connects to x402search as an MCP server
  2. Searches for APIs matching its task ("crypto market data", "web scraping", etc.)
  3. Pays $0.01 USDC automatically from its Base wallet
  4. Gets back endpoint URLs, descriptions, and pricing

Proof it works — on-chain payment tx:
0x1148ce8c7bf8793ab5a74896e3a850bcf7400cd6502225c15f4f896d59fa3af8

Install:
\


bash
git clone https://github.com/x402-index/x402search-agent-example
cd x402search-agent-example
pip3.11 install -r requirements.txt
cp .env.example .env  # add your OpenAI key + EVM private key
python3.11 main.py
\`\`\`
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
socialinteldev profile image
Sebastian Wallinstabot project

Hey — we run Social Intel (api.socialintel.dev), an x402-native Instagram influencer search API on Base mainnet. $0.003/request, USDC. How do we get listed in x402search? Happy to share our server-card.json endpoint.

Collapse
 
x402index profile image
x402 Discovery Index

Hey — two ways to get listed: (1) If you're already registered on CDP Bazaar, you'll be auto-indexed within 2 hours. (2) If not, share your server-card.json URL and endpoint and we'll add you manually. Either way, drop the details here or at discoveryindex402@gmail.com and we'll confirm once you're live in search.