Skip to main content
Glama
Tavily MCP Server

Tavily MCP Server

Official
by tavily-ai

塔维利·克罗尔 Beta

GitHub Repo 星标npm铁匠徽章

🎉 v0.2.1 版本引入tavily-crawl + tavily-map ! 🎉

MCP 演示

模型上下文协议 (MCP) 是一种开放标准,使 AI 系统能够与各种数据源和工具无缝交互,促进安全的双向连接。

由 Anthropic 开发的模型上下文协议 (MCP) 使 Claude 等 AI 助手能够与 Tavily 的高级搜索和数据提取功能无缝集成。这种集成使 AI 模型能够实时访问网络信息,并配备完善的过滤选项和特定领域的搜索功能。

Tavily MCP 服务器提供:

  • 搜索、提取、映射、抓取工具

  • 通过 tavily-search 工具实现实时网络搜索功能

  • 通过 tavily-extract 工具从网页智能提取数据

  • 强大的网络地图工具,可创建网站的结构化地图

  • 系统地探索网站的网络爬虫

📚 有用的资源

  • Tavily MCP 与 Neo4j MCP 服务器结合使用教程

  • 在 VS Code 中集成 Tavily MCP 与 Cline 的教程

Related MCP server: Tavily MCP Server

先决条件🔧

在开始之前,请确保您已:

  • Tavily API 密钥

    • 如果您没有 Tavily API 密钥,您可以在此处注册免费帐户

  • Claude Desktop或Cursor

  • Node.js (v20 或更高版本)

    • 您可以通过运行以下命令来验证您的 Node.js 安装:

      • node --version

  • 已安装Git (仅在使用 Git 安装方法时才需要)

    • 在 macOS 上: brew install git

    • 在 Linux 上:

      • Debian/Ubuntu: sudo apt install git

      • RedHat/CentOS: sudo yum install git

    • 在 Windows 上:下载适用于 Windows 的 Git

Tavily MCP 服务器安装⚡

使用 NPX 运行

npx -y tavily-mcp@0.2.1  

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Tavily MCP Server:

npx -y @smithery/cli install @tavily-ai/tavily-mcp --client claude

虽然您可以单独启动服务器,但单独使用并没有太大用处。您应该将其集成到 MCP 客户端中。以下是如何配置 Claude Desktop 应用与 tavily-mcp 服务器配合使用的示例。

配置 MCP 客户端 ⚙️

该存储库将解释如何配置VS Code 、 Cursor和Claude Desktop以与 tavily-mcp 服务器协同工作。

配置 VS Code 💻

对于一键安装,请单击以下安装按钮之一:

在 VS Code 中使用 NPX 安装 在 VS Code Insiders 中使用 NPX 安装

手动安装

首先,检查本节顶部是否有符合您需求的安装按钮。如果您希望手动安装,请按照以下步骤操作:

将以下 JSON 块添加到 VS Code 中的“用户设置 (JSON)”文件。您可以按Ctrl + Shift + P (在 macOS 上为Cmd + Shift + P ),然后输入Preferences: Open User Settings (JSON) 。

{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "tavily_api_key",
        "description": "Tavily API Key",
        "password": true
      }
    ],
    "servers": {
      "tavily": {
        "command": "npx",
        "args": ["-y", "tavily-mcp@0.2.1"],
        "env": {
          "TAVILY_API_KEY": "${input:tavily_api_key}"
        }
      }
    }
  }
}

或者,您可以将其添加到工作区中名为.vscode/mcp.json的文件中:

{
  "inputs": [
    {
      "type": "promptString",
      "id": "tavily_api_key",
      "description": "Tavily API Key",
      "password": true
    }
  ],
  "servers": {
    "tavily": {
      "command": "npx",
      "args": ["-y", "tavily-mcp@0.2.1"],
      "env": {
        "TAVILY_API_KEY": "${input:tavily_api_key}"
      }
    }
  }
}

配置 Cline 🤖

在 Cline 中设置 Tavily MCP 服务器的最简单方法是通过市场单击一下:

  1. 在 VS Code 中打开 Cline

  2. 点击侧边栏中的 Cline 图标

  3. 导航到“MCP 服务器”选项卡(4 个方块)

  4. 搜索“Tavily”并点击“安装”

  5. 出现提示时,输入您的 Tavily API 密钥

或者,您可以在 Cline 中手动设置 Tavily MCP 服务器:

  1. 打开 Cline MCP 设置文件:

对于 macOS:

# Using Visual Studio Code
code ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

# Or using TextEdit
open -e ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

对于 Windows:

code %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
  1. 将 Tavily 服务器配置添加到文件中:

    将your-api-key-here替换为您实际的Tavily API 密钥。

    {
      "mcpServers": {
        "tavily-mcp": {
          "command": "npx",
          "args": ["-y", "tavily-mcp@0.2.1"],
          "env": {
            "TAVILY_API_KEY": "your-api-key-here"
          },
          "disabled": false,
          "autoApprove": []
        }
      }
    }
  2. 如果 Cline 已运行,请保存文件并重新启动它。

  3. 使用 Cline 时,您现在可以访问 Tavily MCP 工具。您可以直接在对话中让 Cline 使用 tavily-search 和 tavily-extract 工具。

配置光标🖥️

注意:需要 Cursor 版本 0.45.6 或更高版本

要在 Cursor 中设置 Tavily MCP 服务器:

  1. 打开游标设置

  2. 导航至“功能”>“MCP 服务器”

  3. 点击“+ 添加新的 MCP 服务器”按钮

  4. 填写以下信息:

    • 名称:输入服务器的昵称(例如“tavily-mcp”)

    • 类型:选择“命令”作为类型

    • 命令:输入运行服务器的命令:

      env TAVILY_API_KEY=your-api-key npx -y tavily-mcp@0.2.1

      重要提示:请将your-api-key替换为您的 Tavily API 密钥。您可以在app.tavily.com/home获取。

添加服务器后,它将出现在 MCP 服务器列表中。您可能需要手动点击 MCP 服务器右上角的刷新按钮来刷新工具列表。

当与您的查询相关时,Composer Agent 将自动使用 Tavily MCP 工具。最好明确请求使用这些工具,并描述您的操作(例如,“使用 tavily-search 在网络上搜索有关 AI 的最新新闻”)。在 Mac 上,按 Command + L 打开聊天,选择屏幕顶部的 Composer 选项,在“提交”按钮旁边选择 Agent,并在准备好后提交查询。

游标接口示例

配置 Claude 桌面应用程序🖥️

对于 macOS:

# Create the config file if it doesn't exist
touch "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

# Opens the config file in TextEdit 
open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

# Alternative method using Visual Studio Code (requires VS Code to be installed)
code "$HOME/Library/Application Support/Claude/claude_desktop_config.json"

对于 Windows:

code %APPDATA%\Claude\claude_desktop_config.json

添加 Tavily 服务器配置:

将your-api-key-here替换为您实际的Tavily API 密钥。

{
  "mcpServers": {
    "tavily-mcp": {
      "command": "npx",
      "args": ["-y", "tavily-mcp@0.2.1"],
      "env": {
        "TAVILY_API_KEY": "your-api-key-here"
      }
    }
  }
}

2. Git 安装

  1. 克隆存储库:

git clone https://github.com/tavily-ai/tavily-mcp.git
cd tavily-mcp
  1. 安装依赖项:

npm install
  1. 构建项目:

npm run build

配置 Claude 桌面应用程序⚙️

按照上面配置 Claude 桌面应用程序部分中概述的配置步骤,使用以下 JSON 配置。

将your-api-key-here替换为您实际的Tavily API 密钥,将/path/to/tavily-mcp替换为您在系统上克隆存储库的实际路径。

{
  "mcpServers": {
    "tavily": {
      "command": "npx",
      "args": ["/path/to/tavily-mcp/build/index.js"],
      "env": {
        "TAVILY_API_KEY": "your-api-key-here"
      }
    }
  }
}

在 Claude 桌面应用程序中的使用

安装完成并配置好 Claude 桌面应用程序后,您必须完全关闭并重新打开 Claude 桌面应用程序才能查看 tavily-mcp 服务器。您应该在应用程序左下方看到一个锤子图标,表示可用的 MCP 工具,您可以点击锤子图标查看有关 tavily-search 和 tavily-extract 工具的更多详细信息。

替代文本

现在,Claude 将拥有 tavily-mcp 服务器的完整访问权限,包括 tavily-search 和 tavily-extract 工具。如果您将以下示例代码插入 Claude 桌面应用程序,您将看到 tavily-mcp 服务器工具的运行。

塔维利搜索示例

  1. 常规网页搜索:

Can you search for recent developments in quantum computing?
  1. 新闻搜索:

Search for news articles about AI startups from the last 7 days.
  1. 特定领域搜索:

Search for climate change research on nature.com and sciencedirect.com

Tavily 提取物示例

  1. 摘录文章内容:

Extract the main content from this article: https://example.com/article

✨ 合并搜索和提取 ✨

您还可以结合使用 tavily-search 和 tavily-extract 工具来执行更复杂的任务。

Search for news articles about AI startups from the last 7 days and extract the main content from each article to generate a detailed report.

故障排除🛠️

常见问题

  1. 未找到服务器

    • 通过运行npm --verison来验证 npm 安装

    • 通过运行code ~/Library/Application\ Support/Claude/claude_desktop_config.json检查 Claude Desktop 配置语法

    • 通过运行node --version确保正确安装了 Node.js

  2. NPX 相关问题

  • 如果遇到与npx相关的错误,则可能需要使用 npx 可执行文件的完整路径。

  • 您可以通过在终端中运行which npx来找到此路径,然后在配置中将"command": "npx"行替换为"command": "/full/path/to/npx" 。

  1. API 密钥问题

    • 确认您的 Tavily API 密钥有效

    • 检查配置中的 API 密钥是否正确设置

    • 验证 API 密钥周围没有空格或引号

致谢✨

Available Tools

4 tools
tavily-crawlA

A powerful web crawler that initiates a structured web crawl starting from a specified base URL. The crawler expands from that point like a graph, following internal links across pages. You can control how deep and wide it goes, and guide it to focus on specific sections of the site.

Inputs: url (required), max_depth, max_breadth, limit, +7 more.

tavily-extractC

A powerful web content extraction tool that retrieves and processes raw content from specified URLs, ideal for data collection, content analysis, and research tasks.

Inputs: urls (required), extract_depth, include_images, format, +2 more.

tavily-mapB

A powerful web mapping tool that creates a structured map of website URLs, allowing you to discover and analyze site structure, content organization, and navigation paths. Perfect for site audits, content discovery, and understanding website architecture.

Inputs: url (required), max_depth, max_breadth, limit, +4 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: crawling (tavily-crawl) focuses on structured exploration from a base URL, extraction (tavily-extract) retrieves raw content from specific URLs, mapping (tavily-map) analyzes site structure, and search (tavily-search) provides real-time web results. There is no overlap in functionality, making tool selection straightforward for an agent.

    Naming Consistency5/5

    All tool names follow a consistent 'tavily-' prefix with a descriptive action suffix (crawl, extract, map, search), using a uniform hyphenated style. This predictable pattern enhances readability and reduces confusion, with no deviations in naming conventions.

    Tool Count5/5

    With 4 tools, the server is well-scoped for its web-related domain, covering key operations like crawling, extraction, mapping, and search without bloat. Each tool earns its place by addressing a distinct aspect of web interaction, making the count appropriate and manageable.

    Completeness5/5

    The tool set provides complete coverage for web-based tasks, including discovery (crawl, map), content retrieval (extract, search), and analysis. There are no obvious gaps; agents can perform end-to-end workflows from finding sites to extracting and analyzing content without dead ends.

    Maintenance

    ActivityActive
    ResponsivenessMostly unanswered

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      This server allows users to perform web searches using Perplexity AI, providing a tool for retrieving search results through a simple API interface.
      1
      3
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI assistants with real-time web search, intelligent data extraction from web pages, website mapping, and web crawling capabilities through Tavily's API. Enables comprehensive web research and content analysis through natural language interactions.
      MIT