AI
AI SDK Patterns
PatternsLearnnewComposeGitHub
PatternsComposeLearnAI SDK DocsGitHub

Built with AI SDK · shadcn/ui · Next.js

© 2026 AI SDK Patterns

MCP Client Agent

Connect to any Model Context Protocol server, discover tools dynamically, and let the AI use them in a chat interface. Includes a demo MCP server with weather and calculator tools.

toolsadvanced
MCP Server:
http://localhost:3001/mcp
Connected
getWeathercalculateconvertUnits

🔒 Demo mode - connects to MCP servers for tool access

Install this lab

Option 1: shadcn CLI

pnpm dlx shadcn@latest add https://ai-sdk-patterns.vercel.app/r/mcp-client

Option 2: Copy or download

Use cases

Extensible AI Assistants

Build AI assistants that connect to any MCP-compatible tool server, gaining new capabilities without code changes.

Enterprise Tool Integration

Connect AI agents to internal APIs, databases, and services exposed as MCP servers for secure, governed tool access.

Related labs

Tool Calling

Let the AI model call functions and use external tools with the multi-step tool loop.

Multi-Step Agent

Build an agent that orchestrates multiple tool calls in sequence, using stopWhen: stepCountIs() and automatic tool result forwarding.