TanStack AI has introduced host-side Model Context Protocol (MCP) support via the @tanstack/ai-mcp package, allowing developers to expose any MCP server as type-safe tools for AI agents.
TanStack AI now has first-class, host-side Model Context Protocol (MCP) support. The new `@tanstack/ai-mcp` library treats MCP clients as tool factories that return ordinary server tools, which can be fanned out into chat functions across any LLM adapter or agent framework. It supports both standalone clients and pooled clients with automatic name prefixing to prevent collisions, managed lifecycle operations to avoid connection leaks, and three distinct modes of type safety ranging from zero-config runtime discovery to CLI-generated compile-time TypeScript types.
Decoupling MCP from the core chat client by treating it purely as a tool factory is an elegant architectural choice that ensures compatibility with any adapter (OpenAI, Gemini, Anthropic) and keeps the runtime edge-safe.
- –**Edge Deployment Friendly**: Transports like HTTP are fully edge-safe, while stdio transport imports are isolated behind a Node-only subpath, and heavy CLI code-generation dependencies remain strictly in the binary.
- –**Three Typing Tiers**: Zero-config auto-discovery, manual Zod-validated schemas, and CLI typegen provide developers with granular control over the performance-type-safety trade-off.
- –**Lifecycle Integration**: Leveraging `asyncDispose` and managed `chat({ mcp })` prevents dangling connections in serverless or stateful environments.
DISCOVERED
2h ago
2026-06-05
PUBLISHED
2h ago
2026-06-05
RELEVANCE
AUTHOR
tan_stack