<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce" -->

---
title: TanStack AI: Your MCP, your way | daily.dev
description: TanStack AI introduces @tanstack/ai-mcp, a host-side Model Context Protocol client that converts any MCP server into standard ServerTool[] objects usable in...
canonical: https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: TanStack AI: Your MCP, your way | daily.dev
og:description: TanStack AI introduces @tanstack/ai-mcp, a host-side Model Context Protocol client that converts any MCP server into standard ServerTool[] objects usable in...
og:url: https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce
og:image: https://api.daily.dev/og/posts/q9eZaHHCE.png
og:image:alt: TanStack AI: Your MCP, your way
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# TanStack AI: Your MCP, your way

**[TanStack](https://daily.dev/sources/tanstack-blog)** · 14 min read · 0 upvotes · 0 comments

## Summary

TanStack AI introduces @tanstack/ai-mcp, a host-side Model Context Protocol client that converts any MCP server into standard ServerTool[] objects usable in chat(). It supports HTTP, SSE, stdio, and custom transports, connects to single servers or pools of servers via createMCPClients, and offers three typing levels ranging from zero-config discovery to fully generated end-to-end types via a codegen CLI. A managed 'mcp' option in chat() handles automatic tool discovery and connection lifecycle (close or keep-alive), lazy tool loading, and discovery error handling. The runtime stays edge-deployable since Node-only code (stdio transport, codegen CLI) is isolated behind subpaths.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://tanstack.com/blog/your-mcp-your-way>

## Questions this post answers

### How do I connect an MCP server to TanStack AI's chat function?

Use createMCPClient from @tanstack/ai-mcp to connect to a server, then spread mcp.tools() into chat()'s tools array. The client turns any MCP server into standard ServerTool[] objects, so any adapter like OpenAI, Anthropic, Gemini, or Ollama works unchanged since TanStack AI never knows MCP was involved.

_Developers wiring MCP servers into chat apps can follow ecosystem updates like this on daily.dev._

### How can I connect to multiple MCP servers at once with TanStack AI?

Use createMCPClients, which accepts a Record of named server configs and connects to them in parallel, merging their tools into one flat array. Each server's tools are prefixed by its config key by default (overridable per client), and the resulting pool exposes pool.clients[name] plus a combined tools() and close() method matching the single-client interface.

_Teams combining multiple tool servers in one agent can track patterns like this on daily.dev._

### How do I get fully typed MCP tool arguments in TypeScript instead of unknown types?

Run the @tanstack/ai-mcp codegen CLI (npx @tanstack/ai-mcp generate) against a live server to emit per-server interface types extending ServerDescriptor, then pass that type as a generic to createMCPClient or createMCPClients. This narrows tool names to literal strings at compile time with zero runtime cost, though full argument typing requires combining it with toolDefinition() for a Zod-validated allowlist.

_Developers weighing type-safety trade-offs in AI tool integrations can follow updates like this on daily.dev._

## Similar posts on daily.dev

- [Model Context Protocol Explained in 3 Levels of Difficulty](https://daily.dev/posts/model-context-protocol-explained-in-3-levels-of-difficulty-qr2eqsxue) · Machine Learning Mastery · 1 upvotes · 0 comments
- [Introduction to the Model Context Protocol \(MCP\) Java SDK](https://daily.dev/posts/introduction-to-the-model-context-protocol-mcp-java-sdk-nhpl9gsbn) · Baeldung · 4 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#typescript](https://daily.dev/tags/typescript), [#mcp](https://daily.dev/tags/mcp), [#tanstack](https://daily.dev/tags/tanstack)

[View this post on daily.dev](https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"TanStack AI: Your MCP, your way","url":"https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce"},"datePublished":"2026-08-23T12:22:21.818Z","dateModified":"2026-08-23T12:44:13.012Z","description":"TanStack AI introduces @tanstack/ai-mcp, a host-side Model Context Protocol client that converts any MCP server into standard ServerTool[] objects usable in...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/59c7d9152d84c1f204ad224e4b6ddb2c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/59c7d9152d84c1f204ad224e4b6ddb2c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"TanStack","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"TanStack","logo":"https://media.daily.dev/image/upload/s--TVIrvIT7--/f_auto,q_auto/v1787487634/logos/tanstack-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/tanstack-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,typescript,mcp,tanstack","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"TanStack","item":"https://daily.dev/sources/tanstack-blog"},{"@type":"ListItem","position":3,"name":"TanStack AI: Your MCP, your way"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/tanstack-ai-your-mcp-your-way-q9ezahhce#faq","mainEntity":[{"@type":"Question","name":"How do I connect an MCP server to TanStack AI's chat function?","acceptedAnswer":{"@type":"Answer","text":"Use createMCPClient from @tanstack/ai-mcp to connect to a server, then spread mcp.tools() into chat()'s tools array. The client turns any MCP server into standard ServerTool[] objects, so any adapter like OpenAI, Anthropic, Gemini, or Ollama works unchanged since TanStack AI never knows MCP was involved. Developers wiring MCP servers into chat apps can follow ecosystem updates like this on daily.dev."}},{"@type":"Question","name":"How can I connect to multiple MCP servers at once with TanStack AI?","acceptedAnswer":{"@type":"Answer","text":"Use createMCPClients, which accepts a Record of named server configs and connects to them in parallel, merging their tools into one flat array. Each server's tools are prefixed by its config key by default (overridable per client), and the resulting pool exposes pool.clients[name] plus a combined tools() and close() method matching the single-client interface. Teams combining multiple tool servers in one agent can track patterns like this on daily.dev."}},{"@type":"Question","name":"How do I get fully typed MCP tool arguments in TypeScript instead of unknown types?","acceptedAnswer":{"@type":"Answer","text":"Run the @tanstack/ai-mcp codegen CLI (npx @tanstack/ai-mcp generate) against a live server to emit per-server interface types extending ServerDescriptor, then pass that type as a generic to createMCPClient or createMCPClients. This narrows tool names to literal strings at compile time with zero runtime cost, though full argument typing requires combining it with toolDefinition() for a Zod-validated allowlist. Developers weighing type-safety trade-offs in AI tool integrations can follow updates like this on daily.dev."}}]}
```

