Labsco
arben-adm logo

Tavily Search

โ˜… 2

from arben-adm

A comprehensive search agent powered by the Tavily API for in-depth and reliable search results across various topics.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

๐Ÿ” 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

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

  • 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

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