Tavily Search

Tavily Search

This MCP server performs multi-topic searches in business, news, finance, and politics using the Tavily API, providing high-quality sources and intelligent summaries.

arben-adm

Media Content Processing
Content Fetching
Visit Server

Tools

comprehensive_search

Perform a comprehensive search across multiple topics using Tavily. Args: query: The search query to research

README

šŸ” My Tavily Search MCP Agent

I've created a powerful Model Context Protocol (MCP) Server powered by the Tavily API. With this, you can get high-quality, reliable information from business, news, finance, and politics - all through a robust and developer-friendly interface.

smithery badge Tavily Search Agent MCP Server CI codecov

🌟 Why I Built Tavily Search MCP

In today's fast-paced digital landscape, I recognized the need for quick access to precise information. I needed a web search tool that works with my sequential thinking MCP server. That's why I developed Tavily Search MCP, which excels with:

āš”ļø Lightning-fast async search responses
šŸ›”ļø Built-in fault tolerance with automatic retries
šŸŽÆ Clean, markdown-formatted results
šŸ” Smart content snippets
šŸ› ļø Comprehensive error handling
šŸ–¼ļø Optional image results
šŸ“° Specialized news search

šŸš€ Quick Start

Installing via Smithery

To install Tavily Search for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install mcp-tavily-search --client claude

Installing Manually

Here's how you can get up and running with my project in minutes:

# 1. Create environment
uv venv && .venv\Scripts\activate     # Windows
# OR
uv venv && source .venv/bin/activate  # Unix/MacOS

# 2. Install dependencies
uv pip install -e .

# 3. Set up configuration
echo TAVILY_API_KEY=your-key-here > .env

# 4. Start server
cd mcp_tavily_search && uv run server.py

šŸ’” Core Features

āš”ļø Performance & Reliability

  • I've implemented asynchronous request handling
  • Built-in error handling and automatic retries
  • Configurable request timeouts
  • Comprehensive logging system

šŸŽÆ Search Configuration

  • I've made the search depth configurable (basic/advanced)
  • Adjustable result limits (1-20 results)
  • Clean markdown-formatted output
  • Snippet previews with source URLs
  • Optional image results
  • Specialized news search topic

šŸ›”ļø Error Handling

  • API authentication validation
  • Rate limit detection
  • Network error recovery
  • Request timeout management

šŸ› ļø Developer Integration

Prerequisites

Claude Desktop Setup

I've optimized the Claude Desktop experience with this configuration:

{
  "mcpServers": {
    "tavily-search": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mcp-tavily-search/mcp_tavily_search",
        "run",
        "server.py"
      ],
      "env": {
        "TAVILY_API_KEY": "YOUR-API-KEY"
      }
    }
  }
}

šŸ“ Configuration paths:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Unix/MacOS: ~/.config/Claude/claude_desktop_config.json

Project Architecture

I've designed a clean, modular structure to make development a breeze:

mcp-tavily-search/
ā”œā”€ā”€ mcp_tavily_search/     # Core package
│   ā”œā”€ā”€ server.py          # Server implementation
│   ā”œā”€ā”€ client.py          # Tavily API client
│   ā”œā”€ā”€ test_server.py     # Server tests
│   ā”œā”€ā”€ test_client.py     # Client tests
│   └── __init__.py        # Package initialization
ā”œā”€ā”€ .env                   # Environment configuration
ā”œā”€ā”€ README.md              # Documentation
└── pyproject.toml         # Project configuration

Key Components

Server (server.py)

  • I've implemented the MCP protocol
  • Request handling and routing
  • Error recovery and health monitoring

Client (client.py)

  • Tavily API integration
  • Retry mechanism with exponential backoff
  • Result formatting and processing
  • Error handling and logging

Tests (test_server.py and test_client.py)

  • Comprehensive unit tests for both server and client
  • Ensures reliability and correctness of the implementation

Usage Examples

Here are some examples of how to use the enhanced search capabilities I've implemented:

  1. Basic search:
{
  "name": "search",
  "arguments": {
    "query": "Latest news on artificial intelligence"
  }
}
  1. Advanced search with images:
{
  "name": "search",
  "arguments": {
    "query": "Elon Musk SpaceX achievements",
    "search_depth": "advanced",
    "include_images": true,
    "max_results": 10
  }
}
  1. News-specific search:
{
  "name": "search",
  "arguments": {
    "query": "Climate change impact on agriculture",
    "topic": "news",
    "max_results": 5
  }
}
  1. Search with raw content:
{
  "name": "search",
  "arguments": {
    "query": "Python programming best practices",
    "include_raw_content": true,
    "max_results": 3
  }
}

Troubleshooting Guide

Connection Issues

If things don't work as expected, follow these steps I've outlined:

  1. Verify your configuration paths
  2. Check the Claude Desktop logs:
    # Windows
    type %APPDATA%\Claude\logs\latest.log
    # Unix/MacOS
    cat ~/.config/Claude/logs/latest.log
    
  3. Test the server manually using the quick start commands

API Troubleshooting

If you're experiencing API issues:

  1. Validate your API key permissions
  2. Check your network connection
  3. Monitor the API response in the server logs

Running Tests

To run the unit tests for this project, follow these steps:

  1. Install the development dependencies:

    uv pip install -e ".[dev]"
    
  2. Run the tests using pytest:

    pytest mcp_tavily_search
    

This will run all the tests in the mcp_tavily_search directory, including both test_client.py and test_server.py.

Community and Support

  • I encourage you to report issues and contribute on GitHub
  • Share your implementations and improvements
  • Join our discussions and help others

Security and Best Practices

Security is paramount in my implementation. The server includes:

  • Secure API key handling through environment variables
  • Automatic request timeout management
  • Comprehensive error tracking and logging

License

I've licensed this project under MIT. See the LICENSE file for details.

Acknowledgments

I'd like to give special thanks to:

  • The innovative Tavily API team
  • The MCP protocol community

Recommended Servers

Mult Fetch MCP Server

Mult Fetch MCP Server

A versatile MCP-compliant web content fetching tool that supports multiple modes (browser/node), formats (HTML/JSON/Markdown/Text), and intelligent proxy detection, with bilingual interface (English/Chinese).

Featured
Local
Persistent Knowledge Graph

Persistent Knowledge Graph

An implementation of persistent memory for Claude using a local knowledge graph, allowing the AI to remember information about users across conversations with customizable storage location.

Featured
Local
Hyperbrowser MCP Server

Hyperbrowser MCP Server

Welcome to Hyperbrowser, the Internet for AI. Hyperbrowser is the next-generation platform empowering AI agents and enabling effortless, scalable browser automation. Built specifically for AI developers, it eliminates the headaches of local infrastructure and performance bottlenecks, allowing you to

Featured
Local
Docx Document Processing Service

Docx Document Processing Service

A powerful Word document processing service based on FastMCP, enabling AI assistants to create, edit, and manage docx files with full formatting support. Preserves original styles when editing content.

Featured
Pandoc Document Conversion

Pandoc Document Conversion

MCP server for seamless document format conversion using Pandoc, supporting Markdown, HTML, PDF, DOCX (.docx), csv and more.

Featured
Search1API MCP Server

Search1API MCP Server

A Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API.

Featured
Fetch MCP Server

Fetch MCP Server

Provides functionality to fetch web content in various formats, including HTML, JSON, plain text, and Markdown.

Featured
Perplexity Deep Research

Perplexity Deep Research

A server that allows AI assistants to perform web searches using Perplexity's sonar-deep-research model with citation support.

Featured
Perplexity Chat MCP Server

Perplexity Chat MCP Server

MCP Server for the Perplexity API.

Featured
Web Research Server

Web Research Server

A Model Context Protocol server that enables Claude to perform web research by integrating Google search, extracting webpage content, and capturing screenshots.

Featured