Skip to main content

Introduction

The Tavily MCP Server connects your ADK agent to Tavily’s AI-focused search, extraction, and crawling platform. This gives your agent the ability to perform real-time web searches, intelligently extract specific data from web pages, and crawl or create structured maps of websites.

Prerequisites

Before you begin, make sure you have:
  • Python 3.9 or later
  • pip for installing packages
  • A Tavily API key (sign up for free if you don’t have one)
  • A Gemini API key for Google AI Studio

Installation

Install ADK by running:

Building Your Agent

Step 1: Create an Agent Project

Run the adk create command to start a new agent project:
This creates a new directory with the following structure:

Step 2: Update Your Agent Code

Edit the my_agent/agent.py file to integrate Tavily. Choose either Remote MCP Server or Local MCP Server:

Step 3: Set Your API Keys

Update the my_agent/.env file with your API keys:
Or manually edit the .env file:

Step 4: Run Your Agent

You can run your ADK agent in two ways:

Run with Command-Line Interface

Run your agent using the adk run command:
This starts an interactive command-line interface where you can chat with your agent and test Tavily’s capabilities.

Run with Web Interface

Start the ADK web interface for a visual testing experience:
Note: Run this command from the parent directory that contains your my_agent/ folder. For example, if your agent is inside agents/my_agent/, run adk web from the agents/ directory. This starts a web server with a chat interface. Access it at http://localhost:8000, select your agent from the dropdown, and start chatting.

Example Usage

Once your agent is set up and running, you can interact with it through the command-line interface or web interface. Here’s a simple example: User Query:
The agent automatically combines multiple Tavily tools to provide comprehensive answers, making it easy to explore websites and gather information without manual navigation.

Available Tools

Once connected, your agent gains access to Tavily’s powerful web intelligence tools: Execute a search query to find relevant information across the web.

tavily-extract

Extract structured data from any web page. Extract text, links, and images from single pages or batch process multiple URLs efficiently.

tavily-map

Traverses websites like a graph and can explore hundreds of paths in parallel with intelligent discovery to generate comprehensive site maps.

tavily-crawl

Traversal tool that can explore hundreds of paths in parallel with built-in extraction and intelligent discovery.