AI SDK MCP Bridge
Bridge package enabling seamless integration between Model Context Protocol (MCP) servers and AI SDK tools. Supports multiple server types, real-time communication, and TypeScript.
What is AI SDK MCP Bridge?
AI SDK MCP Bridge is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to bridge package enabling seamless integration between model context protocol (mcp) servers and ai sdk tools. supports multiple server types, real-time communication, and typescript.
Bridge package enabling seamless integration between Model Context Protocol (MCP) servers and AI SDK tools. Supports multiple server types, real-time communication, and TypeScript.
This server falls under the APIs and Developer Tools categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Bridge package enabling seamless integration between Model C
Use Cases
Maintainer
Works with
Installation
NPM
npx -y aisdk-mcp-bridgeManual Installation
npx -y aisdk-mcp-bridgeConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use AI SDK MCP Bridge
aisdk-mcp-bridge is a TypeScript/Node.js package that acts as a translation layer between MCP servers and the Vercel AI SDK's tool-calling interface, letting you use any MCP server's tools directly inside AI SDK `generateText` or `streamText` calls. It manages the full lifecycle of MCP server connections — initialization, tool discovery, execution, and cleanup — and supports both stdio and SSE transport modes. Developers building AI agents with the AI SDK who want to leverage MCP's growing ecosystem of tools without writing their own bridge code use this package to wire everything together in a few lines.
Prerequisites
- Node.js 18 or later
- npm or yarn package manager
- The Vercel AI SDK (@ai-sdk/* packages) installed in your project
- One or more MCP servers you want to connect to (stdio or SSE)
- API keys for any AI providers you use (e.g. Google, Anthropic, OpenAI)
Install aisdk-mcp-bridge
Add the bridge package to your project via npm.
npm install aisdk-mcp-bridgeCreate an mcp.config.json file
Define your MCP server connections in a config file. Each server entry specifies the transport type and command or URL, plus any required environment variables.
{
"servers": {
"firecrawl": {
"type": "stdio",
"command": "npx",
"args": ["-y", "firecrawl-mcp"],
"env": {
"FIRE_CRAWL_API_KEY": "your-firecrawl-api-key",
"FIRE_CRAWL_API_URL": "https://api.firecrawl.dev"
}
}
}
}Initialize the MCP bridge and retrieve tools
In your application code, initialize the MCP service and get AI SDK-compatible tool definitions from all configured servers.
import { initializeMcp, getMcpTools, cleanupMcp } from 'aisdk-mcp-bridge';
await initializeMcp({ debug: true });
const allTools = await getMcpTools({ debug: true });Use MCP tools in an AI SDK generateText call
Pass the retrieved tools directly to generateText or streamText from the Vercel AI SDK.
import { generateText } from 'ai';
import { google } from '@ai-sdk/google';
const result = await generateText({
model: google('gemini-1.5-pro'),
tools: allTools,
prompt: 'Search for the latest news on Model Context Protocol and summarize it.',
maxSteps: 5,
});
console.log(result.text);Clean up connections when done
Always call cleanupMcp when your application finishes to close all server connections gracefully.
await cleanupMcp();Enable debug logging
Set the DEBUG environment variable to get detailed MCP communication logs for troubleshooting.
DEBUG=mcp node your-app.jsAI SDK MCP Bridge Examples
Client configuration
Example mcp.config.json for connecting a Twitter MCP server via stdio with required API credentials.
{
"servers": {
"twitter": {
"type": "stdio",
"command": "npx",
"args": ["-y", "twitter-mcp"],
"env": {
"API_KEY": "your-twitter-api-key",
"API_SECRET_KEY": "your-twitter-api-secret",
"ACCESS_TOKEN": "your-access-token",
"ACCESS_TOKEN_SECRET": "your-access-token-secret"
}
}
}
}Prompts to try
Example prompts and use cases once MCP tools are wired into your AI SDK agent.
- "Search the web for recent papers on AI agents and return the top 5 results"
- "Post a tweet summarizing the latest MCP release notes"
- "Crawl https://example.com and extract all product prices"
- "List all tools available from the connected MCP servers"
- "Execute the firecrawl scrape tool on this URL and return the markdown content"Troubleshooting AI SDK MCP Bridge
getMcpTools returns an empty object with no tools
Ensure initializeMcp() completes successfully before calling getMcpTools(). Enable debug logging with `{ debug: true }` to see connection attempts and verify your mcp.config.json is in the project root or the expected config path.
MCP server subprocess fails to start with ENOENT
The command specified in mcp.config.json (e.g. npx or node) must be on the PATH of the process running your application. Verify with `which npx` and ensure the MCP server package name in args is correct.
TypeScript type errors when passing MCP tools to generateText
Ensure your @ai-sdk/* packages are up to date and compatible with the aisdk-mcp-bridge version you installed. The tools object returned by getMcpTools() is typed to match AI SDK's ToolSet interface.
Frequently Asked Questions about AI SDK MCP Bridge
What is AI SDK MCP Bridge?
AI SDK MCP Bridge is a Model Context Protocol (MCP) server that bridge package enabling seamless integration between model context protocol (mcp) servers and ai sdk tools. supports multiple server types, real-time communication, and typescript. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install AI SDK MCP Bridge?
Install via npm with the command: npx -y aisdk-mcp-bridge. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with AI SDK MCP Bridge?
AI SDK MCP Bridge works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is AI SDK MCP Bridge free to use?
Yes, AI SDK MCP Bridge is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
AI SDK MCP Bridge Alternatives — Similar APIs Servers
Looking for alternatives to AI SDK MCP Bridge? Here are other popular apis servers you can use with Claude, Cursor, and VS Code.
Kong
★ 43.4k🦍 The API and AI Gateway
API Mega List
★ 5.4kThis GitHub repo is a powerhouse collection of APIs you can start using immediately to build everything from simple automations to full-scale applications. One of the most valuable API lists on GitHub—period. 💪
Fetch
★ 5.4kFetch web content and convert to markdown for AI consumption
Fusio
★ 2.1kSelf-Hosted API Management for Builders
Korean Law
★ 1.8k국가법령정보MCP v4.0 | 법제처 41개 API → 17개 MCP 도구. 법령·판례·조례 검색 + LLM 환각 방지 인용검증 + 조문 영향 그래프(impact_map) + 시점 비교 자동 diff(time_travel) + 시민 5단계 실행 가이드(action_plan) | 41 Korean legal APIs → 17 MCP tools
RuleGo
★ 1.5k⛓️RuleGo is a lightweight, high-performance, embedded, next-generation component orchestration rule engine framework for Go.
Browse More APIs MCP Servers
Explore all apis servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up AI SDK MCP Bridge in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use AI SDK MCP Bridge?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.