mcpField
P
polygon-discovery

polygon-discovery

github.com/0xpolygonAgent workflows30102 installsUpdated 1d ago
Repository

About polygon-discovery

A skill for calling pay-per-request APIs in the Agentic Services marketplace using `x402-pay`. It covers live route discovery and Polygon USDC payments, with catalog examples spanning search, inference, browser sessions, email, and on-chain data.

Key features

  1. 01Read the live API route catalog
  2. 02Pay per call with Polygon USDC
  3. 03Automatically handle HTTP 402 payments
  4. 04Call search and scraping services
  5. 05Access inference, email, RPC, and wallet data

Use cases

  1. 01Find current routes and prices before a call
  2. 02Run a paid search or scraping request
  3. 03Pay for an inference or browser session
  4. 04Query wallet analytics through a provider

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/0xpolygon/polygon-agent-cli --skill polygon-discovery

After installing, type/polygon-discoveryin Claude Code to confirm it loaded.

Details

From the project README

Agentic Services (x402)

Pay-per-call APIs on the Agentic Services marketplace, gated by the x402 payment protocol on Polygon mainnet. No API keys or subscriptions — each call costs a small USDC amount drawn from your wallet. The CLI (x402-pay) detects the 402 response, signs the exact payment, and retries automatically.

  • Base URL: https://agent-discovery.polygon.org
  • Live catalog (source of truth): GET https://agent-discovery.polygon.org/api/discover/routes
  • Full provider docs: https://agent-discovery.polygon.org/SKILL.md

Always read the live catalog first. It returns every active route with its exact proxy path, method, price, and payTo address (CORS enabled, no payment required to read it). Prices and available services change — treat the catalog as authoritative and this file as orientation.


Prerequisites — check before any x402 call

Every call spends USDC from a funded Polygon wallet. Before running x402-pay:

agent wallet list        # is a wallet configured?

If no wallet is listed, set one up:

  1. agent wallet login: opens the agentconnect login page in the browser; sign in with Google or email (works on headless hosts too, no extra flags needed). No setup step is needed first: keys are defaulted, and login auto-provisions Builder credentials.
  2. agent wallet address: get the address, then fund it (agent fund)
  3. agent balances: confirm USDC is available on Polygon (chain 137) before calling any x402 endpoint

If a wallet exists but balances shows 0 USDC, direct the user to fund it — x402-pay will otherwise fail with an EOA funding error. All services settle in USDC on Polygon (0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359, chain id 137).


How to call a service

Use the full route URL from the catalog. Request bodies and query params mirror the upstream provider's own API.

# POST with a JSON body (e.g. Exa web search)
agent x402-pay \
  --url "https://agent-discovery.polygon.org/api/proxy/exa/search" \
  --wallet main --method POST \
  --body '{"query": "polygon agentic payments", "numResults": 5}'

# GET with query params (e.g. SearchApi Google search)
agent x402-pay \
  --url "https://agent-discovery.polygon.org/api/proxy/searchapi/google?q=<query>" \
  --wallet main --method GET

# Scrape a page to clean markdown (Firecrawl)
agent x402-pay \
  --url "https://agent-discovery.polygon.org/api/proxy/firecrawl/scrape" \
  --wallet main --method POST --body '{"url": "https://example.com"}'

# LLM inference (Llama 3.3 70B, OpenAI-compatible chat body)
agent x402-pay \
  --url "https://agent-discovery.polygon.org/api/proxy/nim/llama-3.3-70b/chat" \
  --wallet main --method POST \
  --body '{"messages": [{"role": "user", "content": "Summarize Polygon in one line."}]}'

Chain and token are auto-detected from the 402 response — no manual config.


Catalog

Prices are per call, in USDC, settling on Polygon (chain 137). All routes below are relative to the base URL https://agent-discovery.polygon.org.

Search, scraping & news (proxied)
ServiceMethodRoutePrice
Exa — AI web searchPOST/api/proxy/exa/search$0.001
SearchApi — Google searchGET/api/proxy/searchapi/google$0.001
Firecrawl — scrape to markdownPOST/api/proxy/firecrawl/scrape$0.002
NewsAPI — top headlinesGET/api/proxy/news/headlines$0.001
AI inference (proxied)
ServiceMethodRoutePrice
NVIDIA NIM — Llama 3.3 70B (chat)POST/api/proxy/nim/llama-3.3-70b/chat$0.01
NVIDIA NIM — Llama 3.2 90B Vision (image + chat)POST/api/proxy/nim/llama-3.2-vision/chat$0.01
OpenRouter — 200+ models (GPT, Claude, Gemini, Llama…)POST/api/proxy/openrouter/chat$0.01
Web automation & email (proxied)
ServiceMethodRoutePrice
Browserbase — cloud browser sessionPOST/api/proxy/browserbase/sessions$0.001
Resend — send transactional emailPOST/api/proxy/resend/send$0.005
On-chain data, email inboxes & RPC (external providers)

These are x402-native providers: you call their own endpoint URL directly (not a /api/proxy/* path), still settling in USDC on Polygon. x402-pay handles the 402 exactly the same way. Pass the full URL below as --url.

QuickNode RPC — $0.001/call, POST standard JSON-RPC. URL pattern https://x402.quicknode.com/<chain>/:

Chain<chain> slugChain<chain> slug
Polygonmatic-mainnetOptimismoptimism-mainnet
Polygon Amoymatic-amoyAvalancheavalanche-mainnet
Polygon zkEVMzkevm-mainnetBSCbsc-mainnet
Basebase-mainnetLinealinea-mainnet
Ethereumethereum-mainnetScrollscroll-mainnet
Solanasolana-mainnetSuisui-mainnet
Arbitrumarbitrum-mainnetTONton-mainnet
Bitcoinbtc-mainnetTrontron-mainnet
agent x402-pay \
  --url "https://x402.quicknode.com/matic-mainnet/" \
  --wallet main --method POST \
  --body '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Allium — on-chain wallet analytics — base https://agents.allium.so/api/v1/developer/:

EndpointMethodFull URLPrice
Wallet balancesPOST…/wallet/balances$0.03
Wallet PnLPOST…/wallet/pnl$0.03
Wallet transactionsPOST…/wallet/transactions$0.03
Wallet balances historyPOST…/wallet/balances/history$0.01
Prices (latest)POST…/prices$0.02
Prices at timestampPOST…/prices/at-timestamp$0.02
Prices historyPOST…/prices/history$0.02
Tokens listGET…/tokens$0.03
Tokens searchGET…/tokens/search$0.03

AgentMail — email inbox for the agent — $2/call, base https://x402.api.agentmail.to/v0/inboxes:

EndpointMethodFull URL
Create inboxPOSThttps://x402.api.agentmail.to/v0/inboxes
List messagesGET…/{inbox_id}/messages
Get messageGET…/{inbox_id}/messages/{message_id}
Send messagePOST…/{inbox_id}/messages/send
Reply messagePOST…/{inbox_id}/messages/{message_id}/reply
List threadsGET…/{inbox_id}/threads

How x402 works

  1. CLI sends the request to the endpoint.
  2. Endpoint responds with HTTP 402 Payment Required + payment details (price, asset, network, payTo).
  3. CLI signs an EIP-3009 transferWithAuthorization for the exact amount from the wallet.
  4. CLI retries the request with the payment header.
  5. Endpoint verifies, calls the upstream API, returns the response; the settlement tx hash comes back in the PAYMENT-RESPONSE header.

The whole flow is transparent to the agent. Chain and token are auto-detected from the 402 response. Do not guess endpoints or search the web for providers — read the live catalog (/api/discover/routes) for the correct, current URLs and prices.

Comments

Markdown supported