Skip to main content
Glama
kshern

MCP Tavily

MCP塔维利

铁匠徽章

中文詳細

Tavily API 的模型上下文协议 (MCP) 服务器实现,提供高级搜索和内容提取功能。

特征

  • 多种搜索工具

    • search :具有可自定义选项的基本搜索功能

    • searchContext :上下文感知搜索,提高相关性

    • searchQNA :以问题和答案为重点的搜索

  • 内容提取:使用可配置选项从 URL 中提取内容

  • 丰富的配置选项:搜索深度、过滤和内容包含的广泛选项

与 MCP 一起使用

将 Tavily MCP 服务器添加到您的 MCP 配置中:

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

注意:请确保将your-api-key替换为你的实际 Tavily API 密钥。你也可以在运行服务器之前将其设置为环境变量TAVILY_API_KEY

Related MCP server: Deep Research MCP Server

API 参考

搜索工具

服务器提供了三种可以通过MCP调用的搜索工具:

1. 基本搜索

// Tool name: search
{
  query: "artificial intelligence",
  options: {
    searchDepth: "advanced",
    topic: "news",
    maxResults: 10
  }
}

2. 上下文搜索

// Tool name: searchContext
{
  query: "latest developments in AI",
  options: {
    topic: "news",
    timeRange: "week"
  }
}

3. 问答搜索

// Tool name: searchQNA
{
  query: "What is quantum computing?",
  options: {
    includeAnswer: true,
    maxResults: 5
  }
}

提取工具

// Tool name: extract
{
  urls: ["https://example.com/article1", "https://example.com/article2"],
  options: {
    extractDepth: "advanced",
    includeImages: true
  }
}

搜索选项

所有搜索工具都具有以下选项:

interface SearchOptions {
  searchDepth?: "basic" | "advanced";    // Search depth level
  topic?: "general" | "news" | "finance"; // Search topic category
  days?: number;                         // Number of days to search
  maxResults?: number;                   // Maximum number of results
  includeImages?: boolean;               // Include images in results
  includeImageDescriptions?: boolean;    // Include image descriptions
  includeAnswer?: boolean;               // Include answer in results
  includeRawContent?: boolean;           // Include raw content
  includeDomains?: string[];            // List of domains to include
  excludeDomains?: string[];            // List of domains to exclude
  maxTokens?: number;                    // Maximum number of tokens
  timeRange?: "year" | "month" | "week" | "day" | "y" | "m" | "w" | "d"; // Time range for search
}

提取选项

interface ExtractOptions {
  extractDepth?: "basic" | "advanced";   // Extraction depth level
  includeImages?: boolean;               // Include images in results
}

响应格式

所有工具都以以下格式返回响应:

{
  content: Array<{
    type: "text",
    text: string
  }>
}

对于搜索结果,每项包括:

  • 标题

  • 内容

  • 网址

对于提取的内容,每项包括:

  • 网址

  • 原始内容

  • 失败的 URL 列表(如果有)

错误处理

所有工具都包含适当的错误处理,如果出现问题,将会抛出描述性错误消息。

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Tavily API 服务器:

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

手动安装

npm install @mcptools/mcp-tavily

或者直接通过 npx 使用:

npx @mcptools/mcp-tavily

先决条件

  • Node.js 16 或更高版本

  • npm 或 yarn

  • Tavily API 密钥(从Tavily获取)

设置

  1. 克隆存储库

  2. 安装依赖项:

npm install
  1. 设置您的 Tavily API 密钥:

export TAVILY_API_KEY=your_api_key

建筑

npm run build

使用 MCP Inspector 进行调试

对于开发和调试,我们建议使用MCP Inspector ,它是 MCP 服务器的强大开发工具。

检查器提供了以下用户界面:

  • 测试工具调用

  • 查看服务器响应

  • 调试工具执行

  • 监控服务器状态

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/AmazingFeature

  3. 提交您的更改( git commit -m 'Add some AmazingFeature'

  4. 推送到分支( git push origin feature/AmazingFeature

  5. 打开拉取请求

执照

该项目已获得 MIT 许可。

支持

如有任何疑问或问题:

-
security - not tested
A
license - permissive license
-
quality - not tested

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/kshern/mcp-tavily'

If you have feedback or need assistance with the MCP directory API, please join our Discord server