Tavily Search
A comprehensive search agent powered by the Tavily API for in-depth and reliable search results across various topics.
š 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.
š 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
- Python 3.11 or higher
- UV Package Manager (Installation Guide)
- Tavily API key (Get one here)
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:
- Basic search:
{
"name": "search",
"arguments": {
"query": "Latest news on artificial intelligence"
}
}
- Advanced search with images:
{
"name": "search",
"arguments": {
"query": "Elon Musk SpaceX achievements",
"search_depth": "advanced",
"include_images": true,
"max_results": 10
}
}
- News-specific search:
{
"name": "search",
"arguments": {
"query": "Climate change impact on agriculture",
"topic": "news",
"max_results": 5
}
}
- 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:
- Verify your configuration paths
- Check the Claude Desktop logs:
# Windows type %APPDATA%\Claude\logs\latest.log # Unix/MacOS cat ~/.config/Claude/logs/latest.log - Test the server manually using the quick start commands
API Troubleshooting
If you're experiencing API issues:
- Validate your API key permissions
- Check your network connection
- Monitor the API response in the server logs
Running Tests
To run the unit tests for this project, follow these steps:
-
Install the development dependencies:
uv pip install -e ".[dev]" -
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
Related Servers
Agntic AI for Research Papers
Search and extract information about research papers from arXiv.
AI Book Agent MCP Server
Provides AI assistants with intelligent access to ML textbook content for creating accurate, source-grounded documentation.
RocketReach
Find emails, phone numbers, and enrich company data using the RocketReach API.
Unsplash MCP Server
Search and integrate images from Unsplash using its official API.
Chaitin IP Intelligence
Search for IP addresses using Chaitin's IP Intelligence API.
Yandex Search MCP Server
Perform real-time web searches using the Yandex Search API.
Crawleo MCP Server
Crawleo MCP - Web Search & Crawl for AI Enable AI assistants to access real-time web data through native tool integration. Two Powerful Tools: web.search - Real-time web search with flexible formatting Search from any country/language Device-specific results (desktop, mobile, tablet) Multiple output formats: Enhanced HTML (AI-optimized, clean) Raw HTML (original source) Markdown (formatted text) Plain Text (pure content) Auto-crawl option for full content extraction Multi-page search support web.crawl - Deep content extraction Extract clean content from any URL JavaScript rendering support Markdown conversion Screenshot capture Multi-URL support Features: ā Zero data retention (complete privacy) ā Real-time, not cached results ā AI-optimized with Enhanced HTML mode ā Global coverage (any country/language) ā Device-specific search (mobile/desktop/tablet) ā Flexible output formats (4 options) ā Cost-effective (5-10x cheaper than competitors) ā Simple Claude Desktop integration Perfect for: Research, content analysis, data extraction, AI agents, RAG pipelines, multi-device testing
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Perplexica Search
Perform conversational searches with the Perplexica AI-powered answer engine.
Deep Research
An agent-based tool for web search and advanced research, including analysis of PDFs, documents, images, and YouTube transcripts.