apipay-mcp

v0.3.3
apipay-mcp Checked 3 days ago Published 3 months ago

Give your AI agent a prepaid balance for API calls: search the web, fetch a URL, and pay for APIs mid-conversation.

Give your AI agent a prepaid balance it can spend on API calls. One top-up, no per-provider signups, no key management: the agent discovers APIs, calls them, and pays per call from the balance — mid-conversation. Four tools: search_apis, call_api, check_balance, get_vault_link. When the balance runs out, the agent receives a machine-readable payment link to hand to you. New accounts start with 500 trial credits (1 credit = $0.01).

Summary extracted from the README.

apipay-mcp

Give your AI agent a prepaid balance it can spend on API calls. One top-up, no per-provider signups, no key management: the agent discovers APIs, calls them, and pays per call from the balance — mid-conversation.

Four tools: search_apis, call_api, check_balance, get_vault_link. When the balance runs out, the agent receives a machine-readable payment link to hand to you.

1. Get a token (shown once)

curl -X POST https://apipay.fly.dev/v1/signup \
  -H "content-type: application/json" \
  -d '{"email":"you@example.com"}'

New accounts start with 500 trial credits (1 credit = $0.01).

2. Install

Claude Code

claude mcp add apipay -e APIPAY_TOKEN=<your-token> -- npx -y apipay-mcp

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "apipay": {
      "command": "npx",
      "args": ["-y", "apipay-mcp"],
      "env": { "APIPAY_TOKEN": "<your-token>" }
    }
  }
}

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "apipay": {
      "command": "npx",
      "args": ["-y", "apipay-mcp"],
      "env": { "APIPAY_TOKEN": "<your-token>" }
    }
  }
}

3. Use it

First ask (no user key):

search the web for X

The agent will search_apis, then call_api with slug dataforseo and {q} (count/country/language optional). That path is resold — live Google via DataForSEO SERP, 0.3 credits, no user search key. Do not ask for a Brave key unless the user wants the BYOK web-search slug.

Second no-key: fetch a URL. slug scrape with {url} (0.3 credits) — DataForSEO On-Page markdown, no user scrape key. Do not ask for a ScrapingBee key unless the user wants the BYOK scrapingbee slug.

Weather is the cheap third no-key demo: slug open-meteo (0.1 credits). Ask "what's the weather in London" ({lat, lon, forecast?}, London is ~51.51, -0.13). Do not ask for an Open-Meteo or OpenWeather key unless the user wants the BYOK weather slug. Open-Meteo results include attribution (CC BY 4.0); keep Weather data by Open-Meteo.com next to any weather you display.

The per-call cost and remaining balance come back with every result. Top up any time at the link check_balance returns. For BYOK catalog APIs, use get_vault_link so the key never transits chat.

Env vars: APIPAY_TOKEN (required), APIPAY_BASE_URL (optional override, defaults to the hosted gateway).

If your token leaks

Rotate it immediately — the old token stops working the instant the new one is issued; your balance, account id, and vaulted keys are untouched:

curl -X POST https://apipay.fly.dev/v1/token/rotate \
  -H "Authorization: Bearer <your-current-token>"

The response contains your new token (shown once). Update APIPAY_TOKEN in your MCP config afterwards. You can also remove a vaulted provider key at any time with DELETE /v1/keys/<provider-slug> using the same auth header.