AI SDK MCP Bridge

v0.1.0APIsstable

Bridge package enabling seamless integration between Model Context Protocol (MCP) servers and AI SDK tools. Supports multiple server types, real-time communication, and TypeScript.

aisdkfunctioncallingmcpmcp-servermodelcontextprotocol
Share:
23
Stars
0
Downloads
0
Weekly
0/5

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

Connect MCP servers to AI SDK tools and function calling frameworks.
Enable real-time communication between AI agents and MCP tools.
vrknetha

Maintainer

LicenseMIT
Languagetypescript
Versionv0.1.0
UpdatedMay 8, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y aisdk-mcp-bridge

Manual Installation

npx -y aisdk-mcp-bridge

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

Install aisdk-mcp-bridge

Add the bridge package to your project via npm.

npm install aisdk-mcp-bridge
2

Create 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"
      }
    }
  }
}
3

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 });
4

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);
5

Clean up connections when done

Always call cleanupMcp when your application finishes to close all server connections gracefully.

await cleanupMcp();
6

Enable debug logging

Set the DEBUG environment variable to get detailed MCP communication logs for troubleshooting.

DEBUG=mcp node your-app.js

AI 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.

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.

Quick Config Preview

{ "mcpServers": { "aisdk-mcp-bridge": { "command": "npx", "args": ["-y", "aisdk-mcp-bridge"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides