491 字
2 分钟
Build a Free Multi-Key Tavily MCP Proxy with Cloudflare Workers

Combine multiple Tavily API keys into a single pool shared by AI clients like Claude and Cursor, with automatic quota rotation, automatic skipping of exhausted keys, and web-based management.

What is this?#

Tavily is a very useful AI search API and also offers an MCP service that lets Claude and Cursor call search tools directly. However, each API key has its own independent, limited search quota — one key isn’t enough, and handing out keys to multiple clients feels unsafe.

This project puts multiple Tavily keys into a “pool” and exposes a single MCP endpoint. You just configure it like a normal Tavily MCP; actual calls are automatically distributed evenly across all keys in the pool:

  • Exhausted keys are automatically skipped and restored the next month
  • Rate-limited keys are automatically cooled down and swapped for the next one
  • Invalid keys are automatically removed
  • One-click web management to add / delete / view all keys

Deployment (about 5 minutes)#

Prerequisites: a Cloudflare account and one or more Tavily API keys.

  1. Open the project repository and click Deploy to Cloudflare Workers for one-click deployment (or run npx wrangler deploy locally)
  2. Create a KV namespace in the Cloudflare dashboard
  3. Go to Worker → SettingsBindings, add a KV binding with the variable name KV, pointing to the namespace you just created
  4. SettingsVariables → add an encrypted variable AUTH_KEY (this is the login password for the admin panel and API — use any custom value)
  5. Trigger a Redeploy to apply the configuration
  6. Open https://your-worker-url/admin, log in with AUTH_KEY, add your Tavily key, done

Everything runs within the free tier, at no cost.

Connecting to AI clients#

Using mcp-remote as an example (works with Cursor and Claude Desktop):

{
"mcpServers": {
"tavily-proxy": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-worker-url/mcp", "--header", "x-api-key:your-AUTH_KEY"]
}
}
}

Once configured, you can use the search feature in your client, and the quota of all keys in the pool is shared by all clients.

Daily usage#

  • Admin panel: Open /admin in a browser. After logging in, you can view the status of all keys (OK / exhausted / cooling down), whether quota remains, add/delete keys, write notes for keys, and manually sync quotas. The login state is remembered, so you don’t need to re-enter it on refresh.
  • When adding a key: You can fill in a note (e.g. “work account”, “shared with friends”) to tell them apart easily.
  • CLI management (optional):
    • Add a key: POST /api/keys with body {"apiKey": "tvly-xxx"}
    • View the list: GET /api/keys
    • Force sync quotas: POST /api/keys/sync
    • Delete: DELETE /api/keys
    • All endpoints except /admin and health checks require the x-api-key: your-AUTH_KEY header.

FAQ#

  • Quota display inaccurate? Quota is for display only; the actual health is automatically determined by the status returned from Tavily (432=exhausted, 429=rate-limited, 401/403=invalid) and is handled automatically.
  • Workspace not on Cloudflare? That’s totally fine — it’s deployed on Cloudflare, and any client that can reach HTTPS works.
  • Will keys be exposed? Keys are masked in the panel and list, and clients only receive the proxy address — they can’t see the real keys.

Project address: https://github.com/Tokisaki-Galaxy/tavily-proxy

If you find it useful, feel free to Star it ⭐

Build a Free Multi-Key Tavily MCP Proxy with Cloudflare Workers
https://tski.uk/blog/en/mcp-tavily-proxy/
作者
Tokisaki Galaxy
发布于
2026-07-31
许可协议
CC BY