Getting Started
mcp-ts is a lightweight MCP (Model Context Protocol) client library for JavaScript applications. It provides seamless integration for both server-side and client-side MCP connections with real-time updates.
Why mcp-ts?
- Simple API — Easy-to-use methods for connecting to MCP servers
- Framework Ready — Built-in support for Next.js, React, and Vue
- SSE — Server-Sent Events for connection and observability
- Persistent Sessions — Automatic session management and recovery
- Flexible Storage — Multiple backend options (Redis, FS, Memory)
- MCP Apps (SEP-1865) — Interactive UIs for MCP tools
Quick Install
npm install @mcp-ts/sdk
Framework Guides
We provide first-class support for popular frameworks:
Integrations
Vercel AI SDK
mcp-ts provides first-class support for the Vercel AI SDK.
- Aggregated Tools — Use
MultiSessionClientto combine tools from multiple MCP servers. - Streaming — Perfect integration with
streamTextanduseChat.
Core Concepts
Understanding these pieces will help you build faster:
- Storage Backend — Where your MCP session data lives. Use Redis for production or File System for local dev.
- Server Handler — The API route that bridges your storage and the client. See Next.js or Installation.
- Client Hook — The frontend composable/hook that manages the SSE connection and tool calls.
- Adapters — Transform MCP tools into framework-specific formats. See Adapters.
- AG-UI Middleware — Execute MCP tools server-side when using remote agents. See AG-UI Middleware.
- MCP Apps — Render interactive UI components from MCP servers. See MCP Apps.
Next Steps
- Installation — Detailed manual setup instructions
- Storage Backends — Deep dive into storage options
- API Reference — Full technical documentation