The Tavily MCP Load Balancer is a multi-API key load balancing server that supports both SSE and streamableHTTP interfaces, enabling automatic rotation between multiple API keys to provide higher availability and increased request limits.
# Quickly start using Docker Hub image (automatically matches architecture, supports amd64/arm64)
docker run -d \
--name tavily-mcp-lb \
-p 60002:60002 \
-e TAVILY_API_KEYS="your-key1,your-key2,your-key3" \
yatotm1994/tavily-mcp-loadbalancer:latest
# 1. Clone and install
git clone https://github.com/yatotm/tavily-mcp-loadbalancer.git
cd tavily-mcp-loadbalancer
npm install
# 2. Configure environment variables
cp .env.example .env
# Edit .env file and add your API keys
# 3. Start the service
npm run build-and-start
After starting, access:
http://localhost:60002/ssehttp://localhost:60002/mcphttp://localhost:60002/healthThe server provides 5 Tavily tools supporting search, content extraction, website crawling, and more:
| Tool Name | Description | Main Parameters |
|---|---|---|
search / tavily-search |
Web search | query, max_results, search_depth |
tavily-extract |
Web page content extraction | urls, extract_depth, format |
tavily-crawl |
Website crawler | url, max_depth, limit |
tavily-map |
Site map generation | url, max_depth, max_breadth |
# Initialize connection
curl -X POST http://localhost:60002/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "test-client", "version": "1.0.0"}
}
}'
# Get tool list
curl -X POST http://localhost:60002/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'
# Call the search tool
curl -X POST http://localhost:60002/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "search",
"arguments": {
"query": "OpenAI GPT-4",
"max_results": 3
}
}
}'
{
"name": "search",
"arguments": {
"query": "OpenAI GPT-4",
"search_depth": "basic",
"topic": "general",
"max_results": 10,
"start_date": "2024-01-01",
"end_date": "2024-12-31",
"country": "US",
"include_favicon": false
}
}
{
"name": "tavily-extract",
"arguments": {
"urls": ["https://example.com/article"],
"extract_depth": "basic",
"format": "markdown",
"include_favicon": false
}
}
{
"name": "tavily-crawl",
"arguments": {
"url": "https://example.com",
"max_depth": 2,
"max_breadth": 20,
"limit": 50,
"instructions": "Focus on technical content",
"select_paths": ["/docs", "/api"],
"select_domains": ["example.com"],
"allow_external": false,
"categories": ["technology"],
"extract_depth": "basic",
"format": "markdown",
"include_favicon": false
}
}
{
"name": "tavily-map",
"arguments": {
"url": "https://example.com",
"max_depth": 1,
"max_breadth": 20,
"limit": 50,
"instructions": "Map the main structure",
"select_paths": ["/"],
"select_domains": ["example.com"],
"allow_external": false,
"categories": ["general"]
}
}
# Test server status
./manage.sh stats
# Test all tools
./manage.sh test
# Batch test API keys
./manage.sh weather
| Variable Name | Description | Default Value |
|---|---|---|
TAVILY_API_KEYS |
API key list (comma-separated) | Required |
TAVILY_API_KEY |
Single API key | Optional |
SUPERGATEWAY_PORT |
Service port | 60002 |
# .env file
TAVILY_API_KEYS=tvly-dev-key1,tvly-dev-key2,tvly-dev-key3
SUPERGATEWAY_PORT=60002
| Issue | Solution |
|---|---|
| No available API keys | Check the TAVILY_API_KEYS environment variable |
| Connection timeout | Check network and firewall settings |
| Port in use | Use lsof -i :60002 to check port |
| SSE connection failure | Run node test_sse_validation.cjs |
# Check service status
curl http://localhost:60002/health
# Test connection
node check_stats_direct.cjs
# View logs
docker logs tavily-mcp-lb
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "tavily-mcp-loadbalancer" '{"command":"docker","args":["run","--rm","-p","60002:60002","-e","TAVILY_API_KEYS=${TAVILY_API_KEYS}","yatotm1994/tavily-mcp-loadbalancer:latest"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:
{
"mcpServers": {
"tavily-mcp-loadbalancer": {
"command": "docker",
"args": [
"run",
"--rm",
"-p",
"60002:60002",
"-e",
"TAVILY_API_KEYS=${TAVILY_API_KEYS}",
"yatotm1994/tavily-mcp-loadbalancer:latest"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"tavily-mcp-loadbalancer": {
"command": "docker",
"args": [
"run",
"--rm",
"-p",
"60002:60002",
"-e",
"TAVILY_API_KEYS=${TAVILY_API_KEYS}",
"yatotm1994/tavily-mcp-loadbalancer:latest"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect