1.0.0 • Published 1 year ago

mcp-bridge v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

MCP Bridge

A TypeScript utility that bridges the Model Context Protocol (MCP) with the Vercel AI SDK.

Features

  • Converts MCP tools into Vercel AI SDK compatible tools

Installation

npm install mcp-bridge

Usage

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { getToolSet } from "mcp-bridge";
import { generateText } from "ai";

// Initialize your MCP client
const client = new Client(/* your config */);
await client.connect(/* client transport */);

// Get the tool set
const toolSet = await getToolSet(client);

// Use the tools with the Vercel AI SDK
// The toolSet object will contain all the MCP tools converted to AI SDK format
// e.g.

const result = await generateText({
  model: yourModel,
  tools: toolSet,
  prompt: 'What is the weather in San Francisco?',
});
1.0.0

1 year ago