@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,103 @@
1
+ ---
2
+ title: Guides
3
+ description: Practical recipes for building AI chat features in React with assistant-ui — attachments, branching, multi-agent, voice, slash commands, generative UI, and more.
4
+ platforms: ["react"]
5
+ ---
6
+
7
+ Guides are task-oriented walkthroughs for building specific features on top of assistant-ui. They sit between the [Primitives](/docs/primitives) (low-level building blocks) and [Components](/docs/ui/thread) (pre-styled installs) — pick a guide when you know what you want to build and need the recommended pattern.
8
+
9
+ ## Composer
10
+
11
+ Extend the message input with file attachments, mentions, slash commands, voice, and quoting.
12
+
13
+ <Cards>
14
+ <Card title="Attachments" href="/docs/guides/attachments">
15
+ Let users attach files, images, and documents to messages. Covers upload adapters, validation, and the typed `attachmentAddError` event.
16
+ </Card>
17
+ <Card title="Mentions" href="/docs/guides/mentions">
18
+ `@`-style triggers that insert directives into the composer. Sync and async search patterns.
19
+ </Card>
20
+ <Card title="Slash Commands" href="/docs/guides/slash-commands">
21
+ `/`-style commands with arguments, async loading, and combining with mentions.
22
+ </Card>
23
+ <Card title="Quoting" href="/docs/guides/quoting">
24
+ Selection toolbar, programmatic `setQuote`, and forwarding quote context to the LLM.
25
+ </Card>
26
+ <Card title="Dictation" href="/docs/guides/dictation">
27
+ Speech-to-text into the composer using `DictationAdapter` and `ComposerPrimitive.Dictate`.
28
+ </Card>
29
+ </Cards>
30
+
31
+ ## Messages
32
+
33
+ Customize how messages render, are edited, branched, and suggested.
34
+
35
+ <Cards>
36
+ <Card title="Suggestions" href="/docs/guides/suggestions">
37
+ Welcome-screen prompts, dynamic suggestions, and the `AuiIf` empty-thread pattern.
38
+ </Card>
39
+ <Card title="Editing" href="/docs/guides/editing">
40
+ Edit user messages with `UserEditComposer`, `beginEdit()`, and edit-during-streaming behavior.
41
+ </Card>
42
+ <Card title="Branching" href="/docs/guides/branching">
43
+ Navigate alternative message versions with `BranchPickerPrimitive`, reload, and direct branch-id navigation.
44
+ </Card>
45
+ <Card title="Message Timing" href="/docs/guides/message-timing">
46
+ Display response duration and stream timing with `useMessageTiming` (experimental).
47
+ </Card>
48
+ </Cards>
49
+
50
+ ## Tools & Generative UI
51
+
52
+ Connect tools to the LLM and render their outputs as interactive UI.
53
+
54
+ <Cards>
55
+ <Card title="Tools" href="/docs/guides/tools">
56
+ Define tools with the Toolkit API, stream args, handle cancellation, and integrate with AI SDK / LangGraph / LangChain.
57
+ </Card>
58
+ <Card title="Tool UI" href="/docs/guides/tool-ui">
59
+ Render tool calls and `DataMessagePart` into custom components, with fallback handling.
60
+ </Card>
61
+ <Card title="Interactables" href="/docs/guides/interactables">
62
+ Persisted, schema-validated interactive UI driven by AI state.
63
+ </Card>
64
+ <Card title="Multi-Agent" href="/docs/guides/multi-agent">
65
+ Sub-agent message attribution via `ToolCallMessagePart.messages` and LangGraph subgraph events.
66
+ </Card>
67
+ </Cards>
68
+
69
+ ## Display
70
+
71
+ Render specialized message content.
72
+
73
+ <Cards>
74
+ <Card title="Chain of Thought" href="/docs/guides/chain-of-thought">
75
+ Display the assistant's reasoning steps in a collapsible accordion.
76
+ </Card>
77
+ <Card title="LaTeX" href="/docs/guides/latex">
78
+ Render math via React Markdown or Streamdown, with streaming-safe escape rules.
79
+ </Card>
80
+ </Cards>
81
+
82
+ ## Audio
83
+
84
+ Voice input and output.
85
+
86
+ <Cards>
87
+ <Card title="Voice" href="/docs/guides/voice">
88
+ Realtime bidirectional audio with `RealtimeVoiceAdapter` and `createVoiceSession`.
89
+ </Card>
90
+ <Card title="Speech" href="/docs/guides/speech">
91
+ Text-to-speech for assistant messages via `SpeechSynthesisAdapter`.
92
+ </Card>
93
+ </Cards>
94
+
95
+ ## Programmatic
96
+
97
+ Read and drive runtime state from your own code.
98
+
99
+ <Cards>
100
+ <Card title="Context API" href="/docs/guides/context-api">
101
+ Access threads, messages, composer, and tool state via `useAui` and the runtime scope tree.
102
+ </Card>
103
+ </Cards>
@@ -1,6 +1,7 @@
1
1
  ---
2
- title: Interactables
3
- description: Persistent UI whose state can be read and updated by the AI assistant.
2
+ title: Interactable Components
3
+ description: Build persistent UI elements whose state the AI can read and update — copilot interactables in React with assistant-ui for forms, dashboards, and tools.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
6
7
  import { InteractableSample } from "@/components/docs/samples/interactable";
@@ -344,6 +345,49 @@ const aui = useAui({
344
345
  });
345
346
  ```
346
347
 
348
+ ## Streaming Updates
349
+
350
+ While the AI is generating tool arguments, `useInteractableState` reflects the partial state in real time as fields stream in. You can use the partial state itself plus the thread's running status to show a skeleton UI while the AI is mid-stream:
351
+
352
+ ```tsx
353
+ import { useAuiState } from "@assistant-ui/react";
354
+
355
+ function TaskBoard() {
356
+ const id = useAssistantInteractable("taskBoard", config);
357
+ const [state] = useInteractableState(id, taskBoardInitialState);
358
+ const isRunning = useAuiState((s) => s.thread.isRunning);
359
+
360
+ const isLoading = isRunning && state.tasks.length === 0;
361
+
362
+ return (
363
+ <div>
364
+ <h2>Tasks</h2>
365
+ {isLoading ? (
366
+ <div className="animate-pulse h-8 rounded bg-muted" />
367
+ ) : (
368
+ <ul>
369
+ {state.tasks.map((task) => (
370
+ <li key={task.id}>{task.title}</li>
371
+ ))}
372
+ </ul>
373
+ )}
374
+ </div>
375
+ );
376
+ }
377
+ ```
378
+
379
+ The state object updates progressively as the AI streams in each field, so partial renders work without any extra wiring. Use the runtime's `isRunning` to distinguish "still streaming, no fields yet" from "model returned an empty result".
380
+
381
+ ## Schema Evolution
382
+
383
+ <Callout type="warn">
384
+ If you change a Zod schema after state has been persisted, the imported snapshot may silently mis-match the new shape. The adapter does a shallow merge, so extra fields are preserved and missing fields keep their initial values, but type mismatches are not caught at runtime. To avoid silent corruption, version your schema key (e.g. `"taskBoard_v2"`) or namespace it by schema hash whenever you make breaking changes. Alternatively, add a migration step in your `importState` call.
385
+ </Callout>
386
+
387
+ ## Unmount Behavior
388
+
389
+ When a component that called `useAssistantInteractable` unmounts, the interactable is unregistered from the AI's tool list and system prompt. However, its state is preserved in the `Interactables` scope. When the component mounts again with the same name and id, the scope re-merges the preserved state rather than resetting to `initialState`. This means transient unmounts (such as React Strict Mode double-mounts or tab switches) do not lose state.
390
+
347
391
  ## Full Example
348
392
 
349
393
  See the complete [with-interactables example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-interactables) for a working implementation featuring:
@@ -352,3 +396,8 @@ See the complete [with-interactables example](https://github.com/assistant-ui/as
352
396
  - **Sticky Notes** — multi-instance interactables with selection and partial updates
353
397
  - **localStorage persistence** — state survives page refresh via `setPersistenceAdapter`
354
398
  - **Sync indicator** — spinning icon while a save is in-flight (`isPending`)
399
+
400
+ ## Related
401
+
402
+ - [Generative UI](/docs/guides/tool-ui) — Inline tool call UIs rendered inside messages
403
+ - [LangGraph Generative UI](/docs/runtimes/langgraph/generative-ui) — Structured UI components emitted by a LangGraph graph alongside messages
@@ -1,21 +1,24 @@
1
1
  ---
2
- title: LaTeX
3
- description: Render mathematical expressions in chat messages using KaTeX.
2
+ title: LaTeX in Chat Messages
3
+ description: Render LaTeX math expressions in AI chat messages with KaTeX — drop-in equation support for React chat UIs built on assistant-ui.
4
+ platforms: ["react"]
4
5
  ---
5
6
 
7
+ import { PackageManagerTabs } from "@/components/docs/fumadocs/install/package-manager-tabs";
6
8
 
7
9
  Render LaTeX mathematical expressions in chat messages using KaTeX.
8
10
 
9
- <Callout type="warn">LaTeX rendering is not enabled in markdown by default.</Callout>
11
+ <Callout type="warn">LaTeX rendering is not enabled by default.</Callout>
12
+
13
+ <Tabs items={["react-markdown", "Streamdown"]}>
14
+ <Tab value="react-markdown">
10
15
 
11
16
  <Steps>
12
17
  <Step>
13
18
 
14
19
  ### Install dependencies
15
20
 
16
- ```bash
17
- npm i katex rehype-katex remark-math
18
- ```
21
+ <PackageManagerTabs packages={["katex", "rehype-katex", "remark-math"]} />
19
22
 
20
23
  </Step>
21
24
  <Step>
@@ -53,9 +56,50 @@ export const MarkdownText = memo(MarkdownTextImpl);
53
56
  </Step>
54
57
  </Steps>
55
58
 
59
+ </Tab>
60
+ <Tab value="Streamdown">
61
+
62
+ <Callout type="info">
63
+ Using [Streamdown](/docs/ui/streamdown) as your renderer? Math support is a first-party plugin — no remark or rehype packages needed.
64
+ </Callout>
65
+
66
+ <Steps>
67
+ <Step>
68
+
69
+ ### Install dependencies
70
+
71
+ <PackageManagerTabs packages={["@streamdown/math", "katex"]} />
72
+
73
+ </Step>
74
+ <Step>
75
+
76
+ ### Add KaTeX CSS to your layout
77
+
78
+ ```tsx title="/app/layout.tsx"
79
+ import "katex/dist/katex.min.css"; // [!code ++]
80
+ ```
81
+
82
+ </Step>
83
+ <Step>
84
+
85
+ ### Pass the `math` plugin to `StreamdownTextPrimitive`
86
+
87
+ ```tsx title="/components/assistant-ui/streamdown-text.tsx"
88
+ import { math } from "@streamdown/math"; // [!code ++]
89
+ import "katex/dist/katex.min.css"; // [!code ++]
90
+
91
+ <StreamdownTextPrimitive plugins={{ math }} /> // [!code ++]
92
+ ```
93
+
94
+ </Step>
95
+ </Steps>
96
+
97
+ </Tab>
98
+ </Tabs>
99
+
56
100
  ## Supported Formats
57
101
 
58
- By default, remark-math supports:
102
+ By default, remark-math (react-markdown path) supports:
59
103
  - `$...$` for inline math
60
104
  - `$$...$$` for display math
61
105
  - Fenced code blocks with the `math` language identifier
@@ -67,7 +111,7 @@ Many language models generate LaTeX using different delimiter formats:
67
111
  - `\[...\]` for display math
68
112
  - Custom formats like `[/math]...[/math]`
69
113
 
70
- You can use the `preprocess` prop to normalize these formats:
114
+ You can use the `preprocess` prop on `MarkdownTextPrimitive` to normalize these formats before parsing:
71
115
 
72
116
  ```tsx title="/components/assistant-ui/markdown-text.tsx"
73
117
  import { MarkdownTextPrimitive } from "@assistant-ui/react-markdown";
@@ -104,6 +148,5 @@ function normalizeCustomMathTags(input: string): string {
104
148
  ```
105
149
 
106
150
  <Callout type="tip">
107
- The preprocessing function runs before markdown parsing, allowing you to transform any delimiter format into the standard `$` and `$$` format.
151
+ Inside `MarkdownTextPrimitive`, the streamed text first passes through `preprocess` (delimiter normalization) and then through `useSmooth` (character-by-character accumulation), and only then reaches the markdown parser. Both run before remark-math sees the text, so delimiter replacement and the streaming smoothing are streaming-safe — partially-received delimiters are accumulated in the smoothing buffer rather than parsed mid-fragment.
108
152
  </Callout>
109
-
@@ -0,0 +1,231 @@
1
+ ---
2
+ title: MCP Apps
3
+ description: Render MCP App UI resources inline in chat. Native renderer for the Model Context Protocol Apps spec — sandboxed iframes, JSON-RPC bridge, AI SDK integration.
4
+ platforms: ["react"]
5
+ ---
6
+
7
+ [MCP Apps](https://apps.extensions.modelcontextprotocol.io/) lets a Model Context Protocol server ship a UI resource alongside a tool — a self-contained HTML widget that the chat host renders inline when the tool is called. assistant-ui ships a native renderer that mounts the widget in a sandboxed iframe via [`SafeContentFrame`](/safe-content-frame) and runs a JSON-RPC postMessage bridge so the widget can call tools, send messages, request a display mode, and read host context.
8
+
9
+ ## Overview
10
+
11
+ When an MCP server attaches a `_meta.ui.resourceUri` (the [`text/html;profile=mcp-app`](https://apps.extensions.modelcontextprotocol.io/api/index.html) MIME) to a tool, AI SDK forwards that metadata through the message stream. assistant-ui's renderer picks it up off the `mcp` field on `ToolCallMessagePart`, fetches the resource through your backend route, and mounts it.
12
+
13
+ The renderer only acts on URIs that start with `ui://` (per the MCP Apps spec). Tools whose `resourceUri` uses any other scheme are treated as non-MCP-Apps tools and fall through to your regular tool UI.
14
+
15
+ The widget communicates back through a JSON-RPC bridge:
16
+
17
+ - **widget → host requests**: `ui/initialize`, `tools/call`, `resources/read`, `resources/list`, `openLink`, `sendMessage`, `requestDisplayMode`, `updateModelContext`
18
+ - **host → widget notifications**: tool input streaming, tool result, host context changes
19
+ - **widget → host notifications**: initialized, size changed, log, error, request teardown
20
+
21
+ Capability presence is determined at mount time by which handlers you provide. Unknown methods return JSON-RPC `-32601`; bad params return `-32602`.
22
+
23
+ ## Quick start
24
+
25
+ The renderer talks to a backend route you expose — the MCP client lives server-side so credentials and transport stay out of the browser. The route receives `{ method, params }` POSTs and dispatches to your MCP client.
26
+
27
+ ### Client
28
+
29
+ Compose `McpAppRenderer({...})` into your `Tools` resource. Provide `host.url` pointing at your route. Any tool-call part carrying `mcp.app` metadata renders the MCP App widget automatically.
30
+
31
+ ```tsx
32
+ import {
33
+ useAui,
34
+ Tools,
35
+ McpAppRenderer,
36
+ McpAppsRemoteHost,
37
+ } from "@assistant-ui/react";
38
+
39
+ function MyAssistant() {
40
+ useAui({
41
+ tools: Tools({
42
+ toolkit: myToolkit,
43
+ mcpApp: McpAppRenderer({
44
+ host: McpAppsRemoteHost({ url: "/api/mcp-apps" }),
45
+ hostInfo: { name: "my-app", version: "1.0.0" },
46
+ hostContext: { theme: "light" },
47
+ }),
48
+ }),
49
+ });
50
+ // ...
51
+ }
52
+ ```
53
+
54
+ `McpAppsRemoteHost` is the default host strategy — it POSTs `{ method, params }` to your route. A different strategy (e.g. a client-side MCP client) can be plugged in by writing a custom resource that returns the same `McpAppsHost` shape (`{ loadResource, callTool, readResource, listResources }`).
55
+
56
+ `openLink` is auto-wired to `window.open(url, "_blank", "noopener,noreferrer")`. `sendMessage` is auto-wired to append a user message to the current thread (accepts `string`, `{ prompt }`, `{ text }`, or `{ message }`).
57
+
58
+ ### Route handler
59
+
60
+ The route accepts `POST` requests with `{ method, params }` JSON bodies. Dispatch by method name and return the result as JSON. Example for Next.js App Router:
61
+
62
+ ```ts
63
+ // app/api/mcp-apps/route.ts
64
+ import { experimental_createMCPClient } from "ai";
65
+
66
+ let clientPromise: ReturnType<typeof experimental_createMCPClient> | undefined;
67
+ const getClient = () => {
68
+ clientPromise ??= experimental_createMCPClient({
69
+ transport: { type: "sse", url: process.env.MCP_SERVER_URL! },
70
+ });
71
+ return clientPromise;
72
+ };
73
+
74
+ export async function POST(req: Request) {
75
+ const { method, params } = await req.json();
76
+ const client = await getClient();
77
+
78
+ switch (method) {
79
+ case "mcp-apps/read-resource": {
80
+ const { contents } = await client.readResource({ uri: params.uri });
81
+ const c = contents.find((x: { uri: string }) => x.uri === params.uri);
82
+ return Response.json({
83
+ uri: params.uri,
84
+ mimeType: "text/html;profile=mcp-app",
85
+ html: c?.text ?? "",
86
+ });
87
+ }
88
+ case "tools/call": {
89
+ const tools = await client.tools();
90
+ const tool = tools[params.name];
91
+ if (!tool?.execute) {
92
+ return Response.json({ error: "Tool not callable" }, { status: 400 });
93
+ }
94
+ return Response.json(
95
+ await tool.execute(params.arguments ?? {}, {
96
+ toolCallId: `mcp-apps-bridge-${crypto.randomUUID()}`,
97
+ messages: [],
98
+ }),
99
+ );
100
+ }
101
+ case "resources/read":
102
+ return Response.json(await client.readResource({ uri: params.uri }));
103
+ case "resources/list":
104
+ return Response.json(await client.listResources(params));
105
+ default:
106
+ return Response.json({ error: "Unsupported method" }, { status: 400 });
107
+ }
108
+ }
109
+ ```
110
+
111
+ The renderer POSTs four method names: `mcp-apps/read-resource`, `tools/call`, `resources/read`, `resources/list`. Reject anything else server-side and apply your own auth / rate limiting in the route.
112
+
113
+ Per-name `setToolUI` registrations always win over the MCP fallback — you can still customize specific tools.
114
+
115
+ ## AI SDK integration
116
+
117
+ `@assistant-ui/react-ai-sdk` forwards `callProviderMetadata.mcp.app` from AI SDK tool UI parts into `ToolCallMessagePart.mcp.app`. With AI SDK 5.x and an MCP-Apps-capable MCP server, no extra wiring is required on the part shape.
118
+
119
+ The rich UI comes from the MCP server's metadata, not from the model, so the path is identical whichever provider drives the conversation. Running Claude is just a different `model:` in `streamText` (`anthropic("claude-sonnet-4-6")` via `@ai-sdk/anthropic`); the MCP server, `splitMcpAppTools`, and the renderer are unchanged. MCP Apps is an open standard in the MCP ecosystem (Claude is one of its hosts), so a standard MCP-Apps server renders out of the box. The bridge below is only needed for servers that use OpenAI's `openai/outputTemplate` convention, again independent of which model you run.
120
+
121
+ On the chat route, use `splitMcpAppTools()` (from `@ai-sdk/mcp`) to keep app-only tools out of the model's view:
122
+
123
+ ```ts
124
+ import { splitMcpAppTools } from "@ai-sdk/mcp";
125
+
126
+ const tools = await client.listTools();
127
+ const { modelVisible } = splitMcpAppTools(tools);
128
+
129
+ const result = streamText({
130
+ model: openai("gpt-5.4-nano"),
131
+ tools: modelVisible.tools,
132
+ // ...
133
+ });
134
+ ```
135
+
136
+ ### OpenAI Apps SDK servers
137
+
138
+ [OpenAI Apps SDK](https://developers.openai.com/apps-sdk) servers carry the same `ui://` template under a different convention: the pointer is `_meta["openai/outputTemplate"]` on the tool definition (not `_meta.ui.resourceUri`), and the resource is served as `text/html+skybridge` rather than `text/html;profile=mcp-app`. `@ai-sdk/mcp` does not recognize `openai/outputTemplate`, so it never populates `callProviderMetadata.mcp.app` and the renderer stays idle.
139
+
140
+ The renderer needs no change; you only have to surface the pointer. assistant-ui already reads `result._meta["ui/resourceUri"]` off tool results, so the smallest bridge is to copy the template onto the result by tool name. Build the map once from the tool listing, then stamp it inside each tool's `execute`:
141
+
142
+ ```ts
143
+ import type { Tool } from "ai";
144
+
145
+ // reuse the listTools() result from the AI SDK integration step above; no second round-trip
146
+ const templateByTool = new Map(
147
+ tools.tools
148
+ .filter((t) => typeof t._meta?.["openai/outputTemplate"] === "string")
149
+ .map((t) => [t.name, t._meta["openai/outputTemplate"] as string]),
150
+ );
151
+
152
+ const withTemplateUri = (tool: Tool, name: string): Tool => {
153
+ const uri = templateByTool.get(name);
154
+ const exec = tool.execute;
155
+ if (!uri || !exec) return tool;
156
+ return {
157
+ ...tool,
158
+ execute: async (args, options) => {
159
+ const result = (await exec(args, options)) as { _meta?: Record<string, unknown> };
160
+ return { ...result, _meta: { ...result._meta, "ui/resourceUri": uri } };
161
+ },
162
+ } satisfies Tool;
163
+ };
164
+ ```
165
+
166
+ Wrap the AI SDK tool objects before handing them to `streamText`:
167
+
168
+ ```ts
169
+ const aiTools = await client.tools();
170
+ const wrappedTools = Object.fromEntries(
171
+ Object.entries(aiTools).map(([name, t]) => [name, withTemplateUri(t, name)]),
172
+ );
173
+ // pass wrappedTools to streamText
174
+ ```
175
+
176
+ Your `mcp-apps/read-resource` handler reads the `ui://` resource as in the route example above. Set the response `mimeType` to the `text/html;profile=mcp-app` literal that `McpAppResource` expects and keep the server's HTML in `html`; don't forward the raw `text/html+skybridge` value, which the type rejects.
177
+
178
+ The cleaner long-term fix is upstream: if `@ai-sdk/mcp`'s `getMCPAppToolMeta` also read `openai/outputTemplate`, then `callProviderMetadata.mcp.app` would populate automatically and this bridge would be unnecessary.
179
+
180
+ ## Bridge protocol
181
+
182
+ The bridge implements the MCP UI JSON-RPC protocol over `window.postMessage`, filtered by both `event.source === frame.iframe.contentWindow` AND `event.origin === frame.origin` — the cross-origin domain `SafeContentFrame` issues per render. Messages from any other origin or window are dropped silently.
183
+
184
+ ### Widget → host requests
185
+
186
+ | Method | Notes |
187
+ |---|---|
188
+ | `ui/initialize` | Returns `{ protocolVersion, host, hostContext, capabilities }`. Always supported. |
189
+ | `tools/call` | Routed to `host.url` with method `tools/call`. Optional `handlers.allowedTools` allowlist. Invalid `arguments` shape → `-32602`. |
190
+ | `resources/read` | Routed to `host.url` with method `resources/read`. |
191
+ | `resources/list` | Routed to `host.url` with method `resources/list`. |
192
+ | `openLink` | Requires `handlers.openLink`. Rejects non-`http(s)` URLs with `-32602`. |
193
+ | `sendMessage` | Requires `handlers.sendMessage`. |
194
+ | `requestDisplayMode` | Requires `handlers.requestDisplayMode`. Modes: `inline`, `fullscreen`, `pip`. |
195
+ | `updateModelContext` | Requires `handlers.updateModelContext`. |
196
+
197
+ When a handler isn't provided, the bridge returns JSON-RPC `-32601` (method not found) — which is also how `capabilities` is reported in the `ui/initialize` response.
198
+
199
+ ### Host → widget notifications
200
+
201
+ - `notifications/tools/call/input` — sent whenever `part.args` (the streaming tool input) changes
202
+ - `notifications/tools/call/result` — sent when the tool result lands (including error envelopes)
203
+ - `notifications/host_context/changed` — sent when `hostContext` changes (e.g. user toggles theme)
204
+
205
+ ### Widget → host notifications
206
+
207
+ `notifications/initialized`, `notifications/size_changed`, `notifications/log`, `notifications/error`, `notifications/request_teardown` — wire them via `handlers.onInitialized`, `onSizeChange`, `onLog`, `onError`, `onRequestTeardown` respectively.
208
+
209
+ If the widget never sends `notifications/initialized` (broken or non-spec-compliant), the host flushes its queued notifications after a 5-second safety timeout so the iframe doesn't appear hung.
210
+
211
+ ## Sandboxing
212
+
213
+ The iframe is built with [`SafeContentFrame`](/safe-content-frame), which serves each widget from a content-hashed cross-origin so the host page is not reachable by `same-origin` references. Default sandbox flags are `allow-same-origin allow-scripts`. Tune via the `sandbox` field on `McpAppRendererOptions`:
214
+
215
+ ```tsx
216
+ McpAppRenderer({
217
+ // ...
218
+ sandbox: {
219
+ sandbox: ["allow-forms", "allow-popups"],
220
+ enableBrowserCaching: true,
221
+ className: "my-mcp-app",
222
+ },
223
+ });
224
+ ```
225
+
226
+ ## Security notes
227
+
228
+ - Widgets run cross-origin in a sandboxed iframe. The bridge filters incoming messages by both source window and origin.
229
+ - The host route is your auth boundary — apply session checks, rate limiting, and per-tool allowlists there. The renderer trusts whatever the route returns.
230
+ - `openLink` rejects non-`http(s)` URLs at the bridge layer, but your `openLink` handler should still treat the URL as untrusted (e.g. always use `noopener,noreferrer`).
231
+ - Keep `host` and `handlers` references stable across renders (e.g. module-scope constants or `useMemo`); an unstable identity will tear down and refetch the widget on every parent re-render.