Get the FREE Ultimate OpenClaw Setup Guide →

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio vrknetha-aisdk-mcp-bridge npx -y mcp-server-firecrawl \
  --env FIRE_CRAWL_API_KEY="your-firecrawl-api-key" \
  --env FIRE_CRAWL_API_URL="https://api.firecrawl.com"

How to use

AISDK MCP Bridge acts as a facilitator between MCP servers and the AI SDK. It can manage multiple MCP servers simultaneously, each potentially running in different environments (Node.js via npx, Python/uv, or other supported modes). You configure each server in an mcp.config.json file under mcpServers, then initialize MCP in your code to load tools from those servers and execute them through the bridge. The bridge exposes tools from all configured MCP servers so your AI models can call external capabilities (e.g., post tweets, crawl data, or perform custom actions) as if they were native tools. Use getMcpTools to fetch tools for either all servers or a specific server by name, and then pass those tools to your AI SDK workflow to perform actions or queries. The API supports executing a specific MCP function directly via executeMcpFunction if you know the server and function you want to run, enabling precise integrations with your models.

How to install

Prerequisites:

  • Node.js 14+ (recommended by the project, though the readme notes Node.js 20+ for development)
  • npm or pnpm

Installation steps:

  1. Create your project directory and navigate into it.
  2. Install the bridge package from npm:
npm install aisdk-mcp-bridge
  1. Create an mcp.config.json in your project root with your MCP server configurations (example shown below).
  2. In your application, initialize the MCP bridge and start querying tools as needed. Example usage is shown in the Quick Start section of the README for reference.

Tip: If you are using TypeScript, ensure your tsconfig is configured to allow module resolution for the bridge and that you have the required type definitions installed if you rely on TS typings.

Additional notes

Tips and common considerations:

  • The bridge supports multiple MCP servers independently; you can mix environments (e.g., Node.js servers with npx, Python/uv servers, etc.) by providing appropriate command and args per server.
  • Environment variables for each server are defined in the mcp.config.json under env; keep sensitive values secure and consider using a secrets manager in production.
  • Debug logging can be enabled by setting the DEBUG environment variable (e.g., DEBUG=mcp or DEBUG=*).
  • The bridge supports different communication modes, including stdio by default and SSE for real-time streaming. You can specify mode and related sseOptions if your MCP server uses SSE.
  • The mcp.config.json format is the primary mechanism for configuring multiple MCP servers; ensure the file is valid JSON and accessible to your application at runtime.
  • If you encounter issues, inspect logs at logs/mcp-tools.log and enable verbose debug output to trace tool registration and execution details.

Related MCP Servers

Sponsor this space

Reach thousands of developers