Skip to main content
Glama
pzehrel

tavily-proxy-mcp

by pzehrel

tavily-proxy-mcp

Tavily 官方 MCP 的多 API Key 工具代理。

它将 Tavily 上游提供的工具定义、参数和调用结果转发给 Agent,并负责管理多个 API Key。当当前 Key 的额度耗尽、受到限流或失效时,代理会自动切换到下一个 Key, 无需修改 Agent 的提示词或工具调用方式。

快速开始

准备工作

  • Node.js 22 或更高版本;

  • 一个或多个 Tavily API Key。

不需要全局安装,MCP 客户端会通过 npx 自动下载和运行。

添加 MCP 配置

将下面的配置加入你的 MCP 客户端,并替换其中的 Key:

{
  "mcpServers": {
    "tavily": {
      "command": "npx",
      "args": ["-y", "tavily-proxy-mcp"],
      "env": {
        "TAVILY_API_KEYS": "tvly-key1,tvly-key2,tvly-key3"
      }
    }
  }
}

多个 Key 使用英文逗号分隔,并按填写顺序使用:

tvly-key1 → tvly-key2 → tvly-key3

保存配置并重启 MCP 客户端后,即可像使用 Tavily 官方 MCP 一样使用搜索、抓取、 站点地图、爬取和研究等工具。

Related MCP server: tavily-pool-mcp

它是如何切换 Key 的

本工具不会轮询分摊请求,也不会在启动时初始化所有 Key。

  1. 启动时只连接第一个可用 Key。

  2. 正常请求持续使用当前 Key。

  3. 当前 Key 明确额度耗尽、失效或受到限流时,才连接下一个 Key。

  4. 导致切换的工具调用会在新 Key 上重试。

  5. 多个请求同时遇到额度问题时,只会执行一次切换。

以下情况不会切换 Key:

  • Tavily 服务端临时出现 5xx;

  • 网络连接失败或超时;

  • 工具参数错误;

  • 用户取消调用。

与 Tavily 官方 MCP 的兼容性

工具列表和参数定义由 Tavily 官方 MCP 动态提供,本项目不写死具体工具。

这意味着 Tavily 修改工具描述、参数 Schema 或增加工具时,客户端可以通过代理获取 更新后的定义。代理只负责 stdio/HTTP 协议桥接、Key 管理和故障切换。

配置项

TAVILY_API_KEYS

必填。逗号分隔的 Tavily API Key:

TAVILY_API_KEYS=tvly-key1,tvly-key2,tvly-key3

首尾空白会被去除,重复 Key 会被忽略。

TAVILY_MCP_URL

可选。默认连接:

https://mcp.tavily.com/mcp/

通常不需要修改。

TAVILY_PROXY_LOG_LEVEL

可选,默认值为 info。可选值:

error
warn
info
debug

排查连接或切换问题时可以设为 debug。日志不会输出完整 API Key。

TAVILY_RESET_GRACE_SECONDS

可选,默认值为 900 秒。

Tavily 说明月度额度在每月第一天重置,但 Usage API 不提供精确重置时刻。本工具会在 下个月 UTC 1 日 00:00 后等待该缓冲时间,再检查旧 Key 是否恢复额度。

状态缓存

代理需要记住当前 Key、已耗尽 Key 和预计恢复时间。状态文件存放在系统临时目录:

<系统临时目录>/tavily-proxy-mcp-<用户ID>/state.json

例如:

/tmp/tavily-proxy-mcp-1000/state.json

状态文件只保存 Key 的 SHA-256 指纹,不保存明文 Key。

临时目录被系统清理后,代理会从第一个 Key 重新检查和使用,不影响 Key 本身。

常见问题

提示 TAVILY_API_KEYS must contain at least one key

MCP 客户端没有成功注入 TAVILY_API_KEYS,或者变量内容为空。检查 JSON 配置以及 Key 之间是否使用英文逗号。

所有 Key 都不可用

检查 Tavily Dashboard 中各 Key 的有效性和账户剩余额度。错误信息会包含代理估算的 最早恢复时间。

为什么网络错误时不切换 Key

网络错误与 Key 额度无关。贸然切换并重试可能造成请求重复执行或重复计费,因此代理 只对明确的 Key 级错误进行切换。

为什么 HTTP 429 不一定代表月度额度耗尽

429 也可能只是短时速率限制。代理会检查错误内容;含义不明确时,会调用 Tavily Usage API 判断应该短暂冷却还是等待月度重置。

如何查看详细日志

在 MCP 配置的 env 中加入:

{
  "TAVILY_PROXY_LOG_LEVEL": "debug"
}

安全说明

  • API Key 仅通过环境变量传入;

  • 状态文件不保存明文 Key;

  • 日志会脱敏 tvly- 格式的 Key;

  • stdout 仅用于 MCP 协议,诊断日志写入 stderr;

  • 不要把包含真实 Key 的 MCP 配置提交到公开仓库。

开发

项目使用 TypeScript 和 pnpm:

pnpm install
pnpm check
pnpm build

本地开发:

TAVILY_API_KEYS=tvly-your-key pnpm dev

版本变更见 CHANGELOG.md

贡献与提交规范见 CONTRIBUTING.md

License

MIT

Available Tools

5 tools
tavily_crawlA
Read-only

Crawl a website starting from a URL. Extracts content from pages with configurable depth and breadth.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe root URL to begin the crawl
limitNoTotal number of links the crawler will process before stopping
formatNoThe format of the extracted web page content. markdown returns content in markdown format. text returns plain text and may increase latency.markdown
max_depthNoMax depth of the crawl. Defines how far from the base URL the crawler can explore.
max_breadthNoMax number of links to follow per level of the tree (i.e., per page)
instructionsNoNatural language instructions for the crawler. Instructions specify which types of pages the crawler should return.
select_pathsNoRegex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)
extract_depthNoAdvanced extraction retrieves more data, including tables and embedded content, with higher success but may increase latencybasic
allow_externalNoWhether to return external links in the final response
select_domainsNoRegex patterns to restrict crawling to specific domains or subdomains (e.g., ^docs\.example\.com$)
include_faviconNoWhether to include the favicon URL for each result

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and openWorldHint, and the description adds no extra behavioral context such as crawl limits, latency, robots.txt handling, or result pagination. The mention of 'depth and breadth' simply reflects parameter semantics, not behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is exceptionally concise—two short sentences that immediately convey the tool's core function. No redundant words or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having 11 parameters and a related output schema, the description offers only a high-level overview. It does not discuss configuration scenarios, limitations, or typical use cases. The thorough schema and output schema partially compensate, but the description alone is insufficient for an agent to understand the tool's full range and trade-offs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with descriptive parameter definitions (e.g., limit, format, max_depth). The description adds no additional meaning beyond what the schema provides, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states a specific action ('Crawl a website starting from a URL') with a clear resource and scope. It also mentions extract content and configurable depth/breadth, distinguishing it from sibling tools like tavily_search and tavily_extract.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for full-site crawling from a root URL, but does not explicitly state when to prefer it over alternatives such as tavily_extract or tavily_search. No exclusions or 'when-not-to-use' guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tavily_extractA
Read-only

Extract content from URLs. Returns raw page content in markdown or text format.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlsYesList of URLs to extract content from
queryNoQuery to rerank content chunks by relevance
formatNoOutput formatmarkdown
extract_depthNoUse 'advanced' for LinkedIn, protected sites, or tables/embedded contentbasic
include_imagesNoInclude images from pages
include_faviconNoInclude favicon URLs

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, so the tool's non-destructive nature is known. The description adds the output format (markdown/text) but does not disclose potential failure modes, rate limits, or handling of protected pages. It adds modest context beyond annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences with no filler or redundancy, front-loading the primary action ('Extract content from URLs') before stating the return format. It is highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the rich input schema (full parameter descriptions), output schema, and safety annotations, the description is largely sufficient. However, it lacks usage differentiation from sibling tools and omits any mention of when advanced extraction depth is needed, though those are partially covered by the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with each parameter described, including enums for format and extract_depth. The description adds no additional semantics beyond the schema, so it meets the baseline but does not elevate it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Extract content from URLs' and specifies the return format (markdown or text). This distinguishes it from siblings like search (which queries) and crawl (which follows links), focusing on explicit URL inputs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use extract versus alternatives like tavily_crawl or tavily_search. It does not mention exclusion criteria or the specific use case of extracting from known URLs, leaving the agent to infer appropriate usage from the tool name and schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tavily_mapA
Read-only

Map a website's structure. Returns a list of URLs found starting from the base URL.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYesThe root URL to begin the mapping
limitNoTotal number of links the crawler will process before stopping
max_depthNoMax depth of the mapping. Defines how far from the base URL the crawler can explore
max_breadthNoMax number of links to follow per level of the tree (i.e., per page)
instructionsNoNatural language instructions for the crawler
select_pathsNoRegex patterns to select only URLs with specific path patterns (e.g., /docs/.*, /api/v1.*)
allow_externalNoWhether to return external links in the final response
select_domainsNoRegex patterns to restrict crawling to specific domains or subdomains (e.g., ^docs\.example\.com$)

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint=true and destructiveHint=false, so the agent knows this is a safe read operation. The description adds the return type (list of URLs) and the start point (base URL). It does not add context about external network access, rate limits, or how filters like select_paths affect behavior, so with annotations covering safety, a 3 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two short sentences, front-loaded with the core purpose. Every word earns its place, and it avoids unnecessary detail or redundancy. This is exemplary conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that the tool has an output schema and comprehensive parameter documentation, the description does not need to explain return values or parameter syntax. It succinctly conveys the tool's high-level function. However, for a tool with 8 parameters and external web interaction, a bit more context about crawling behavior (e.g., depth/breadth limits) would improve completeness, though it's already adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with detailed parameter descriptions for all 8 fields. The description itself does not mention any parameters or add meaning beyond the schema, so the baseline of 3 is correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Map a website's structure' and specifies the output: 'Returns a list of URLs found starting from the base URL.' This is a specific verb+resource+outcome. However, it does not explicitly differentiate from sibling tool tavily_crawl, which likely has overlapping functionality, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (for mapping a website's structure) but provides no explicit guidance on when to prefer this over siblings like tavily_search, tavily_extract, or tavily_crawl. There are no alternatives or exclusion criteria mentioned, so the guidance is only implied by the purpose statement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

tavily_researchA
Read-only

Perform comprehensive research on a given topic or question. Use this tool when you need to gather information from multiple sources, including web pages, documents, and other resources, to answer a question or complete a task. Returns a detailed response based on the research findings. Rate limit: 20 requests per minute.

ParametersJSON Schema
NameRequiredDescriptionDefault
inputYesA comprehensive description of the research task
modelNoDefines the degree of depth of the research. 'mini' is good for narrow tasks with few subtopics. 'pro' is good for broad tasks with many subtopicsauto

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and openWorldHint. The description adds useful behavioral context: a rate limit ('20 requests per minute') and the types of sources included ('web pages, documents, and other resources'). It does not contradict annotations and gives extra value beyond them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded and usage guidance follows. The rate limit sentence is useful. The return-value sentence is somewhat redundant with the output schema, but the overall length is reasonable at four sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only research tool, the combination of schema, annotations, and output schema covers most aspects. The description adds usage guidance, rate limit, and source scope. It lacks an explicit comparison to sibling tools, but the core context is sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%; both 'input' and 'model' are already described in detail in the schema. The description does not add additional parameter-level meaning, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Perform comprehensive research') and target ('given topic or question'), and distinguishes itself from siblings by emphasizing 'multiple sources' and comprehensive synthesis. This differentiates it from tavily_search, tavily_extract, tavily_crawl, and tavily_map.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Use this tool when you need to gather information from multiple sources... to answer a question or complete a task.' This gives a clear usage context, but it does not explicitly name alternatives or state when not to use it. The 'multiple sources' hint implies a distinction from single-source tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 5 tool updatesv1.0.0
    • First observedtavily_crawl
    • First observedtavily_extract
    • First observedtavily_map
    • First observedtavily_research
    • First observedtavily_search

TDQS

A4/5.0

Scored across 5 tools

Disambiguation4/5

Most tools have distinct purposes: search for quick web queries, extract for single-page content, crawl for site-wide extraction, map for site structure, and research for comprehensive synthesis. However, search and research could be confused since both involve gathering web information, though research is explicitly more thorough and multi-source.

Naming Consistency5/5

All tool names follow the consistent pattern 'tavily_<single_verb>', using lowercase with underscores and no mixed conventions. The verbs (search, extract, crawl, map, research) are clear and predictable, making the naming highly consistent.

Tool Count5/5

With 5 tools, the server is well-scoped for a web research proxy, covering common operations without excess. Each tool serves a meaningful function and the count aligns with the stated purpose.

Completeness5/5

The tool set provides a comprehensive lifecycle for web data retrieval: search, extract, crawl, map, and research cover both quick lookups and deep investigations. There are no obvious missing operations for the domain of web research.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A multi-API key load balancing MCP server for Tavily that automatically rotates between multiple API keys to provide high availability and increased request limits.
    6
    70
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A local MCP server that exposes Tavily search as a tool and rotates across multiple API keys for reliability.
    1
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    A proxy MCP server for Tavily search and extract APIs with support for multiple API keys, random rotation, and bearer token authentication.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Exposes pooled Tavily API keys through an MCP streamable HTTP endpoint, providing search, extract, crawl, map, research, and pool status tools with automatic key rotation and quota management.
    MIT