The Tavily MCP Server provides AI-powered web search capabilities through the Model Context Protocol, enabling large language models to perform sophisticated web searches, get direct answers to questions, and search recent news articles with AI-extracted content.
uv
Python package manager (recommended)# With pip
pip install mcp-tavily
# Or with uv (recommended)
uv add mcp-tavily
# Clone the repository
git clone https://github.com/RamXX/mcp-tavily.git
cd mcp-tavily
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies and build
uv sync # Or: pip install -r requirements.txt
uv build # Or: pip install -e .
For quick installation in VS Code, add the following configuration to your User Settings (JSON) file:
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "apiKey",
"description": "Tavily API Key",
"password": true
}
],
"servers": {
"tavily": {
"command": "uvx",
"args": ["mcp-tavily"],
"env": {
"TAVILY_API_KEY": "${input:apiKey}"
}
}
}
}
}
The server requires a Tavily API key, which can be provided in three ways:
Through a .env
file in your project directory:
TAVILY_API_KEY=your_api_key_here
As an environment variable:
export TAVILY_API_KEY=your_api_key_here
As a command-line argument:
python -m mcp_server_tavily --api-key=your_api_key_here
Add to your Claude settings:
"mcpServers": {
"tavily": {
"command": "python",
"args": ["-m", "mcp_server_tavily"]
},
"env": {
"TAVILY_API_KEY": "your_api_key_here"
}
}
tavily_web_search
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results (default: 5, max: 20)search_depth
(string, optional): "basic" or "advanced" (default: "basic")include_domains
(list or string, optional): Domains to includeexclude_domains
(list or string, optional): Domains to excludetavily_answer_search
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results (default: 5, max: 20)search_depth
(string, optional): "basic" or "advanced" (default: "advanced")include_domains
(list or string, optional): Domains to includeexclude_domains
(list or string, optional): Domains to excludetavily_news_search
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results (default: 5, max: 20)days
(integer, optional): Number of days back to search (default: 3)include_domains
(list or string, optional): Domains to includeexclude_domains
(list or string, optional): Domains to excludeRegular web search:
Tell me about Anthropic's newly released MCP protocol
Generate a report with domain filtering:
Tell me about redwood trees. Please use MLA format in markdown syntax and include the URLs in the citations. Exclude Wikipedia sources.
Direct answer search:
I want a concrete answer backed by current web sources: What is the average lifespan of redwood trees?
News search:
Give me the top 10 AI-related news in the last 5 days
Build the Docker image:
docker build -t mcp_tavily .
Run a container:
docker run -d --name mcp_tavily_container \
-e TAVILY_API_KEY=your_api_key_here \
-p 8000:8000 mcp_tavily
Stop and remove the container:
docker stop mcp_tavily_container
docker rm mcp_tavily_container
Use the MCP inspector to debug the server:
# Using npx
npx @modelcontextprotocol/inspector python -m mcp_server_tavily
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "tavily" '{"command":"uvx","args":["mcp-tavily"],"env":{"TAVILY_API_KEY":"${input:apiKey}"}}'
See the official Claude Code MCP documentation for more details.
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.
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": {
"tavily": {
"command": "uvx",
"args": [
"mcp-tavily"
],
"env": {
"TAVILY_API_KEY": "${input:apiKey}"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"tavily": {
"command": "uvx",
"args": [
"mcp-tavily"
],
"env": {
"TAVILY_API_KEY": "${input:apiKey}"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect