mcp-pool
Pools multiple API keys for upstream MCP servers to distribute rate limits and provide automatic failover on rate limiting or errors.
README
mcp-pool
MCP Key Pool Proxy — pool multiple API keys across upstream MCP servers to distribute rate limits.
How it works
mcp-pool is itself an MCP server. You configure one or more "pools" — each pool represents one upstream MCP server type (e.g. Brave Search) with N API keys.
- 1 subprocess per pool at a time, not per key. No warm standby processes.
- On rate-limit or transport error, the current upstream is closed and a new one spawns with the next key (~1-2s failover).
- Tools are exposed with
{poolName}__prefix to avoid name collisions. - Route calls are serialized via a promise-chain mutex to prevent state races.
Config
pools:
brave-search:
command: bunx
args: ["-y", "@brave/brave-search-mcp-server"]
keys:
- {BRAVE_API_KEY: "sk-first"}
- {BRAVE_API_KEY: "sk-second"}
rateLimitPatterns:
- "rate_limit_exceeded"
- "too many requests"
| Field | Description |
|---|---|
command |
Executable to spawn (required) |
args |
CLI arguments |
keys |
Array of environment-variable objects, one per key (at least 1); values may be literal strings or ${NAME} references |
rateLimitPatterns |
Regex patterns matched against tool error text (required, at least 1 — safety gate) |
cooldownSeconds |
Seconds a rate-limited key is skipped; defaults to 300 |
cwd |
Working directory for the upstream process |
Config paths (first found wins): --config <path>, ./mcp-pool.yaml, ./.mcp-pool.yaml, ~/.config/mcp-pool/mcp-pool.yaml.
Values support ${VAR} expansion from environment variables. An undefined reference is a configuration error.
Usage
{
"mcpServers": {
"mcp-pool": {
"command": "bunx",
"args": ["mcp-pool@0.1.4", "--config", "/path/to/mcp-pool.yaml"]
}
}
}
Tool names are prefixed: brave-search__brave_web_search. The client calls the prefixed name; mcp-pool strips the prefix and routes to the correct upstream.
Pass --verbose for per-request trace logs.
Logging
All logs are JSON lines on stderr (stdout is reserved for MCP protocol):
{"ts":"...","level":"info","pool":"brave-search","event":"upstream_start","keyIndex":0}
{"ts":"...","level":"warn","pool":"brave-search","event":"rate_limited","upstream":0}
{"ts":"...","level":"error","pool":"brave-search","event":"upstream_error","upstream":0,"error":"..."}
Design
- Lazy failover: 1 process per pool. Rate-limited/crashed keys are closed and replaced with the next key on demand; rate-limited keys are skipped for
cooldownSeconds(300 seconds by default). - Serialized calls: promise-chain mutex prevents races on shared state across
awaitpoints. - Tool validation: each spawned upstream's tools are validated against the cached set (by name→schema map, order-independent).
rateLimitPatternsis required: without explicit patterns, allisErrorresults are terminal — no retries. Use[".*"]for blanket retry on read-only pools.- Stdio upstreams only: upstream MCP servers are spawned as subprocesses.
Development
bun install --frozen-lockfile
bun run typecheck
bun run test
bun run smoke
bun run build
bun run check:package
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.