Skip to main content

An MCP server for Tavily's search API

Project description

Tavily MCP Server

A Model Context Protocol server that provides AI-powered web search capabilities using Tavily's search API. This server enables LLMs to perform sophisticated web searches, get direct answers to questions, and search recent news articles with AI-extracted relevant content.

Available Tools

  • tavily_web_search - Performs comprehensive web searches with AI-powered content extraction.

    • query (string, required): Search query
    • max_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")
  • tavily_answer_search - Performs web searches and generates direct answers with supporting evidence.

    • query (string, required): Search query
    • max_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")
  • tavily_news_search - Searches recent news articles with publication dates.

    • query (string, required): Search query
    • max_results (integer, optional): Maximum number of results to return (default: 5, max: 20)
    • days (integer, optional): Number of days back to search (default: 3)

Prompts

  • tavily_web_search

    • Search the web using Tavily's AI-powered search engine
    • Arguments:
      • query (string, required): Search query
  • tavily_answer_search

    • Search the web and get an AI-generated answer with supporting evidence
    • Arguments:
      • query (string, required): Search query
  • tavily_news_search

    • Search recent news articles with Tavily's news search
    • Arguments:
      • query (string, required): Search query
      • days (integer, optional): Number of days back to search

Installation

Use pip

Simply run:

pip install mcp-tavily

or if you have uv installed:

uv pip install mcp-tavily

Build the Server

Clone this repository and build and install the program with your default Python interpreter (recommended).

git clone https://github.com/modelcontextprotocol/servers.git
cd servers/mcp-tavily
uv build
uv pip install .

After installation, you can run it as a script using:

python -m mcp_server_tavily

Configuration

API Key

The server requires a Tavily API key to function. You can obtain one from Tavily's website. The API key can be provided in two ways:

  1. As an environment variable:
export TAVILY_API_KEY=your_api_key_here
  1. As a command-line argument:
python -m mcp_server_tavily --api-key=your_api_key_here

Configure for Claude.app

Add to your Claude settings:

Using pip installation
"mcpServers": {
  "tavily": {
    "command": "python",
    "args": ["-m", "mcp_server_tavily"]
  },
  "env": {
        "TAVILY_API_KEY": "your_api_key_here"
  }
}

If you see any issue, you may want to use the full path for the Python interpreter you are using. You can do a which python to find out the exact path if needed.

Remember to set the TAVILY_API_KEY environment variable or provide it via the --api-key argument.

Examples

For a regular search:

Tell me about Anthropic's newly released MCP protocol

To generate a report with explicit exclusions:

Tell me about redwood trees. Please use MLA format in markdown syntax and include the URLs in the citations. Exclude Wikipedia sources.

To force Claude to use the answer mode function call, be explicit in your ask:

I want a concrete answer backed by current web sources: What is the average lifespan of redwood trees?

For news, use:

Give me the top 10 AI-related news in the last 5 days

Debugging

You can use the MCP inspector to debug the server. For uvx installations:

npx @modelcontextprotocol/inspector uvx mcp-server-tavily

Or if you've installed the package in a specific directory or are developing on it:

cd path/to/servers/src/tavily
npx @modelcontextprotocol/inspector python -m mcp_server_tavily

Contributing

We encourage contributions to help expand and improve mcp-server-tavily. Whether you want to add new search capabilities, enhance existing functionality, or improve documentation, your input is valuable.

For examples of other MCP servers and implementation patterns, see: https://github.com/modelcontextprotocol/servers

Pull requests are welcome! Feel free to contribute new ideas, bug fixes, or enhancements to make mcp-server-tavily even more powerful and useful.

License

mcp-server-tavily is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_tavily-0.1.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_tavily-0.1.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file mcp_tavily-0.1.1.tar.gz.

File metadata

  • Download URL: mcp_tavily-0.1.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.10

File hashes

Hashes for mcp_tavily-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e2160fefa3374a048a8a0ac5b795c3d9579ee9705e1b6900319ed40c2e58fd6f
MD5 492c23790512106e43cc45ee344206c1
BLAKE2b-256 683d6928577a32c10243d9118a031c5605fee43450f6efec8e2edfcd07aed983

See more details on using hashes here.

File details

Details for the file mcp_tavily-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcp_tavily-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.10

File hashes

Hashes for mcp_tavily-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 befb19c231b146f7f94226e5899d922903b2a24d65f442dba8b14d3bfd9c896a
MD5 9457ab0ec2d69c9b93b225ffd887e9f5
BLAKE2b-256 f3c7f82b7e09380befd2538b901d64dbc914b449c8244735b390b14f034ac5c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page