KM

kshern/mcp-tavily

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

12 stars 6 forks 质量 75 趋势 12MIT

mcp server of tavily

概览

A Model Context Protocol (MCP) server implementation for Tavily API, providing advanced search and content extraction capabilities. - : - search: Basic search functionality with customizable options - searchContext: Context-aware search for better relevance - searchQNA: Question and answer focused search - : Extract content from URLs with configurable options - : Extensive options for search depth, filtering, and content inclusion Add the Tavily MCP server to your MCP configuration: Note: Make sure to replace your-api-key with your actual Tavily API key. You can also set it as an environment variable TAVILY_API_KEY before running the server. The server provides three search tools that can be called through MCP: All tools return responses in the following format: For search results, each item includes: - Title - Content - URL For extracted content, each item includes: - URL - Raw content - Failed URLs list (if any)

README

以下为原文 README 节选,完整内容请查看原文。

MCP Tavily

中文文档

A Model Context Protocol (MCP) server implementation for Tavily API, providing advanced search and content extraction capabilities.

Features

  • Multiple Search Tools:
    • search: Basic search functionality with customizable options
    • searchContext: Context-aware search for better relevance
    • searchQNA: Question and answer focused search
  • Content Extraction: Extract content from URLs with configurable options
  • Rich Configuration Options: Extensive options for search depth, filtering, and content inclusion

Usage with MCP

Add the Tavily MCP server to your MCP configuration:

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

Note: Make sure to replace your-api-key with your actual Tavily API key. You can also set it as an environment variable TAVILY_API_KEY before running the server.

API Reference

Search Tools

The server provides three search tools that can be called through MCP:

// Tool name: search
{
  query: "artificial intelligence",
  options: {
    searchDepth: "advanced",
    topic: "news",
    maxResults: 10
  }
}
// Tool name: searchContext
{
  query: "latest developments in AI",
  options: {
    topic: "news",
    timeRange: "week"
  }
}
// Tool name: searchQNA
{
  query: "What is quantum computing?",
  options: {
    includeAnswer: true,
    maxResults: 5
  }
}

Extract Tool

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

Search Options

All search tools share these options:

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
}

Extract Options

interface ExtractOptions {
在 GitHub 查看完整 README

安装

npx -y @mcptools/mcp-tavily
新手?先看 mcpskill.org 教程 →

配置

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