@assistant-ui/mcp-docs-server 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/.docs/organized/code-examples/waterfall.md +8 -8
  2. package/.docs/organized/code-examples/with-a2a.md +10 -10
  3. package/.docs/organized/code-examples/with-ag-ui.md +12 -12
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +14 -14
  5. package/.docs/organized/code-examples/with-artifacts.md +14 -14
  6. package/.docs/organized/code-examples/with-assistant-transport.md +11 -11
  7. package/.docs/organized/code-examples/with-browser-extension.md +345 -0
  8. package/.docs/organized/code-examples/with-chain-of-thought.md +129 -63
  9. package/.docs/organized/code-examples/with-cloud-standalone.md +13 -13
  10. package/.docs/organized/code-examples/with-cloud.md +13 -13
  11. package/.docs/organized/code-examples/with-custom-thread-list.md +65 -20
  12. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +18 -17
  13. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +18 -17
  14. package/.docs/organized/code-examples/with-expo.md +25 -25
  15. package/.docs/organized/code-examples/with-external-store.md +10 -10
  16. package/.docs/organized/code-examples/with-ffmpeg.md +14 -14
  17. package/.docs/organized/code-examples/with-generative-ui.md +211 -14
  18. package/.docs/organized/code-examples/with-google-adk.md +12 -12
  19. package/.docs/organized/code-examples/with-heat-graph.md +8 -8
  20. package/.docs/organized/code-examples/with-image-generation.md +454 -0
  21. package/.docs/organized/code-examples/with-interactables.md +14 -14
  22. package/.docs/organized/code-examples/with-langchain.md +12 -12
  23. package/.docs/organized/code-examples/with-langgraph.md +15 -12
  24. package/.docs/organized/code-examples/with-livekit.md +19 -18
  25. package/.docs/organized/code-examples/with-mcp.md +748 -0
  26. package/.docs/organized/code-examples/with-opencode.md +107 -62
  27. package/.docs/organized/code-examples/with-parent-id-grouping.md +12 -12
  28. package/.docs/organized/code-examples/with-react-hook-form.md +14 -14
  29. package/.docs/organized/code-examples/with-react-ink.md +4 -4
  30. package/.docs/organized/code-examples/with-react-router.md +16 -16
  31. package/.docs/organized/code-examples/with-resumable-stream.md +660 -0
  32. package/.docs/organized/code-examples/with-store.md +8 -8
  33. package/.docs/organized/code-examples/with-tanstack.md +14 -14
  34. package/.docs/organized/code-examples/with-tap-runtime.md +11 -10
  35. package/.docs/raw/docs/(docs)/cli.mdx +3 -1
  36. package/.docs/raw/docs/(docs)/copilots/assistant-frame.mdx +1 -0
  37. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +10 -3
  38. package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +8 -3
  39. package/.docs/raw/docs/(docs)/copilots/make-assistant-visible.mdx +1 -0
  40. package/.docs/raw/docs/(docs)/copilots/model-context.mdx +1 -0
  41. package/.docs/raw/docs/(docs)/copilots/motivation.mdx +1 -0
  42. package/.docs/raw/docs/(docs)/copilots/use-assistant-instructions.mdx +1 -0
  43. package/.docs/raw/docs/(docs)/devtools.mdx +1 -0
  44. package/.docs/raw/docs/(docs)/index.mdx +3 -2
  45. package/.docs/raw/docs/(docs)/installation.mdx +2 -1
  46. package/.docs/raw/docs/(docs)/rtl.mdx +1 -0
  47. package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +36 -0
  48. package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +20 -0
  49. package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +34 -0
  50. package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +44 -0
  51. package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +55 -0
  52. package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +20 -0
  53. package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +20 -0
  54. package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +37 -8
  55. package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +22 -0
  56. package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +64 -0
  57. package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +22 -0
  58. package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +52 -0
  59. package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +36 -0
  60. package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +98 -0
  61. package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +31 -0
  62. package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +33 -0
  63. package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +640 -0
  64. package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +28 -0
  65. package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +94 -0
  66. package/.docs/raw/docs/(reference)/api-reference/hooks/utilities.mdx +464 -0
  67. package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +24 -0
  68. package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +22 -0
  69. package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +79 -0
  70. package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +52 -0
  71. package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +22 -0
  72. package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +20 -0
  73. package/.docs/raw/docs/(reference)/api-reference/overview.mdx +125 -125
  74. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +78 -221
  75. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +127 -242
  76. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +46 -20
  77. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +66 -87
  78. package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +50 -58
  79. package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +80 -48
  80. package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +67 -0
  81. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +323 -461
  82. package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +36 -43
  83. package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +70 -0
  84. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +63 -245
  85. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +182 -554
  86. package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +65 -0
  87. package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +35 -22
  88. package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +57 -140
  89. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +70 -161
  90. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +84 -108
  91. package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +82 -86
  92. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +173 -314
  93. package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +9 -21
  94. package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +10 -21
  95. package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +15 -70
  96. package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +43 -0
  97. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +25 -28
  98. package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +11 -63
  99. package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +20 -0
  100. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +11 -48
  101. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +10 -42
  102. package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +18 -30
  103. package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +68 -0
  104. package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +39 -0
  105. package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +79 -0
  106. package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +42 -0
  107. package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +92 -0
  108. package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +48 -0
  109. package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +62 -0
  110. package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +22 -0
  111. package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +19 -0
  112. package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +131 -0
  113. package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +22 -0
  114. package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +54 -0
  115. package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +36 -0
  116. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +230 -2
  117. package/.docs/raw/docs/cloud/ai-sdk.mdx +222 -4
  118. package/.docs/raw/docs/cloud/index.mdx +2 -2
  119. package/.docs/raw/docs/cloud/langgraph.mdx +274 -2
  120. package/.docs/raw/docs/{(docs)/guides → guides}/attachments.mdx +45 -40
  121. package/.docs/raw/docs/guides/branching.mdx +76 -0
  122. package/.docs/raw/docs/guides/chain-of-thought.mdx +166 -0
  123. package/.docs/raw/docs/{(docs)/guides → guides}/context-api.mdx +54 -26
  124. package/.docs/raw/docs/{(docs)/guides → guides}/dictation.mdx +3 -1
  125. package/.docs/raw/docs/guides/editing.mdx +102 -0
  126. package/.docs/raw/docs/guides/generative-ui.mdx +142 -0
  127. package/.docs/raw/docs/guides/image-generation.mdx +74 -0
  128. package/.docs/raw/docs/guides/index.mdx +103 -0
  129. package/.docs/raw/docs/{(docs)/guides → guides}/interactables.mdx +51 -2
  130. package/.docs/raw/docs/{(docs)/guides → guides}/latex.mdx +53 -10
  131. package/.docs/raw/docs/guides/mcp-apps.mdx +231 -0
  132. package/.docs/raw/docs/{(docs)/guides → guides}/mentions.mdx +63 -88
  133. package/.docs/raw/docs/{(docs)/guides → guides}/message-timing.mdx +45 -6
  134. package/.docs/raw/docs/{(docs)/guides → guides}/multi-agent.mdx +66 -6
  135. package/.docs/raw/docs/{(docs)/guides → guides}/quoting.mdx +11 -18
  136. package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +212 -0
  137. package/.docs/raw/docs/guides/resumable-stream-stores.mdx +152 -0
  138. package/.docs/raw/docs/guides/resumable-streams.mdx +210 -0
  139. package/.docs/raw/docs/{(docs)/guides → guides}/slash-commands.mdx +104 -38
  140. package/.docs/raw/docs/guides/speech.mdx +156 -0
  141. package/.docs/raw/docs/{(docs)/guides → guides}/suggestions.mdx +91 -69
  142. package/.docs/raw/docs/{(docs)/guides → guides}/tool-ui.mdx +110 -38
  143. package/.docs/raw/docs/{(docs)/guides → guides}/tools.mdx +197 -40
  144. package/.docs/raw/docs/{(docs)/guides → guides}/voice.mdx +41 -2
  145. package/.docs/raw/docs/ink/adapters.mdx +37 -1
  146. package/.docs/raw/docs/ink/custom-backend.mdx +59 -8
  147. package/.docs/raw/docs/ink/index.mdx +11 -14
  148. package/.docs/raw/docs/ink/migration.mdx +1 -3
  149. package/.docs/raw/docs/ink/primitives.mdx +386 -9
  150. package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +520 -0
  151. package/.docs/raw/docs/integrations/auth/better-auth.mdx +191 -0
  152. package/.docs/raw/docs/integrations/auth/clerk.mdx +172 -0
  153. package/.docs/raw/docs/integrations/auth/next-auth.mdx +196 -0
  154. package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +79 -0
  155. package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +282 -0
  156. package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +188 -0
  157. package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +57 -0
  158. package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +201 -0
  159. package/.docs/raw/docs/integrations/gateways/index.mdx +162 -0
  160. package/.docs/raw/docs/integrations/index.mdx +185 -0
  161. package/.docs/raw/docs/integrations/observability/helicone.mdx +130 -0
  162. package/.docs/raw/docs/integrations/observability/langfuse.mdx +163 -0
  163. package/.docs/raw/docs/integrations/observability/langsmith.mdx +150 -0
  164. package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +712 -0
  165. package/.docs/raw/docs/integrations/tools/mcp.mdx +267 -0
  166. package/.docs/raw/docs/integrations/tools/react-mcp.mdx +337 -0
  167. package/.docs/raw/docs/migrations/v0-14.mdx +297 -0
  168. package/.docs/raw/docs/primitives/action-bar.mdx +1 -0
  169. package/.docs/raw/docs/primitives/assistant-modal.mdx +1 -0
  170. package/.docs/raw/docs/primitives/attachment.mdx +1 -0
  171. package/.docs/raw/docs/primitives/branch-picker.mdx +1 -0
  172. package/.docs/raw/docs/primitives/chain-of-thought.mdx +90 -85
  173. package/.docs/raw/docs/primitives/composer.mdx +55 -1
  174. package/.docs/raw/docs/primitives/error.mdx +1 -0
  175. package/.docs/raw/docs/primitives/index.mdx +4 -3
  176. package/.docs/raw/docs/primitives/message.mdx +68 -5
  177. package/.docs/raw/docs/primitives/selection-toolbar.mdx +1 -0
  178. package/.docs/raw/docs/primitives/suggestion.mdx +10 -0
  179. package/.docs/raw/docs/primitives/thread-list.mdx +39 -0
  180. package/.docs/raw/docs/primitives/thread.mdx +16 -13
  181. package/.docs/raw/docs/react-native/hooks.mdx +2 -2
  182. package/.docs/raw/docs/react-native/index.mdx +5 -7
  183. package/.docs/raw/docs/react-native/migration.mdx +1 -3
  184. package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +396 -0
  185. package/.docs/raw/docs/runtimes/a2a/overview.mdx +60 -0
  186. package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +216 -0
  187. package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +70 -0
  188. package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +243 -0
  189. package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +154 -0
  190. package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +52 -0
  191. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +73 -128
  192. package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +70 -64
  193. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +337 -123
  194. package/.docs/raw/docs/runtimes/concepts/adapters.mdx +265 -0
  195. package/.docs/raw/docs/runtimes/concepts/architecture.mdx +125 -0
  196. package/.docs/raw/docs/runtimes/concepts/stability.mdx +67 -0
  197. package/.docs/raw/docs/runtimes/concepts/threads.mdx +428 -0
  198. package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +703 -0
  199. package/.docs/raw/docs/runtimes/custom/data-stream.mdx +348 -0
  200. package/.docs/raw/docs/runtimes/custom/external-store.mdx +261 -1236
  201. package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +746 -0
  202. package/.docs/raw/docs/runtimes/custom/overview.mdx +71 -0
  203. package/.docs/raw/docs/runtimes/google-adk/api.mdx +256 -0
  204. package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +717 -0
  205. package/.docs/raw/docs/runtimes/google-adk/overview.mdx +69 -0
  206. package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +229 -0
  207. package/.docs/raw/docs/runtimes/langchain.mdx +533 -0
  208. package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +305 -0
  209. package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +104 -0
  210. package/.docs/raw/docs/runtimes/langgraph/overview.mdx +84 -0
  211. package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +496 -0
  212. package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +127 -0
  213. package/.docs/raw/docs/runtimes/langgraph/threads.mdx +113 -0
  214. package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +3 -3
  215. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -23
  216. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  217. package/.docs/raw/docs/runtimes/opencode/hooks.mdx +191 -0
  218. package/.docs/raw/docs/runtimes/opencode/overview.mdx +48 -0
  219. package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +119 -0
  220. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +78 -203
  221. package/.docs/raw/docs/ui/accordion.mdx +1 -0
  222. package/.docs/raw/docs/ui/assistant-modal.mdx +1 -0
  223. package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -0
  224. package/.docs/raw/docs/ui/attachment.mdx +1 -0
  225. package/.docs/raw/docs/ui/badge.mdx +1 -0
  226. package/.docs/raw/docs/ui/composer-trigger-popover.mdx +12 -1
  227. package/.docs/raw/docs/ui/context-display.mdx +1 -0
  228. package/.docs/raw/docs/ui/diff-viewer.mdx +1 -0
  229. package/.docs/raw/docs/ui/directive-text.mdx +1 -0
  230. package/.docs/raw/docs/ui/file.mdx +1 -0
  231. package/.docs/raw/docs/ui/image.mdx +1 -0
  232. package/.docs/raw/docs/ui/markdown.mdx +2 -14
  233. package/.docs/raw/docs/ui/mcp-config.mdx +102 -0
  234. package/.docs/raw/docs/ui/mermaid.mdx +1 -0
  235. package/.docs/raw/docs/ui/message-timing.mdx +3 -2
  236. package/.docs/raw/docs/ui/model-selector.mdx +9 -8
  237. package/.docs/raw/docs/ui/part-grouping.mdx +325 -313
  238. package/.docs/raw/docs/ui/quote.mdx +1 -0
  239. package/.docs/raw/docs/ui/reasoning.mdx +66 -33
  240. package/.docs/raw/docs/ui/scrollbar.mdx +1 -0
  241. package/.docs/raw/docs/ui/select.mdx +1 -0
  242. package/.docs/raw/docs/ui/sources.mdx +18 -0
  243. package/.docs/raw/docs/ui/streamdown.mdx +35 -2
  244. package/.docs/raw/docs/ui/syntax-highlighting.mdx +1 -0
  245. package/.docs/raw/docs/ui/tabs.mdx +1 -0
  246. package/.docs/raw/docs/ui/thread-list.mdx +19 -2
  247. package/.docs/raw/docs/ui/thread.mdx +58 -3
  248. package/.docs/raw/docs/ui/tool-fallback.mdx +1 -0
  249. package/.docs/raw/docs/ui/tool-group.mdx +39 -11
  250. package/.docs/raw/docs/ui/voice.mdx +1 -0
  251. package/.docs/raw/docs/utilities/heat-graph.mdx +1 -0
  252. package/.docs/raw/docs/utilities/react-o11y.mdx +278 -0
  253. package/.docs/raw/docs/utilities/tw-shimmer.mdx +1 -0
  254. package/README.md +14 -72
  255. package/dist/constants.d.ts +12 -9
  256. package/dist/constants.d.ts.map +1 -1
  257. package/dist/constants.js +13 -9
  258. package/dist/constants.js.map +1 -1
  259. package/dist/index.d.ts +7 -3
  260. package/dist/index.d.ts.map +1 -1
  261. package/dist/index.js +25 -24
  262. package/dist/index.js.map +1 -1
  263. package/dist/prepare-docs/code-examples.d.ts +4 -1
  264. package/dist/prepare-docs/code-examples.d.ts.map +1 -1
  265. package/dist/prepare-docs/code-examples.js +109 -121
  266. package/dist/prepare-docs/code-examples.js.map +1 -1
  267. package/dist/prepare-docs/copy-raw.d.ts +4 -1
  268. package/dist/prepare-docs/copy-raw.d.ts.map +1 -1
  269. package/dist/prepare-docs/copy-raw.js +45 -42
  270. package/dist/prepare-docs/copy-raw.js.map +1 -1
  271. package/dist/prepare-docs/prepare.d.ts +1 -2
  272. package/dist/prepare-docs/prepare.js +17 -17
  273. package/dist/prepare-docs/prepare.js.map +1 -1
  274. package/dist/stdio.d.ts +1 -3
  275. package/dist/stdio.js +6 -3
  276. package/dist/stdio.js.map +1 -1
  277. package/dist/tools/docs.d.ts +20 -15
  278. package/dist/tools/docs.d.ts.map +1 -1
  279. package/dist/tools/docs.js +140 -161
  280. package/dist/tools/docs.js.map +1 -1
  281. package/dist/tools/examples.d.ts +20 -15
  282. package/dist/tools/examples.d.ts.map +1 -1
  283. package/dist/tools/examples.js +74 -86
  284. package/dist/tools/examples.js.map +1 -1
  285. package/dist/tools/tests/test-setup.d.ts +5 -2
  286. package/dist/tools/tests/test-setup.d.ts.map +1 -1
  287. package/dist/tools/tests/test-setup.js +21 -28
  288. package/dist/tools/tests/test-setup.js.map +1 -1
  289. package/dist/utils/logger.d.ts +8 -5
  290. package/dist/utils/logger.d.ts.map +1 -1
  291. package/dist/utils/logger.js +17 -17
  292. package/dist/utils/logger.js.map +1 -1
  293. package/dist/utils/mcp-format.d.ts +8 -5
  294. package/dist/utils/mcp-format.d.ts.map +1 -1
  295. package/dist/utils/mcp-format.js +9 -9
  296. package/dist/utils/mcp-format.js.map +1 -1
  297. package/dist/utils/mdx.d.ts +8 -6
  298. package/dist/utils/mdx.d.ts.map +1 -1
  299. package/dist/utils/mdx.js +22 -22
  300. package/dist/utils/mdx.js.map +1 -1
  301. package/dist/utils/paths.d.ts +9 -6
  302. package/dist/utils/paths.d.ts.map +1 -1
  303. package/dist/utils/paths.js +66 -76
  304. package/dist/utils/paths.js.map +1 -1
  305. package/dist/utils/security.d.ts +4 -1
  306. package/dist/utils/security.d.ts.map +1 -1
  307. package/dist/utils/security.js +19 -40
  308. package/dist/utils/security.js.map +1 -1
  309. package/package.json +6 -6
  310. package/src/tools/tests/path-traversal.test.ts +1 -1
  311. package/.docs/raw/docs/(docs)/guides/branching.mdx +0 -65
  312. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +0 -164
  313. package/.docs/raw/docs/(docs)/guides/editing.mdx +0 -66
  314. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -38
  315. package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -40
  316. package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -260
  317. package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -103
  318. package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -254
  319. package/.docs/raw/docs/(reference)/migrations/v0-14.mdx +0 -159
  320. package/.docs/raw/docs/runtimes/a2a/index.mdx +0 -298
  321. package/.docs/raw/docs/runtimes/assistant-transport.mdx +0 -1033
  322. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -314
  323. package/.docs/raw/docs/runtimes/custom/local.mdx +0 -1464
  324. package/.docs/raw/docs/runtimes/data-stream.mdx +0 -422
  325. package/.docs/raw/docs/runtimes/google-adk/index.mdx +0 -686
  326. package/.docs/raw/docs/runtimes/helicone.mdx +0 -61
  327. package/.docs/raw/docs/runtimes/langchain/comparison.mdx +0 -60
  328. package/.docs/raw/docs/runtimes/langchain/index.mdx +0 -210
  329. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -699
  330. package/.docs/raw/docs/runtimes/langgraph/tutorial/index.mdx +0 -12
  331. package/.docs/raw/docs/runtimes/langserve.mdx +0 -116
  332. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -218
  333. package/.docs/raw/docs/runtimes/mastra/overview.mdx +0 -18
  334. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -217
  335. package/dist/prepare-docs/prepare.d.ts.map +0 -1
  336. package/dist/stdio.d.ts.map +0 -1
  337. /package/.docs/raw/docs/{(reference)/migrations → migrations}/deprecation-policy.mdx +0 -0
  338. /package/.docs/raw/docs/{(reference) → migrations}/react-compatibility.mdx +0 -0
  339. /package/.docs/raw/docs/{(reference)/migrations → migrations}/react-langgraph-v0-7.mdx +0 -0
  340. /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-11.mdx +0 -0
  341. /package/.docs/raw/docs/{(reference)/migrations → migrations}/v0-12.mdx +0 -0
@@ -0,0 +1,267 @@
1
+ ---
2
+ title: Model Context Protocol (MCP)
3
+ description: Connect MCP servers as a tool catalog in your assistant-ui app.
4
+ ---
5
+
6
+ [MCP](https://modelcontextprotocol.io/) is an open protocol for exposing tools, resources, and prompts to LLMs. One MCP server can publish many tools (file system, GitHub, Slack, your own service) and any MCP-aware client can use them. The AI SDK has a built-in MCP client; this page is the wiring guide for plugging it into an assistant-ui app.
7
+
8
+ ## How it works
9
+
10
+ ```
11
+ client ──► /api/chat ──► MCP client ──► MCP server (HTTP, SSE, stdio)
12
+ │
13
+ └─ tools() ──► passed to streamText({ tools })
14
+ ```
15
+
16
+ The MCP client lives on the server inside your AI SDK route handler. It connects to one or more MCP servers, calls `tools()` to get a tool map, and hands that map to `streamText`. assistant-ui's existing tool-call UI (`ToolFallback`, `makeAssistantToolUI`) renders the results.
17
+
18
+ ## Setup
19
+
20
+ <Steps>
21
+ <Step>
22
+
23
+ ### Install the MCP client
24
+
25
+ <InstallCommand npm={["@ai-sdk/mcp"]} />
26
+
27
+ For stdio transports (local dev only), also install the official MCP SDK:
28
+
29
+ <InstallCommand npm={["@modelcontextprotocol/sdk"]} />
30
+
31
+ </Step>
32
+ <Step>
33
+
34
+ ### Connect to an MCP server
35
+
36
+ Set the server URL and any auth token your server requires:
37
+
38
+ ```sh title=".env.local"
39
+ MCP_SERVER_URL=https://your-mcp-server.example/mcp
40
+ MCP_TOKEN=...
41
+ ```
42
+
43
+ Then inside your AI SDK route handler, create the client with the transport that matches your server. **HTTP** is the production transport; **SSE** is the legacy streaming transport; **stdio** spawns a local process and is dev-only.
44
+
45
+ ```ts title="app/api/chat/route.ts"
46
+ import { createMCPClient } from "@ai-sdk/mcp";
47
+
48
+ const mcpClient = await createMCPClient({
49
+ transport: {
50
+ type: "http",
51
+ url: process.env.MCP_SERVER_URL!,
52
+ headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` },
53
+ },
54
+ });
55
+ ```
56
+
57
+ For stdio:
58
+
59
+ ```ts
60
+ import { createMCPClient } from "@ai-sdk/mcp";
61
+ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
62
+
63
+ const mcpClient = await createMCPClient({
64
+ transport: new StdioClientTransport({
65
+ command: "node",
66
+ args: ["./mcp-server/dist/index.js"],
67
+ }),
68
+ });
69
+ ```
70
+
71
+ </Step>
72
+ <Step>
73
+
74
+ ### Wire the tools into the route
75
+
76
+ `mcpClient.tools()` returns an object shaped exactly like the `tools` argument of `streamText`. Spread it in alongside any of your own tools, and close the client when the response finishes:
77
+
78
+ ```ts title="app/api/chat/route.ts"
79
+ import { createMCPClient } from "@ai-sdk/mcp";
80
+ import { openai } from "@ai-sdk/openai";
81
+ import { streamText, convertToModelMessages } from "ai";
82
+ import type { UIMessage } from "ai";
83
+
84
+ export const maxDuration = 60;
85
+
86
+ export async function POST(req: Request) {
87
+ const { messages }: { messages: UIMessage[] } = await req.json();
88
+
89
+ const mcpClient = await createMCPClient({
90
+ transport: {
91
+ type: "http",
92
+ url: process.env.MCP_SERVER_URL!,
93
+ headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` },
94
+ },
95
+ });
96
+
97
+ const tools = await mcpClient.tools();
98
+
99
+ const result = streamText({
100
+ model: openai("gpt-5.4-mini"),
101
+ messages: await convertToModelMessages(messages),
102
+ tools,
103
+ onFinish: async () => {
104
+ await mcpClient.close();
105
+ },
106
+ });
107
+
108
+ return result.toUIMessageStreamResponse();
109
+ }
110
+ ```
111
+
112
+ `onFinish` is the right place to call `close()`: it fires after the stream completes, so the connection stays open as long as the model is still calling tools.
113
+
114
+ </Step>
115
+ <Step>
116
+
117
+ ### Combine multiple MCP servers
118
+
119
+ Each server has its own client. Spread their tool maps together:
120
+
121
+ ```ts
122
+ const githubClient = await createMCPClient({
123
+ transport: { type: "http", url: process.env.GITHUB_MCP_URL! },
124
+ });
125
+ const filesClient = await createMCPClient({
126
+ transport: { type: "http", url: process.env.FILES_MCP_URL! },
127
+ });
128
+
129
+ const tools = {
130
+ ...(await githubClient.tools()),
131
+ ...(await filesClient.tools()),
132
+ };
133
+
134
+ // remember to close both in onFinish
135
+ ```
136
+
137
+ If two servers expose tools with the same name, the later spread wins. Rename or scope as needed.
138
+
139
+ </Step>
140
+ <Step>
141
+
142
+ ### Render results in the UI
143
+
144
+ Tool calls flow through the existing assistant-ui tool-call rendering. With no setup, the bundled `<ToolFallback>` component renders the call name, arguments, and result. To customize the appearance for a specific tool, use `makeAssistantToolUI`:
145
+
146
+ <PlatformTabs>
147
+ <Tab value="React">
148
+
149
+ ```tsx title="app/components/GitHubIssueToolUI.tsx"
150
+ "use client";
151
+
152
+ import { makeAssistantToolUI } from "@assistant-ui/react";
153
+
154
+ type Args = { repo: string; number: number };
155
+ type Result = { title: string; state: string; url: string };
156
+
157
+ export const GitHubIssueToolUI = makeAssistantToolUI<Args, Result>({
158
+ toolName: "github_get_issue",
159
+ render: ({ args, result }) => (
160
+ <div className="rounded border p-3">
161
+ <div className="font-mono text-sm">{args.repo}#{args.number}</div>
162
+ {result && (
163
+ <a href={result.url} className="underline">
164
+ {result.title} ({result.state})
165
+ </a>
166
+ )}
167
+ </div>
168
+ ),
169
+ });
170
+ ```
171
+
172
+ </Tab>
173
+ <Tab value="React Native">
174
+
175
+ ```tsx title="components/GitHubIssueToolUI.tsx"
176
+ import { makeAssistantToolUI } from "@assistant-ui/react-native";
177
+ import { Linking, Pressable, Text, View } from "react-native";
178
+
179
+ type Args = { repo: string; number: number };
180
+ type Result = { title: string; state: string; url: string };
181
+
182
+ export const GitHubIssueToolUI = makeAssistantToolUI<Args, Result>({
183
+ toolName: "github_get_issue",
184
+ render: ({ args, result }) => (
185
+ <View style={{ borderWidth: 1, borderRadius: 6, padding: 12 }}>
186
+ <Text style={{ fontFamily: "Menlo", fontSize: 13 }}>
187
+ {args.repo}#{args.number}
188
+ </Text>
189
+ {result && (
190
+ <Pressable onPress={() => Linking.openURL(result.url)}>
191
+ <Text style={{ textDecorationLine: "underline" }}>
192
+ {result.title} ({result.state})
193
+ </Text>
194
+ </Pressable>
195
+ )}
196
+ </View>
197
+ ),
198
+ });
199
+ ```
200
+
201
+ </Tab>
202
+ <Tab value="React Ink">
203
+
204
+ ```tsx title="components/GitHubIssueToolUI.tsx"
205
+ import { makeAssistantToolUI } from "@assistant-ui/react-ink";
206
+ import { Box, Text } from "ink";
207
+
208
+ type Args = { repo: string; number: number };
209
+ type Result = { title: string; state: string; url: string };
210
+
211
+ export const GitHubIssueToolUI = makeAssistantToolUI<Args, Result>({
212
+ toolName: "github_get_issue",
213
+ render: ({ args, result }) => (
214
+ <Box borderStyle="round" paddingX={1} flexDirection="column">
215
+ <Text>
216
+ {args.repo}#{args.number}
217
+ </Text>
218
+ {result && (
219
+ <Text>
220
+ {result.title} ({result.state}) — {result.url}
221
+ </Text>
222
+ )}
223
+ </Box>
224
+ ),
225
+ });
226
+ ```
227
+
228
+ </Tab>
229
+ </PlatformTabs>
230
+
231
+ Mount it once anywhere inside `<AssistantRuntimeProvider>`. The `toolName` must match the name your MCP server publishes.
232
+
233
+ </Step>
234
+ <Step>
235
+
236
+ ### Run and verify
237
+
238
+ Start the app and trigger a tool call (e.g., ask the assistant to do something the MCP server can do). Confirm:
239
+
240
+ - The tool call appears in the chat with the expected arguments.
241
+ - The result renders (either via your custom `ToolUI` or the fallback).
242
+ - No connection leaks: the MCP client closes after each response. If you see open connections accumulating, check `onFinish`.
243
+
244
+ </Step>
245
+ </Steps>
246
+
247
+ ## Notes
248
+
249
+ - **Server-side only.** The MCP client uses Node APIs (sockets, optionally child processes). Never instantiate it in client code.
250
+ - **Per-request lifecycle.** A fresh client per request keeps connection state simple. For high-throughput servers, pool clients yourself with care: the AI SDK's `tools()` call assumes the connection is alive when `streamText` runs.
251
+ - **Sampling.** If your MCP server uses `sampling/createMessage` (lets the server ask the LLM mid-call), assistant-cloud users can instrument it via [`instrumentMcpSampling`](/docs/cloud) for observability. This is independent of the wiring above.
252
+ - **Transport choice.** HTTP for any networked server. SSE only if the server doesn't speak HTTP. stdio is for local development against an MCP server in your monorepo.
253
+
254
+ ## Related
255
+
256
+ <Cards>
257
+ <Card
258
+ title="AI SDK runtime"
259
+ description="The runtime that ferries MCP tool calls to the chat UI."
260
+ href="/docs/runtimes/ai-sdk/v6"
261
+ />
262
+ <Card
263
+ title="Tools and tool UI"
264
+ description="Build custom renderers for tool calls and approvals."
265
+ href="/docs/guides/tools"
266
+ />
267
+ </Cards>
@@ -0,0 +1,337 @@
1
+ ---
2
+ title: User-managed MCP servers
3
+ description: Let end users add and authenticate MCP servers from the browser with @assistant-ui/react-mcp.
4
+ ---
5
+
6
+ [`@assistant-ui/react-mcp`](https://npmjs.com/package/@assistant-ui/react-mcp) is the user-facing layer for MCP. Where the [server-side MCP guide](/docs/integrations/tools/mcp) wires a single fixed set of MCP servers into your API route, this package lets *end users* see a list of connectors, sign in via OAuth, paste a custom server URL, and have the resulting tool catalog flow into the chat — automatically.
7
+
8
+ Two ways a server reaches the user:
9
+
10
+ - **Connector** — a preset declared by the app developer with `defineConnector(...)`. The user just clicks Connect (and completes auth).
11
+ - **Custom server** — the user supplies the URL, name, and auth in `<McpAddFormPrimitive>`. Hide the add UI to disable.
12
+
13
+ Both flow through one connection lifecycle, one persisted state surface, and one tool registration path.
14
+
15
+ ## How it works
16
+
17
+ ```
18
+ useAui({ mcp: McpManagerResource({ connectors }) })
19
+ │
20
+ ├─ Tap resource — connection lifecycle, server lookup, OAuth/bearer auth
21
+ ├─ Auto-mounts the modelContext scope when no chat runtime provides one
22
+ └─ Registers connected tools as frontend tools — your chat sees them automatically
23
+ ```
24
+
25
+ The manager is a single tap resource. Mount it with `useAui` like any other scope. OAuth (PKCE + RFC 7591 dynamic client registration), bearer, and "no auth" are first-class. Token refresh runs inside the MCP SDK on 401; this package mediates persistence and the redirect step.
26
+
27
+ ## Setup
28
+
29
+ <Steps>
30
+ <Step>
31
+
32
+ ### Install
33
+
34
+ <InstallCommand npm={["@assistant-ui/react-mcp"]} />
35
+
36
+ </Step>
37
+ <Step>
38
+
39
+ ### Mount the manager
40
+
41
+ Declare your connectors and provide the `mcp` scope on `useAui`. No provider wrapper, no imperative hooks:
42
+
43
+ ```tsx title="app/providers.tsx"
44
+ "use client";
45
+
46
+ import { AuiProvider, useAui } from "@assistant-ui/react";
47
+ import { McpManagerResource, defineConnector } from "@assistant-ui/react-mcp";
48
+
49
+ const connectors = [
50
+ defineConnector({
51
+ id: "linear",
52
+ name: "Linear",
53
+ url: "https://mcp.linear.app",
54
+ auth: { type: "oauth", scopes: ["read"] },
55
+ icon: "/icons/linear.svg",
56
+ }),
57
+ defineConnector({
58
+ id: "weather",
59
+ name: "Weather",
60
+ url: "https://mcp.example.com/weather",
61
+ auth: { type: "none" },
62
+ }),
63
+ ];
64
+
65
+ export function Providers({ children }: { children: React.ReactNode }) {
66
+ const aui = useAui({ mcp: McpManagerResource({ connectors }) });
67
+ return <AuiProvider value={aui}>{children}</AuiProvider>;
68
+ }
69
+ ```
70
+
71
+ Defaults baked in:
72
+
73
+ - `storage` — `McpLocalStorage()` (override for production; see [Storage](#storage))
74
+ - `oauthRedirectUri` — `${window.location.origin}/mcp/callback`
75
+ - `autoConnect` — `true` (connect on mount when usable auth is persisted)
76
+
77
+ </Step>
78
+ <Step>
79
+
80
+ ### Pick your UI
81
+
82
+ You have two options:
83
+
84
+ **Drop-in shadcn dialog** (recommended for most apps) — install the `mcp-config` component via the assistant-ui registry, then render `<McpConfigDialog />` anywhere inside the provider. You get a styled trigger, server cards, status badges, error banners, and the add form for free:
85
+
86
+ <InstallCommand shadcn={["mcp-config"]} />
87
+
88
+ ```tsx title="app/page.tsx"
89
+ import { McpConfigDialog } from "@/components/assistant-ui/mcp-config";
90
+
91
+ export default function Page() {
92
+ return (
93
+ <header className="flex items-center justify-between">
94
+ <h1>My app</h1>
95
+ <McpConfigDialog />
96
+ </header>
97
+ );
98
+ }
99
+ ```
100
+
101
+ Pass children to override the trigger:
102
+
103
+ ```tsx
104
+ <McpConfigDialog>
105
+ <Button variant="ghost">Servers</Button>
106
+ </McpConfigDialog>
107
+ ```
108
+
109
+ **Compose your own from primitives** — three namespaces, all unstyled and `data-*`-driven. The iteration primitives take a **render function** so the body re-runs per server with the right scope:
110
+
111
+ ```tsx title="app/mcp/page.tsx"
112
+ "use client";
113
+
114
+ import {
115
+ McpManagerPrimitive,
116
+ McpServerPrimitive,
117
+ } from "@assistant-ui/react-mcp";
118
+
119
+ const ServerCard = () => (
120
+ <McpServerPrimitive.Root>
121
+ <McpServerPrimitive.Icon />
122
+ <McpServerPrimitive.Name />
123
+ <McpServerPrimitive.Status />
124
+ <McpServerPrimitive.ConnectButton>Connect</McpServerPrimitive.ConnectButton>
125
+ <McpServerPrimitive.DisconnectButton>Disconnect</McpServerPrimitive.DisconnectButton>
126
+ <McpServerPrimitive.OAuthLink>Authorize ↗</McpServerPrimitive.OAuthLink>
127
+ <McpServerPrimitive.RemoveButton>Remove</McpServerPrimitive.RemoveButton>
128
+ <McpServerPrimitive.Error />
129
+ </McpServerPrimitive.Root>
130
+ );
131
+
132
+ export default function McpPage() {
133
+ return (
134
+ <McpManagerPrimitive.Root>
135
+ <h2>Connectors</h2>
136
+ <McpManagerPrimitive.Connectors>
137
+ {() => <ServerCard />}
138
+ </McpManagerPrimitive.Connectors>
139
+
140
+ <h2>Your servers</h2>
141
+ <McpManagerPrimitive.CustomServers>
142
+ {() => <ServerCard />}
143
+ </McpManagerPrimitive.CustomServers>
144
+
145
+ <McpManagerPrimitive.AddCustomTrigger>
146
+ Add custom server
147
+ </McpManagerPrimitive.AddCustomTrigger>
148
+ </McpManagerPrimitive.Root>
149
+ );
150
+ }
151
+ ```
152
+
153
+ To disable custom servers entirely, just don't render `AddCustomTrigger` and `CustomServers`.
154
+
155
+ The iteration primitives wrap each item in an `McpServerByIdProvider`, so the nested `<McpServerPrimitive.*>` automatically reads the right scope. `<ConnectButton>`, `<DisconnectButton>`, `<OAuthLink>` and `<RemoveButton>` only render when the relevant state matches — no manual gating. `<RemoveButton>` is also hidden on connector items (which the user can't remove).
156
+
157
+ </Step>
158
+ <Step>
159
+
160
+ ### Add the custom-server form
161
+
162
+ ```tsx
163
+ <McpAddFormPrimitive.Root onSubmitted={() => closeDialog()}>
164
+ <McpAddFormPrimitive.NameField />
165
+ <McpAddFormPrimitive.UrlField />
166
+ <McpAddFormPrimitive.AuthSelect /> {/* none | bearer | oauth */}
167
+ <McpAddFormPrimitive.AuthFields /> {/* token or scope input depending on selection */}
168
+ <McpAddFormPrimitive.Error />
169
+ <McpAddFormPrimitive.Submit>Add</McpAddFormPrimitive.Submit>
170
+ <McpAddFormPrimitive.Cancel>Cancel</McpAddFormPrimitive.Cancel>
171
+ </McpAddFormPrimitive.Root>
172
+ ```
173
+
174
+ The form owns its own draft state and submits via `aui.mcp().addCustomServer(...)`. Pass a render function to `AuthFields` to fully customize it.
175
+
176
+ </Step>
177
+ <Step>
178
+
179
+ ### Handle the OAuth callback
180
+
181
+ Add a route at `/mcp/callback` (or whatever you set `oauthRedirectUri` to):
182
+
183
+ ```tsx title="app/mcp/callback/page.tsx"
184
+ "use client";
185
+
186
+ import { McpOAuthCallback } from "@assistant-ui/react-mcp";
187
+ import { useRouter } from "next/navigation";
188
+ import { Providers } from "../../providers";
189
+
190
+ export default function Callback() {
191
+ const router = useRouter();
192
+ return (
193
+ <Providers>
194
+ <McpOAuthCallback onComplete={() => router.replace("/mcp")} />
195
+ </Providers>
196
+ );
197
+ }
198
+ ```
199
+
200
+ The callback reads `?state=...&code=...` from the URL, derives the target server id (encoded in the OAuth `state` parameter automatically), and calls `completeAuth` on the right server.
201
+
202
+ </Step>
203
+ <Step>
204
+
205
+ ### That's it — the chat sees your tools
206
+
207
+ `McpManagerResource` registers connected tools as **frontend tools** with the `modelContext` scope. Any chat runtime mounted in the same store (e.g. `@assistant-ui/react-ai-sdk`'s `useChatRuntime`) sees them and exposes them to the model — no `useMcpTools` hook, no adapter call.
208
+
209
+ ```tsx
210
+ "use client";
211
+ import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
212
+
213
+ export function Chat() {
214
+ const runtime = useChatRuntime({ api: "/api/chat" });
215
+ /* … */
216
+ }
217
+ ```
218
+
219
+ Tool names are prefixed `serverId__toolName` to avoid collisions across connected servers. The toolkit re-registers whenever a server connects / disconnects or its tool list changes.
220
+
221
+ If no chat runtime is mounted, `McpManagerResource` brings its own minimal `modelContext` along. Tools are still callable directly:
222
+
223
+ ```ts
224
+ // In an event handler — never in render. See the tap conventions.
225
+ const aui = useAui();
226
+ const out = await aui.mcp().server({ id: "linear" }).callTool("search", { q });
227
+ ```
228
+
229
+ </Step>
230
+ </Steps>
231
+
232
+ ## Storage
233
+
234
+ All persisted state — custom server records, OAuth tokens, PKCE verifiers, DCR client info — goes through a single `MCPStorage` resource. Three built-ins:
235
+
236
+ - `McpLocalStorage()` — default. Stores under the `aui-mcp:` prefix in `window.localStorage`.
237
+ - `McpMemoryStorage()` — in-process Map. Use for SSR/tests where localStorage is absent.
238
+ - `McpCustomStorage({...})` — bring your own load/save. Use for app-controlled backends (e.g. POST to your API).
239
+
240
+ ```tsx
241
+ import { McpManagerResource, McpCustomStorage } from "@assistant-ui/react-mcp";
242
+
243
+ const aui = useAui({
244
+ mcp: McpManagerResource({
245
+ connectors,
246
+ storage: McpCustomStorage({
247
+ loadCustomServers: async () => fetch("/api/mcp/servers").then((r) => r.json()),
248
+ saveCustomServers: async (records) =>
249
+ fetch("/api/mcp/servers", { method: "PUT", body: JSON.stringify(records) }),
250
+ loadAuthState: async (id) =>
251
+ fetch(`/api/mcp/auth/${id}`).then((r) => (r.ok ? r.json() : null)),
252
+ saveAuthState: async (id, state) =>
253
+ fetch(`/api/mcp/auth/${id}`, { method: "PUT", body: JSON.stringify(state) }),
254
+ clearAuthState: async (id) =>
255
+ fetch(`/api/mcp/auth/${id}`, { method: "DELETE" }),
256
+ }),
257
+ }),
258
+ });
259
+ ```
260
+
261
+ <Callout type="warn">
262
+ `McpLocalStorage` stores tokens in plain text and is XSS-exposed. For anything beyond local prototyping, use `McpCustomStorage` against an HTTP-only-cookie-backed endpoint, or wrap localStorage with your own encrypted serializer.
263
+ </Callout>
264
+
265
+ ## Auth
266
+
267
+ Three modes, declared per-connector or per-custom-record:
268
+
269
+ ```ts
270
+ { type: "none" } // no auth header
271
+ { type: "bearer", token?: "…" } // Authorization: Bearer …
272
+ { type: "oauth", // PKCE + DCR + refresh
273
+ scopes?: ["read"],
274
+ authorizationEndpoint?: "…", // overrides RFC 8414 discovery
275
+ tokenEndpoint?: "…",
276
+ registrationEndpoint?: "…",
277
+ clientId?: "…", // skip DCR with a static client
278
+ clientSecret?: "…",
279
+ }
280
+ ```
281
+
282
+ The OAuth provider implements the MCP SDK's `OAuthClientProvider`. The SDK handles discovery (RFC 8414), DCR (RFC 7591), PKCE, token exchange, and refresh; this package mediates `MCPStorage` reads/writes and the redirect step. The server id is embedded in the OAuth `state` parameter so a single `/mcp/callback` route knows which server to complete.
283
+
284
+ ## State & methods
285
+
286
+ Render-time state — `useAuiState`:
287
+
288
+ ```ts
289
+ import { useAuiState } from "@assistant-ui/store";
290
+
291
+ const isHydrated = useAuiState((s) => s.mcp.isHydrated);
292
+ const connectionState = useAuiState((s) => s.mcpServer.connectionState);
293
+ // ^ requires McpServerByIdProvider
294
+ ```
295
+
296
+ Imperative methods — `useAui` + resolve in a callback (never during render — see the [tap skill](https://github.com/assistant-ui/assistant-ui/blob/main/.claude/skills/tap/SKILL.md) for why):
297
+
298
+ ```ts
299
+ const aui = useAui();
300
+
301
+ // inside an event handler:
302
+ await aui.mcp().addCustomServer({ name, url, auth: { type: "bearer", token } });
303
+ await aui.mcp().server({ id }).connect();
304
+ await aui.mcp().server({ id }).callTool("echo", { text: "hi" });
305
+ ```
306
+
307
+ ## v1 scope
308
+
309
+ What ships:
310
+
311
+ - Tool listing and invocation, auto-registered as frontend tools
312
+ - OAuth (PKCE + DCR), bearer, none
313
+ - StreamableHTTP transport
314
+ - Manual connect/disconnect
315
+
316
+ What's deferred:
317
+
318
+ - Resources, prompts, sampling
319
+ - Auto-reconnect with backoff
320
+ - Per-tool enable/disable persistence
321
+ - Per-tool consent prompts
322
+ - Out-of-the-box token encryption (use `McpCustomStorage` against a server endpoint)
323
+
324
+ ## Related
325
+
326
+ <Cards>
327
+ <Card
328
+ title="Server-side MCP"
329
+ description="App-developer-controlled MCP servers wired into the API route."
330
+ href="/docs/integrations/tools/mcp"
331
+ />
332
+ <Card
333
+ title="Tools and tool UI"
334
+ description="Build custom renderers for tool calls and approvals."
335
+ href="/docs/guides/tools"
336
+ />
337
+ </Cards>