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 theadk create command to start a new agent project:
Step 2: Update Your Agent Code
Edit themy_agent/agent.py file to integrate Tavily. Choose either Remote MCP Server or Local MCP Server:
Step 3: Set Your API Keys
Update themy_agent/.env file with your API keys:
.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 theadk run command:
Run with Web Interface
Start the ADK web interface for a visual testing experience: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: