Tavily Search MCP server

Integrates with Tavily's semantic search API to enable web searches and retrieval of relevant results for fact-checking and research tasks.
Back to servers
Setup instructions
Provider
Scott Spence
Release date
Jan 18, 2025
Language
TypeScript
Package
Stats
3.3K downloads
9 stars

MCP Tavily Search is a server that integrates Tavily's search API with Large Language Models (LLMs) through the Model Context Protocol. It provides intelligent web search capabilities optimized for high-quality, factual results, including context generation for RAG applications and direct question answering.

Features

  • 🔍 Advanced web search capabilities through Tavily API
  • 🤖 AI-generated summaries of search results
  • 🎯 Domain filtering for higher quality results
  • 📊 Configurable search depth and parameters
  • 🧠 Context generation for RAG applications
  • ❓ Direct question answering capabilities
  • 💾 Response caching with TTL support
  • 📝 Multiple response formats (text, JSON, markdown)

Installation and Configuration

This server requires configuration through your MCP client. You'll need a Tavily API key to use this service.

Cline Configuration

Add this to your Cline MCP settings:

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

Claude Desktop with WSL Configuration

For WSL environments, add this to your Claude Desktop configuration:

{
	"mcpServers": {
		"mcp-tavily-search": {
			"command": "wsl.exe",
			"args": [
				"bash",
				"-c",
				"source ~/.nvm/nvm.sh && TAVILY_API_KEY=your-tavily-api-key /home/username/.nvm/versions/node/v20.12.1/bin/npx mcp-tavily-search"
			]
		}
	}
}

Environment Variables

The server requires the following environment variable:

  • TAVILY_API_KEY: Your Tavily API key (required)

Usage

The server implements three MCP tools with configurable parameters:

tavily_search

Search the web using Tavily Search API, optimized for high-quality, factual results.

Parameters:

  • query (string, required): Search query
  • search_depth (string, optional): "basic" (faster) or "advanced" (more thorough). Defaults to "basic"
  • topic (string, optional): "general" or "news". Defaults to "general"
  • days (number, optional): Number of days back to search (news topic only). Defaults to 3
  • time_range (string, optional): Time range for results ('day', 'week', 'month', 'year' or 'd', 'w', 'm', 'y')
  • max_results (number, optional): Maximum number of results. Defaults to 5
  • include_answer (boolean, optional): Include AI-generated summary. Defaults to true
  • include_images (boolean, optional): Include related images. Defaults to false
  • include_image_descriptions (boolean, optional): Include image descriptions. Defaults to false
  • include_raw_content (boolean, optional): Include raw HTML content. Defaults to false
  • include_domains (string[], optional): List of trusted domains to include
  • exclude_domains (string[], optional): List of domains to exclude
  • response_format (string, optional): 'text', 'json', or 'markdown'. Defaults to 'text'
  • cache_ttl (number, optional): Cache time-to-live in seconds. Defaults to 3600
  • force_refresh (boolean, optional): Force fresh results ignoring cache. Defaults to false

tavily_get_search_context

Generate context for RAG applications using Tavily search.

Parameters:

  • query (string, required): Search query for context generation
  • max_tokens (number, optional): Maximum length of generated context. Defaults to 2000
  • search_depth (string, optional): "basic" or "advanced". Defaults to "advanced"
  • topic (string, optional): "general" or "news". Defaults to "general"
  • Other parameters same as tavily_search

tavily_qna_search

Get direct answers to questions using Tavily search.

Parameters:

  • query (string, required): Question to be answered
  • include_sources (boolean, optional): Include source citations. Defaults to true
  • search_depth (string, optional): "basic" or "advanced". Defaults to "advanced"
  • topic (string, optional): "general" or "news". Defaults to "general"
  • Other parameters same as tavily_search

Domain Filtering

The server supports flexible domain filtering through two optional parameters:

  • include_domains: Array of trusted domains to include in search results
  • exclude_domains: Array of domains to exclude from search results

This allows you to:

  • Target specific trusted sources for academic or technical searches
  • Exclude potentially unreliable or irrelevant sources
  • Customize sources based on your specific needs
  • Access all available sources when no filtering is specified

Example domain filtering:

{
	"include_domains": ["arxiv.org", "science.gov"],
	"exclude_domains": ["example.com"]
}

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-tavily-search" '{"command":"npx","args":["-y","mcp-tavily-search"],"env":{"TAVILY_API_KEY":"your-tavily-api-key"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later