The Tavily MCP server provides AI-powered web search capabilities through a Model Context Protocol (MCP) interface. It enables language models to perform sophisticated web searches, get direct answers to questions, and search recent news articles with AI-extracted relevant content.
You can quickly install the MCP Tavily server using pip or uv:
# 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 .
# 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
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
For manual installation, add the following JSON block to your User Settings in VS Code:
{
"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}"
}
}
}
}
}
Add to your Claude settings:
"mcpServers": {
"tavily": {
"command": "python",
"args": ["-m", "mcp_server_tavily"]
},
"env": {
"TAVILY_API_KEY": "your_api_key_here"
}
}
The tavily_web_search
tool performs comprehensive web searches with AI-powered content extraction:
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results to return (default: 5, max: 20)search_depth
(string, optional): Either "basic" or "advanced" search depth (default: "basic")include_domains
(list or string, optional): List of domains to specifically include in resultsexclude_domains
(list or string, optional): List of domains to exclude from resultsThe tavily_answer_search
tool performs web searches and generates direct answers with supporting evidence:
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results to return (default: 5, max: 20)search_depth
(string, optional): Either "basic" or "advanced" search depth (default: "advanced")include_domains
(list or string, optional): List of domains to specifically include in resultsexclude_domains
(list or string, optional): List of domains to exclude from resultsThe tavily_news_search
tool searches recent news articles with publication dates:
query
(string, required): Search querymax_results
(integer, optional): Maximum number of results to return (default: 5, max: 20)days
(integer, optional): Number of days back to search (default: 3)include_domains
(list or string, optional): List of domains to specifically include in resultsexclude_domains
(list or string, optional): List of domains to exclude from resultsTell me about Anthropic's newly released MCP protocol
Tell me about redwood trees. Please use MLA format in markdown syntax and include the URLs in the citations. Exclude Wikipedia sources.
I want a concrete answer backed by current web sources: What is the average lifespan of redwood trees?
Give me the top 10 AI-related news in the last 5 days
You can use the MCP inspector to debug the server:
# Using npx
npx @modelcontextprotocol/inspector python -m mcp_server_tavily
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.