Tavily MCP Load Balancer
The Tavily MCP Load Balancer is a high-availability gateway that provides intelligent load balancing across multiple Tavily API keys with web-based management and multi-protocol access.
Core Capabilities:
Advanced Web Search (
tavily-search/search): Real-time web searches with customizable depth (basic/advanced), topic filtering (general/news), time-range constraints, country boosting, and domain inclusion/exclusionContent Extraction (
tavily-extract): Extract and parse web content from URLs in markdown or plain text format with configurable extraction depthWeb Crawling (
tavily-crawl): Systematically crawl websites with configurable depth, breadth, category filtering, path selection via regex, and natural language instructionsSite Mapping (
tavily-map): Generate structured maps of website architectures to analyze site organization and navigation pathsIntelligent Load Balancing: Distributes requests across multiple API keys using round-robin and weighted scheduling with automatic key rotation and failover
Smart Error Handling: Automatically detects and handles rate limits, quota exhaustion, and authentication errors
Web Management Dashboard: Manage API keys with encrypted storage, monitor real-time usage statistics via WebSocket, review request logs (30-day retention), and configure settings
Multi-Protocol Support: Access via MCP stdio, SSE (Server-Sent Events), or streamableHTTP (JSON-RPC) interfaces
Data Persistence: SQLite database with encrypted storage for API keys, quotas, and logs with automatic monthly quota refresh at UTC boundaries
Flexible Deployment: Docker support for linux/amd64 and linux/arm64 architectures with configurable concurrency limits, timeouts, and operational parameters
Supports environment variable configuration for API keys and server settings through .env files
Built on Node.js runtime to provide high-performance MCP server capabilities
Uses npm for package management and script execution
Developed using TypeScript for type-safety and modern JavaScript features
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Tavily MCP Load Balancersearch for latest AI developments in 2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tavily MCP Load Balancer
一个支持多 API 密钥负载均衡的 Tavily MCP 服务器,提供 SSE 和 streamableHTTP 接口,自动轮询多个 API 密钥以实现高可用性。
v3.0.0 (2025-01-06)
官方 MCP 对齐:完整适配 tavily-mcp v0.2.12 工具参数与行为
智能错误处理:精细区分配额耗尽、速率限制与网络问题
持久化存储:SQLite 存储 API Key、配额与请求日志
Web 管理后台:可视化管理 Key、统计、日志与设置
自动配额刷新:UTC 自然月自动更新配额状态
v2.2.0 (2025-08-15)
多架构镜像:linux/amd64 与 linux/arm64
v2.1.0 (2025-08-14)
streamableHTTP 支持:HTTP POST /mcp 端点
多协议兼容:SSE + streamableHTTP
v2.0.0 (2025-08-12)
架构重构:原生 SSE 实现
工具更新:新增 tavily-crawl 和 tavily-map
安全改进:响应数据清理和字符编码处理
v1.0.0 (2025-08-05)
初始版本:多 API 密钥负载均衡
功能特性
智能负载均衡 — 轮询 + 权重调度,多 Key 高可用
错误分级处理 — 速率限制 / 配额耗尽 / 鉴权错误精确识别
多协议支持 — MCP stdio / SSE / streamableHTTP 全覆盖
数据持久化 — SQLite 存储 Key、配额与日志
Web 管理后台 — Dashboard、Key 管理、统计、日志、设置
实时更新 — WebSocket 推送统计刷新
数据安全 — Key 加密存储 + 脱敏展示
Related MCP server: tavily-search-mcp-server
快速开始
Docker 部署(推荐)
docker run -d \
--name tavily-mcp-lb \
-p 60002:60002 \
-e DATABASE_ENCRYPTION_KEY="your-32-byte-random-key" \
-e ADMIN_PASSWORD="optional-admin-password" \
-e TAVILY_API_KEYS="your-key1,your-key2,your-key3" \
yatotm1994/tavily-mcp-loadbalancer:latest镜像支持 amd64 / arm64,Docker 会自动匹配本机架构。
本地开发
# 1. 克隆并安装
git clone https://github.com/yatotm/tavily-mcp-loadbalancer.git
cd tavily-mcp-loadbalancer
npm install
# 2. 配置环境变量
cp .env.example .env
# 编辑 .env,设置 DATABASE_ENCRYPTION_KEY(必填)与 ADMIN_PASSWORD(可选)
# 3. 启动服务
npm run build-and-start服务启动后访问:
端点 | 地址 |
管理后台 |
|
SSE 接口 |
|
streamableHTTP |
|
API |
|
WebSocket |
|
首次启动后在管理后台添加 API Key。环境变量
TAVILY_API_KEYS仅用于初始导入。
Docker Compose
git clone https://github.com/yatotm/tavily-mcp-loadbalancer.git
cd tavily-mcp-loadbalancer
cp .env.example .env
docker-compose up -d
docker-compose logs -f自定义构建
docker build -t tavily-mcp-loadbalancer .
docker run -d --name tavily-mcp-lb -p 60002:60002 \
-e TAVILY_API_KEYS="key1,key2" tavily-mcp-loadbalancer开发模式
npm run start-gateway # HTTP + UI
npm run dev # MCP stdio
./start.sh # 脚本启动可用工具
工具名称 | 功能描述 | 主要参数 |
| 网络搜索 | query, max_results, search_depth |
| 网页内容提取 | urls, extract_depth, format |
| 网站爬虫 | url, max_depth, limit |
| 网站地图生成 | url, max_depth, max_breadth |
接口说明
接口 | 地址 |
SSE |
|
消息 |
|
streamableHTTP |
|
健康检查 |
|
streamableHTTP 示例
# 初始化
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"}
}
}'
# 获取工具列表
curl -X POST http://localhost:60002/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'
# 调用搜索
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}
}
}'工具参数
search / tavily-search
{
"query": "OpenAI GPT-4",
"search_depth": "basic",
"topic": "general",
"max_results": 10,
"country": "united states"
}tavily-extract
{
"urls": ["https://example.com/article"],
"extract_depth": "basic",
"format": "markdown"
}tavily-crawl
{
"url": "https://example.com",
"max_depth": 2,
"limit": 50,
"extract_depth": "basic"
}tavily-map
{
"url": "https://example.com",
"max_depth": 1,
"limit": 50
}配置
环境变量
变量名 | 描述 | 默认值 |
| 服务端口 | 60002 |
| 绑定地址 | 0.0.0.0 |
| 数据库路径 | ./data/tavily.db |
| 加密密钥(必填) | - |
| 管理后台密码 | - |
| 启用 Web UI | true |
| 最大并发 | 4 |
| 请求超时(ms) | 30000 |
| Key 最大错误次数 | 5 |
| 日志保留天数 | 30 |
| 日志级别 | info |
| 初始 Key(逗号分隔) | - |
配置示例
# .env
PORT=60002
DATABASE_ENCRYPTION_KEY=your-32-byte-random-key
ADMIN_PASSWORD=optional-password
TAVILY_API_KEYS=tvly-key1,tvly-key2故障排除
问题 | 解决方案 |
无可用 API 密钥 | 在管理后台检查 Key 状态和配额 |
连接超时 | 检查网络和防火墙设置 |
端口被占用 |
|
# 健康检查
curl http://localhost:60002/health
# 查看日志
docker logs tavily-mcp-lb建议在 Web 管理后台查看请求统计、错误日志与 Key 状态。
许可证
MIT License
如果这个项目对你有帮助,欢迎 Star ⭐
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yatotm/tavily-mcp-loadbalancer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server