Tavily Search

mcp-tavily-search

Provides comprehensive multi-topic search capabilities powered by the Tavily API.

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.

šŸŒŸ 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

šŸ’” Core Features

āš”ļø Performance & Reliability

  • Asynchronous request handling
  • Built-in error handling and automatic retries
  • Configurable request timeouts
  • Comprehensive logging system

šŸŽÆ Search Configuration

  • Configurable search depth (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

  • Python 3.11 or higher
  • UV Package Manager
  • Tavily API key

Claude Desktop Setup

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

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)

  • MCP protocol implementation
  • 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:

  1. Basic search:
  1. Advanced search with images:
  1. News-specific search:
  1. Search with raw content:

Troubleshooting Guide

Connection Issues

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

  1. Verify your configuration paths
  2. Check the Claude Desktop logs
  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

Community and Support

  • Report issues and contribute
  • Share your implementations and improvements
  • Join discussions and help others

Security and Best Practices

Security is paramount in this implementation. The server includes:

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

Installation

Server Statistics

LocalNo
Published1/8/2025