[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [AI SDK](/c/ai-sdk/62) # How do I connect Tavily MCP with Vercel AI SDK? 170 views · 0 likes · 2 posts Mxhiraz (@mxhiraz) · 2025-08-27 How to connect Tavily ([https://www.tavily.com](https://www.tavily.com/)) MCP with the Vercel AI SDK Amy Egan (@amyegan) · 2025-08-27 Asked [v0](https://v0.app) for the answer, and here's what it gave me: > You can connect Tavily’s MCP (Model Context Protocol) server with the Vercel AI SDK using the new MCP client support introduced in AI SDK 4.2. > > Here’s how to set it up: > > ## Using Tavily’s Remote MCP Server > > The easiest way is to use Tavily’s remote MCP server directly: > > ``` > import { createMCPClient } from '@ai-sdk/mcp' > > const mcpClient = createMCPClient({ > name: 'tavily', > version: '1.0.0', > transport: { > type: 'http', > url: 'https://mcp.tavily.com/mcp/?tavilyApiKey=YOUR_TAVILY_API_KEY' > } > }) > ``` > > ## Using with AI SDK Functions > > Once connected, you can use Tavily’s search tools in your AI SDK functions: > > ``` > import { generateText } from 'ai' > import { openai } from '@ai-sdk/openai' > > const { text } = await generateText({ > model: openai('gpt-4'), > prompt: 'Search for the latest news about AI developments', > tools: await mcpClient.getTools(), // This includes tavily-search, tavily-extract, etc. > }) > ``` > > ## Available Tavily Tools > > The Tavily MCP server provides several tools: > > * `tavily-search`: Real-time web search > * `tavily-extract`: Intelligent data extraction from web pages > * `tavily-map`: Creates structured maps of websites > * `tavily-crawl`: Systematically explores websites > > Make sure to get your Tavily API key from [tavily.com](https://tavily.com/) and replace `YOUR_TAVILY_API_KEY` in the URL. > > **Resources:** > > * [AI SDK MCP Documentation](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling#mcp-tools) > * [Tavily MCP GitHub Repository](https://github.com/tavily-ai/tavily-mcp) I hope that helps!