
MCP to AI SDK
https://github.com/vercel-labs/mcp-to-ai-sdk- Category
- AI Tools
- Rank
- No. 1577Tools index
Previous survey · No. 1585 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- vercel-labs
- GitHub
- 123 stars
- Latest release
- v0.1.1
- Date
About
Adapter that exposes any MCP server's tools to the Vercel AI SDK — drop MCP tools into your agent in one line.
What it does
This command-line generator reads an MCP server’s published tool definitions and writes editable TypeScript source into your project. It creates validation schemas, per-tool wrappers, grouped exports, and a shared client that connects when first needed.
Why it's ranked here
The strongest case is control: generated source freezes the discovered tool set for inspection and local editing. That helps teams limit exposed tools, narrow arguments, and avoid silent definition changes. The rough edges around URL paths, local servers, and missing tests make adoption best suited to engineers willing to inspect the output.
What's good
It supports Streamable HTTP, server-sent events, and local discovery over standard input and output. OAuth discovery includes PKCE and state checking, while manual authentication headers become placeholders instead of copied secrets. Existing changed files trigger an overwrite prompt. Generated wrappers convert JSON Schema to Zod and permit shared or injected clients.
Tradeoffs
Local server discovery conflicts with generation because wrapper generation rejects inputs that are not URLs. Generated HTTP clients reduce endpoints to their protocol and host, so path-based endpoints can point somewhere different at runtime. OAuth tokens require manual runtime configuration. Tool results are flattened to strings, and the package’s test command explicitly reports that no tests are specified.
How to use it well
Use it when a TypeScript agent team wants MCP capabilities captured as reviewable, editable source before deployment. Generate once, select only required tools, narrow broad schemas, configure runtime authentication, and verify endpoint paths. It does not replace the MCP server, provide credentials, preserve structured result types, or remove the need to test generated integrations.
Technical notes+
mcp-tools-cli.ts discovers tools, formats generated TypeScript, prompts before overwriting changed files, and writes client, wrapper, and index sources. lib/mcp-client.ts selects StdioClientTransport, SSEClientTransport, or StreamableHTTPClientTransport, applies a ten-second connection race, and retries HTTP discovery after OAuth. lib/tool-generator.ts uses json-schema-to-zod, validates identifiers, requires mcpUrl to parse as a URL, and serializes MCP content to strings. lib/client-generator.ts strips URL paths when building the runtime transport and substitutes header values with placeholders. lib/oauth-handler.ts implements a localhost callback, PKCE, state validation, metadata discovery, token exchange, and browser opening. package.json publishes only dist/**/*, maps the CLI binary, and defines a test script that exits with no test specified.
Observed
- License
- Apache-2.0
- Primary language
- TypeScript
- Install surface
- Public npm package intended for direct npx execution
- Interface
- Command-line source generator producing Vercel AI SDK tool wrappers
- Supported transports
- Streamable HTTP, Server-Sent Events, and standard input/output for local servers
- Generated runtime dependencies
- AI SDK, Zod, and the Model Context Protocol SDK
- Testing
- The package test script reports that no test is specified
Read from README.md, package.json, lib/utils.ts, lib/formatter.ts, lib/mcp-client.ts, lib/oauth-handler.ts, lib/tool-generator.ts, lib/index-generator.ts, lib/client-generator.ts, mcp-tools-cli.ts, samples/grep-app-test.ts, mcps/mcp.grep.app/index.ts, mcps/mcp.grep.app/client.ts, mcps/mcp.vercel.com/index.ts, mcps/mcp.vercel.com/client.ts.
What it can do
Expose MCP server tools to Vercel AI SDK
MCP server with available tools → Tools accessible through Vercel AI SDK interface
Convert MCP tool format to AI SDK format
MCP tool definitions and functions → AI SDK compatible tool definitions
Integrate MCP tools into AI agents
MCP server tools and AI agent configuration → AI agent with MCP tool capabilities
Enable one-line MCP tool integration
Single line of integration code → Fully functional MCP tools in AI application
Bridge MCP protocol with Vercel AI SDK
MCP protocol messages and AI SDK requests → Translated communication between systems
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.