@assistant-ui/mcp-docs-server 0.2.2 → 0.3.0
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.
- package/README.md +16 -43
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -91
- package/dist/index.js.map +1 -1
- package/dist/proxy.d.ts +9 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +76 -0
- package/dist/proxy.js.map +1 -0
- package/package.json +9 -13
- package/src/index.ts +3 -115
- package/src/proxy.test.ts +250 -0
- package/src/proxy.ts +111 -0
- package/.docs/organized/code-examples/waterfall.md +0 -807
- package/.docs/organized/code-examples/with-a2a.md +0 -674
- package/.docs/organized/code-examples/with-ag-ui.md +0 -552
- package/.docs/organized/code-examples/with-ai-sdk-v7.md +0 -465
- package/.docs/organized/code-examples/with-artifacts.md +0 -814
- package/.docs/organized/code-examples/with-assistant-transport.md +0 -575
- package/.docs/organized/code-examples/with-browser-extension.md +0 -371
- package/.docs/organized/code-examples/with-chain-of-thought.md +0 -960
- package/.docs/organized/code-examples/with-cloud-standalone.md +0 -681
- package/.docs/organized/code-examples/with-cloud.md +0 -438
- package/.docs/organized/code-examples/with-custom-thread-list.md +0 -568
- package/.docs/organized/code-examples/with-elevenlabs-conversational.md +0 -526
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +0 -696
- package/.docs/organized/code-examples/with-eve.md +0 -404
- package/.docs/organized/code-examples/with-expo.md +0 -2063
- package/.docs/organized/code-examples/with-external-store.md +0 -420
- package/.docs/organized/code-examples/with-ffmpeg.md +0 -828
- package/.docs/organized/code-examples/with-generative-ui.md +0 -1812
- package/.docs/organized/code-examples/with-google-adk.md +0 -367
- package/.docs/organized/code-examples/with-heat-graph.md +0 -304
- package/.docs/organized/code-examples/with-image-generation.md +0 -462
- package/.docs/organized/code-examples/with-interactables.md +0 -732
- package/.docs/organized/code-examples/with-langchain.md +0 -445
- package/.docs/organized/code-examples/with-langgraph.md +0 -854
- package/.docs/organized/code-examples/with-livekit.md +0 -642
- package/.docs/organized/code-examples/with-mcp.md +0 -780
- package/.docs/organized/code-examples/with-nuxt.md +0 -2428
- package/.docs/organized/code-examples/with-opencode.md +0 -1974
- package/.docs/organized/code-examples/with-openui.md +0 -449
- package/.docs/organized/code-examples/with-pi.md +0 -2083
- package/.docs/organized/code-examples/with-react-hook-form.md +0 -724
- package/.docs/organized/code-examples/with-react-ink-web.md +0 -690
- package/.docs/organized/code-examples/with-react-ink.md +0 -472
- package/.docs/organized/code-examples/with-react-router.md +0 -935
- package/.docs/organized/code-examples/with-resumable-stream.md +0 -667
- package/.docs/organized/code-examples/with-store.md +0 -679
- package/.docs/organized/code-examples/with-svelte.md +0 -415
- package/.docs/organized/code-examples/with-sveltekit.md +0 -1061
- package/.docs/organized/code-examples/with-tanstack.md +0 -811
- package/.docs/organized/code-examples/with-tap-runtime.md +0 -812
- package/.docs/organized/code-examples/with-virtualized-thread.md +0 -680
- package/.docs/organized/code-examples/with-vue.md +0 -408
- package/.docs/raw/docs/(docs)/architecture.mdx +0 -146
- package/.docs/raw/docs/(docs)/base-ui.mdx +0 -39
- package/.docs/raw/docs/(docs)/cli.mdx +0 -542
- package/.docs/raw/docs/(docs)/devtools.mdx +0 -79
- package/.docs/raw/docs/(docs)/index.mdx +0 -21
- package/.docs/raw/docs/(docs)/installation.mdx +0 -483
- package/.docs/raw/docs/(docs)/llm.mdx +0 -211
- package/.docs/raw/docs/(docs)/rtl.mdx +0 -78
- package/.docs/raw/docs/(reference)/api-reference/adapters/attachments.mdx +0 -36
- package/.docs/raw/docs/(reference)/api-reference/adapters/feedback.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/adapters/index.mdx +0 -34
- package/.docs/raw/docs/(reference)/api-reference/adapters/model.mdx +0 -44
- package/.docs/raw/docs/(reference)/api-reference/adapters/persistence.mdx +0 -59
- package/.docs/raw/docs/(reference)/api-reference/adapters/runtime.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/adapters/suggestions.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -84
- package/.docs/raw/docs/(reference)/api-reference/context-providers/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/context-providers/scoped-providers.mdx +0 -64
- package/.docs/raw/docs/(reference)/api-reference/external-store/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/external-store/message-conversion.mdx +0 -52
- package/.docs/raw/docs/(reference)/api-reference/external-store/runtime.mdx +0 -49
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/a2ui.mdx +0 -40
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/actions.mdx +0 -56
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/components.mdx +0 -86
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/index.mdx +0 -39
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/json-generative-ui.mdx +0 -42
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/rendering.mdx +0 -84
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/slack.mdx +0 -85
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/spec.mdx +0 -45
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/teams.mdx +0 -93
- package/.docs/raw/docs/(reference)/api-reference/generative-ui/tokens.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/hooks/composer-triggers.mdx +0 -129
- package/.docs/raw/docs/(reference)/api-reference/hooks/index.mdx +0 -31
- package/.docs/raw/docs/(reference)/api-reference/hooks/model-context.mdx +0 -34
- package/.docs/raw/docs/(reference)/api-reference/hooks/primitives.mdx +0 -350
- package/.docs/raw/docs/(reference)/api-reference/hooks/runtimes.mdx +0 -28
- package/.docs/raw/docs/(reference)/api-reference/hooks/state.mdx +0 -97
- package/.docs/raw/docs/(reference)/api-reference/integrations/cloud-ai-sdk.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/integrations/eve.mdx +0 -97
- package/.docs/raw/docs/(reference)/api-reference/integrations/index.mdx +0 -28
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-ai-sdk.mdx +0 -200
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +0 -37
- package/.docs/raw/docs/(reference)/api-reference/model-context/context.mdx +0 -50
- package/.docs/raw/docs/(reference)/api-reference/model-context/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/model-context/registry.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/overview.mdx +0 -566
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +0 -152
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +0 -239
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +0 -208
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +0 -108
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -99
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -145
- package/.docs/raw/docs/(reference)/api-reference/primitives/chain-of-thought.mdx +0 -82
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +0 -619
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -65
- package/.docs/raw/docs/(reference)/api-reference/primitives/index.mdx +0 -73
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +0 -117
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -339
- package/.docs/raw/docs/(reference)/api-reference/primitives/queue-item.mdx +0 -77
- package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +0 -88
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +0 -81
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -129
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +0 -138
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +0 -122
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +0 -289
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +0 -32
- package/.docs/raw/docs/(reference)/api-reference/runtimes/index.mdx +0 -43
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +0 -43
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/queue-state.mdx +0 -20
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -24
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +0 -36
- package/.docs/raw/docs/(reference)/api-reference/tools/component-tools.mdx +0 -85
- package/.docs/raw/docs/(reference)/api-reference/tools/index.mdx +0 -45
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables-legacy.mdx +0 -55
- package/.docs/raw/docs/(reference)/api-reference/tools/interactables.mdx +0 -151
- package/.docs/raw/docs/(reference)/api-reference/tools/rendering.mdx +0 -106
- package/.docs/raw/docs/(reference)/api-reference/tools/status.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/tools/toolkits.mdx +0 -178
- package/.docs/raw/docs/(reference)/api-reference/transport/assistant-transport.mdx +0 -48
- package/.docs/raw/docs/(reference)/api-reference/transport/frame.mdx +0 -62
- package/.docs/raw/docs/(reference)/api-reference/transport/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/utilities/index.mdx +0 -19
- package/.docs/raw/docs/(reference)/api-reference/utilities/miscellaneous.mdx +0 -149
- package/.docs/raw/docs/(reference)/api-reference/voice/index.mdx +0 -22
- package/.docs/raw/docs/(reference)/api-reference/voice/session.mdx +0 -54
- package/.docs/raw/docs/(reference)/api-reference/voice/speech-dictation.mdx +0 -36
- package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +0 -527
- package/.docs/raw/docs/cloud/ai-sdk.mdx +0 -602
- package/.docs/raw/docs/cloud/authorization.mdx +0 -252
- package/.docs/raw/docs/cloud/index.mdx +0 -46
- package/.docs/raw/docs/cloud/langgraph.mdx +0 -554
- package/.docs/raw/docs/copilots/assistant-frame.mdx +0 -400
- package/.docs/raw/docs/copilots/make-assistant-visible.mdx +0 -82
- package/.docs/raw/docs/copilots/model-context.mdx +0 -156
- package/.docs/raw/docs/copilots/motivation.mdx +0 -202
- package/.docs/raw/docs/copilots/use-assistant-instructions.mdx +0 -64
- package/.docs/raw/docs/guides/attachments.mdx +0 -619
- package/.docs/raw/docs/guides/branching.mdx +0 -76
- package/.docs/raw/docs/guides/chain-of-thought.mdx +0 -164
- package/.docs/raw/docs/guides/chatgpt-subscription.mdx +0 -108
- package/.docs/raw/docs/guides/context-api.mdx +0 -619
- package/.docs/raw/docs/guides/dictation.mdx +0 -298
- package/.docs/raw/docs/guides/editing.mdx +0 -102
- package/.docs/raw/docs/guides/electron.mdx +0 -369
- package/.docs/raw/docs/guides/headless-composer-input.mdx +0 -113
- package/.docs/raw/docs/guides/image-generation.mdx +0 -74
- package/.docs/raw/docs/guides/index.mdx +0 -117
- package/.docs/raw/docs/guides/input-history.mdx +0 -55
- package/.docs/raw/docs/guides/latex.mdx +0 -158
- package/.docs/raw/docs/guides/mentions.mdx +0 -575
- package/.docs/raw/docs/guides/message-timing.mdx +0 -209
- package/.docs/raw/docs/guides/quoting.mdx +0 -169
- package/.docs/raw/docs/guides/resumable-stream-deployment.mdx +0 -212
- package/.docs/raw/docs/guides/resumable-stream-stores.mdx +0 -152
- package/.docs/raw/docs/guides/resumable-streams.mdx +0 -292
- package/.docs/raw/docs/guides/slash-commands.mdx +0 -358
- package/.docs/raw/docs/guides/speech.mdx +0 -172
- package/.docs/raw/docs/guides/suggestions.mdx +0 -384
- package/.docs/raw/docs/guides/virtualization.mdx +0 -133
- package/.docs/raw/docs/guides/voice.mdx +0 -310
- package/.docs/raw/docs/ink/adapters.mdx +0 -99
- package/.docs/raw/docs/ink/custom-backend.mdx +0 -254
- package/.docs/raw/docs/ink/hooks.mdx +0 -469
- package/.docs/raw/docs/ink/index.mdx +0 -236
- package/.docs/raw/docs/ink/migration.mdx +0 -138
- package/.docs/raw/docs/ink/primitives.mdx +0 -1259
- package/.docs/raw/docs/integrations/attachments/custom-adapter.mdx +0 -528
- package/.docs/raw/docs/integrations/auth/better-auth.mdx +0 -188
- package/.docs/raw/docs/integrations/auth/clerk.mdx +0 -166
- package/.docs/raw/docs/integrations/auth/next-auth.mdx +0 -191
- package/.docs/raw/docs/integrations/frameworks/ai-sdk.mdx +0 -88
- package/.docs/raw/docs/integrations/frameworks/cloudflare-agents/overview.mdx +0 -282
- package/.docs/raw/docs/integrations/frameworks/mastra/full-stack.mdx +0 -188
- package/.docs/raw/docs/integrations/frameworks/mastra/overview.mdx +0 -57
- package/.docs/raw/docs/integrations/frameworks/mastra/separate-server.mdx +0 -201
- package/.docs/raw/docs/integrations/gateways/index.mdx +0 -162
- package/.docs/raw/docs/integrations/index.mdx +0 -178
- package/.docs/raw/docs/integrations/observability/helicone.mdx +0 -129
- package/.docs/raw/docs/integrations/observability/langfuse.mdx +0 -161
- package/.docs/raw/docs/integrations/observability/langsmith.mdx +0 -151
- package/.docs/raw/docs/integrations/persistence/custom-adapter.mdx +0 -773
- package/.docs/raw/docs/migrations/deprecation-policy.mdx +0 -42
- package/.docs/raw/docs/migrations/index.mdx +0 -50
- package/.docs/raw/docs/migrations/react-compatibility.mdx +0 -74
- package/.docs/raw/docs/migrations/react-langgraph-v0-7.mdx +0 -328
- package/.docs/raw/docs/migrations/toolkit-tools.mdx +0 -236
- package/.docs/raw/docs/migrations/v0-11.mdx +0 -172
- package/.docs/raw/docs/migrations/v0-12.mdx +0 -302
- package/.docs/raw/docs/migrations/v0-14.mdx +0 -297
- package/.docs/raw/docs/migrations/v0-15.mdx +0 -270
- package/.docs/raw/docs/primitives/action-bar.mdx +0 -352
- package/.docs/raw/docs/primitives/assistant-modal.mdx +0 -216
- package/.docs/raw/docs/primitives/attachment.mdx +0 -217
- package/.docs/raw/docs/primitives/branch-picker.mdx +0 -222
- package/.docs/raw/docs/primitives/chain-of-thought.mdx +0 -315
- package/.docs/raw/docs/primitives/composer.mdx +0 -659
- package/.docs/raw/docs/primitives/error.mdx +0 -142
- package/.docs/raw/docs/primitives/index.mdx +0 -99
- package/.docs/raw/docs/primitives/message.mdx +0 -618
- package/.docs/raw/docs/primitives/selection-toolbar.mdx +0 -191
- package/.docs/raw/docs/primitives/suggestion.mdx +0 -254
- package/.docs/raw/docs/primitives/thread-list.mdx +0 -467
- package/.docs/raw/docs/primitives/thread.mdx +0 -509
- package/.docs/raw/docs/react-native/adapters.mdx +0 -94
- package/.docs/raw/docs/react-native/custom-backend.mdx +0 -207
- package/.docs/raw/docs/react-native/hooks.mdx +0 -339
- package/.docs/raw/docs/react-native/index.mdx +0 -289
- package/.docs/raw/docs/react-native/migration.mdx +0 -142
- package/.docs/raw/docs/react-native/primitives.mdx +0 -839
- package/.docs/raw/docs/runtimes/a2a/client-and-hooks.mdx +0 -399
- package/.docs/raw/docs/runtimes/a2a/overview.mdx +0 -60
- package/.docs/raw/docs/runtimes/a2a/quickstart.mdx +0 -216
- package/.docs/raw/docs/runtimes/ag-ui/agent-state.mdx +0 -124
- package/.docs/raw/docs/runtimes/ag-ui/overview.mdx +0 -70
- package/.docs/raw/docs/runtimes/ag-ui/quickstart.mdx +0 -243
- package/.docs/raw/docs/runtimes/ag-ui/runtime-options.mdx +0 -255
- package/.docs/raw/docs/runtimes/ai-sdk/overview.mdx +0 -61
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -122
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +0 -135
- package/.docs/raw/docs/runtimes/ai-sdk/v6-legacy.mdx +0 -636
- package/.docs/raw/docs/runtimes/ai-sdk/v7.mdx +0 -716
- package/.docs/raw/docs/runtimes/claude-managed-agents.mdx +0 -118
- package/.docs/raw/docs/runtimes/concepts/adapters.mdx +0 -265
- package/.docs/raw/docs/runtimes/concepts/architecture.mdx +0 -167
- package/.docs/raw/docs/runtimes/concepts/stability.mdx +0 -68
- package/.docs/raw/docs/runtimes/concepts/threads.mdx +0 -513
- package/.docs/raw/docs/runtimes/custom/assistant-transport.mdx +0 -763
- package/.docs/raw/docs/runtimes/custom/data-stream.mdx +0 -339
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +0 -957
- package/.docs/raw/docs/runtimes/custom/local-runtime.mdx +0 -902
- package/.docs/raw/docs/runtimes/custom/overview.mdx +0 -71
- package/.docs/raw/docs/runtimes/eve/overview.mdx +0 -151
- package/.docs/raw/docs/runtimes/eve/quickstart.mdx +0 -192
- package/.docs/raw/docs/runtimes/google-adk/api.mdx +0 -256
- package/.docs/raw/docs/runtimes/google-adk/hooks.mdx +0 -784
- package/.docs/raw/docs/runtimes/google-adk/overview.mdx +0 -69
- package/.docs/raw/docs/runtimes/google-adk/quickstart.mdx +0 -229
- package/.docs/raw/docs/runtimes/langchain.mdx +0 -901
- package/.docs/raw/docs/runtimes/langgraph/agent-state.mdx +0 -181
- package/.docs/raw/docs/runtimes/langgraph/generative-ui.mdx +0 -305
- package/.docs/raw/docs/runtimes/langgraph/interrupts.mdx +0 -104
- package/.docs/raw/docs/runtimes/langgraph/overview.mdx +0 -84
- package/.docs/raw/docs/runtimes/langgraph/quickstart.mdx +0 -496
- package/.docs/raw/docs/runtimes/langgraph/streaming.mdx +0 -144
- package/.docs/raw/docs/runtimes/langgraph/threads.mdx +0 -113
- package/.docs/raw/docs/runtimes/langgraph/tutorial/introduction.mdx +0 -29
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-1.mdx +0 -93
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +0 -347
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -393
- package/.docs/raw/docs/runtimes/opencode/hooks.mdx +0 -194
- package/.docs/raw/docs/runtimes/opencode/overview.mdx +0 -58
- package/.docs/raw/docs/runtimes/opencode/quickstart.mdx +0 -119
- package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +0 -133
- package/.docs/raw/docs/tools/a2ui.mdx +0 -107
- package/.docs/raw/docs/tools/backend.mdx +0 -147
- package/.docs/raw/docs/tools/defining-tools.mdx +0 -574
- package/.docs/raw/docs/tools/dynamic-tools.mdx +0 -112
- package/.docs/raw/docs/tools/generative-ui-primitive.mdx +0 -180
- package/.docs/raw/docs/tools/generative-ui-slack.mdx +0 -167
- package/.docs/raw/docs/tools/generative-ui-teams.mdx +0 -160
- package/.docs/raw/docs/tools/generative-ui.mdx +0 -322
- package/.docs/raw/docs/tools/index.mdx +0 -72
- package/.docs/raw/docs/tools/interactables.mdx +0 -1084
- package/.docs/raw/docs/tools/mcp-apps.mdx +0 -346
- package/.docs/raw/docs/tools/mcp.mdx +0 -466
- package/.docs/raw/docs/tools/multi-agent.mdx +0 -237
- package/.docs/raw/docs/tools/openui.mdx +0 -175
- package/.docs/raw/docs/tools/tool-ui.mdx +0 -1008
- package/.docs/raw/docs/tools/user-managed-mcp.mdx +0 -428
- package/.docs/raw/docs/ui/accordion.mdx +0 -266
- package/.docs/raw/docs/ui/assistant-modal.mdx +0 -166
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +0 -89
- package/.docs/raw/docs/ui/attachment.mdx +0 -259
- package/.docs/raw/docs/ui/badge.mdx +0 -150
- package/.docs/raw/docs/ui/composer-trigger-popover.mdx +0 -212
- package/.docs/raw/docs/ui/context-display.mdx +0 -148
- package/.docs/raw/docs/ui/diff-viewer.mdx +0 -280
- package/.docs/raw/docs/ui/directive-text.mdx +0 -114
- package/.docs/raw/docs/ui/dot-matrix.mdx +0 -133
- package/.docs/raw/docs/ui/file.mdx +0 -159
- package/.docs/raw/docs/ui/follow-up-suggestions.mdx +0 -82
- package/.docs/raw/docs/ui/image.mdx +0 -102
- package/.docs/raw/docs/ui/markdown.mdx +0 -64
- package/.docs/raw/docs/ui/mcp-config.mdx +0 -107
- package/.docs/raw/docs/ui/mermaid.mdx +0 -92
- package/.docs/raw/docs/ui/message-timing.mdx +0 -93
- package/.docs/raw/docs/ui/model-selector.mdx +0 -455
- package/.docs/raw/docs/ui/number-roll.mdx +0 -154
- package/.docs/raw/docs/ui/part-grouping.mdx +0 -614
- package/.docs/raw/docs/ui/quote.mdx +0 -211
- package/.docs/raw/docs/ui/reasoning.mdx +0 -186
- package/.docs/raw/docs/ui/scrollbar.mdx +0 -77
- package/.docs/raw/docs/ui/select.mdx +0 -254
- package/.docs/raw/docs/ui/sources.mdx +0 -177
- package/.docs/raw/docs/ui/streamdown.mdx +0 -392
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +0 -205
- package/.docs/raw/docs/ui/tabs.mdx +0 -271
- package/.docs/raw/docs/ui/thread-list.mdx +0 -372
- package/.docs/raw/docs/ui/thread.mdx +0 -512
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -127
- package/.docs/raw/docs/ui/tool-group.mdx +0 -240
- package/.docs/raw/docs/ui/voice.mdx +0 -173
- package/.docs/raw/docs/utilities/heat-graph.mdx +0 -237
- package/.docs/raw/docs/utilities/react-o11y.mdx +0 -362
- package/.docs/raw/docs/utilities/tw-shimmer.mdx +0 -212
- package/dist/constants.d.ts +0 -14
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -19
- package/dist/constants.js.map +0 -1
- package/dist/prepare-docs/code-examples.d.ts +0 -5
- package/dist/prepare-docs/code-examples.d.ts.map +0 -1
- package/dist/prepare-docs/code-examples.js +0 -117
- package/dist/prepare-docs/code-examples.js.map +0 -1
- package/dist/prepare-docs/copy-raw.d.ts +0 -5
- package/dist/prepare-docs/copy-raw.d.ts.map +0 -1
- package/dist/prepare-docs/copy-raw.js +0 -49
- package/dist/prepare-docs/copy-raw.js.map +0 -1
- package/dist/prepare-docs/prepare.d.ts +0 -1
- package/dist/prepare-docs/prepare.js +0 -22
- package/dist/prepare-docs/prepare.js.map +0 -1
- package/dist/prompts/xulux-playground.d.ts +0 -12
- package/dist/prompts/xulux-playground.d.ts.map +0 -1
- package/dist/prompts/xulux-playground.js +0 -33
- package/dist/prompts/xulux-playground.js.map +0 -1
- package/dist/tools/docs.d.ts +0 -22
- package/dist/tools/docs.d.ts.map +0 -1
- package/dist/tools/docs.js +0 -177
- package/dist/tools/docs.js.map +0 -1
- package/dist/tools/examples.d.ts +0 -24
- package/dist/tools/examples.d.ts.map +0 -1
- package/dist/tools/examples.js +0 -87
- package/dist/tools/examples.js.map +0 -1
- package/dist/tools/resources.d.ts +0 -6
- package/dist/tools/resources.d.ts.map +0 -1
- package/dist/tools/resources.js +0 -75
- package/dist/tools/resources.js.map +0 -1
- package/dist/tools/search.d.ts +0 -24
- package/dist/tools/search.d.ts.map +0 -1
- package/dist/tools/search.js +0 -39
- package/dist/tools/search.js.map +0 -1
- package/dist/tools/tests/mcp-test-client.d.ts +0 -15
- package/dist/tools/tests/mcp-test-client.d.ts.map +0 -1
- package/dist/tools/tests/mcp-test-client.js +0 -68
- package/dist/tools/tests/mcp-test-client.js.map +0 -1
- package/dist/tools/tests/test-setup.d.ts +0 -7
- package/dist/tools/tests/test-setup.d.ts.map +0 -1
- package/dist/tools/tests/test-setup.js +0 -36
- package/dist/tools/tests/test-setup.js.map +0 -1
- package/dist/tools/xulux-templates.d.ts +0 -58
- package/dist/tools/xulux-templates.d.ts.map +0 -1
- package/dist/tools/xulux-templates.js +0 -84
- package/dist/tools/xulux-templates.js.map +0 -1
- package/dist/utils/cache.d.ts +0 -5
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -18
- package/dist/utils/cache.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -10
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -20
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/mcp-format.d.ts +0 -11
- package/dist/utils/mcp-format.d.ts.map +0 -1
- package/dist/utils/mcp-format.js +0 -14
- package/dist/utils/mcp-format.js.map +0 -1
- package/dist/utils/mdx.d.ts +0 -12
- package/dist/utils/mdx.d.ts.map +0 -1
- package/dist/utils/mdx.js +0 -45
- package/dist/utils/mdx.js.map +0 -1
- package/dist/utils/paths.d.ts +0 -12
- package/dist/utils/paths.d.ts.map +0 -1
- package/dist/utils/paths.js +0 -93
- package/dist/utils/paths.js.map +0 -1
- package/dist/utils/search.d.ts +0 -10
- package/dist/utils/search.d.ts.map +0 -1
- package/dist/utils/search.js +0 -97
- package/dist/utils/search.js.map +0 -1
- package/dist/utils/security.d.ts +0 -5
- package/dist/utils/security.d.ts.map +0 -1
- package/dist/utils/security.js +0 -22
- package/dist/utils/security.js.map +0 -1
- package/dist/xulux/catalog-client.d.ts +0 -14
- package/dist/xulux/catalog-client.d.ts.map +0 -1
- package/dist/xulux/catalog-client.js +0 -67
- package/dist/xulux/catalog-client.js.map +0 -1
- package/dist/xulux/fallback-catalog.d.ts +0 -7
- package/dist/xulux/fallback-catalog.d.ts.map +0 -1
- package/dist/xulux/fallback-catalog.js +0 -47
- package/dist/xulux/fallback-catalog.js.map +0 -1
- package/dist/xulux/fetch-sandbox.d.ts +0 -5
- package/dist/xulux/fetch-sandbox.d.ts.map +0 -1
- package/dist/xulux/fetch-sandbox.js +0 -40
- package/dist/xulux/fetch-sandbox.js.map +0 -1
- package/dist/xulux/template-service.d.ts +0 -84
- package/dist/xulux/template-service.d.ts.map +0 -1
- package/dist/xulux/template-service.js +0 -223
- package/dist/xulux/template-service.js.map +0 -1
- package/dist/xulux/types.d.ts +0 -55
- package/dist/xulux/types.d.ts.map +0 -1
- package/dist/xulux/types.js +0 -6
- package/dist/xulux/types.js.map +0 -1
- package/src/constants.ts +0 -24
- package/src/prepare-docs/code-examples.ts +0 -158
- package/src/prepare-docs/copy-raw.ts +0 -50
- package/src/prepare-docs/prepare.ts +0 -24
- package/src/prompts/xulux-playground.ts +0 -36
- package/src/tools/docs.ts +0 -255
- package/src/tools/examples.ts +0 -114
- package/src/tools/resources.ts +0 -111
- package/src/tools/search.ts +0 -46
- package/src/tools/tests/completions.test.ts +0 -60
- package/src/tools/tests/directory-size-cap.test.ts +0 -50
- package/src/tools/tests/docs.test.ts +0 -144
- package/src/tools/tests/examples.test.ts +0 -94
- package/src/tools/tests/integration.test.ts +0 -45
- package/src/tools/tests/json-parsing.test.ts +0 -23
- package/src/tools/tests/listings-cache.test.ts +0 -19
- package/src/tools/tests/mcp-protocol.test.ts +0 -216
- package/src/tools/tests/mcp-test-client.ts +0 -111
- package/src/tools/tests/path-traversal.test.ts +0 -81
- package/src/tools/tests/resources.test.ts +0 -133
- package/src/tools/tests/search.test.ts +0 -37
- package/src/tools/tests/test-setup.ts +0 -50
- package/src/tools/tests/xulux-templates.test.ts +0 -262
- package/src/tools/xulux-templates.ts +0 -141
- package/src/utils/cache.ts +0 -20
- package/src/utils/logger.ts +0 -20
- package/src/utils/mcp-format.ts +0 -14
- package/src/utils/mdx.ts +0 -59
- package/src/utils/paths.ts +0 -139
- package/src/utils/search.ts +0 -131
- package/src/utils/security.ts +0 -52
- package/src/utils/tests/cache.test.ts +0 -51
- package/src/utils/tests/mcp-format.test.ts +0 -22
- package/src/utils/tests/security.test.ts +0 -119
- package/src/xulux/catalog-client.ts +0 -105
- package/src/xulux/fallback-catalog.ts +0 -63
- package/src/xulux/fetch-sandbox.ts +0 -56
- package/src/xulux/template-service.ts +0 -406
- package/src/xulux/types.ts +0 -60
|
@@ -1,466 +0,0 @@
|
|
|
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
|
-
```mermaid
|
|
11
|
-
flowchart LR
|
|
12
|
-
client["client"] --> api["/api/chat"] --> mcp["MCP client"] --> server["MCP server<br/>(HTTP, SSE, stdio)"]
|
|
13
|
-
mcp --> tools["tools()"] --> stream["passed to<br/>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`, or toolkit entries with `render`) renders the results.
|
|
17
|
-
|
|
18
|
-
<Callout type="info">
|
|
19
|
-
If you use a `"use generative"` toolkit, spread `defineMcpToolkit({ ... })`
|
|
20
|
-
in the toolkit and use `AISDKToolkit` in your route. It opens the MCP clients,
|
|
21
|
-
merges their tools with your toolkit, and closes them for you.
|
|
22
|
-
</Callout>
|
|
23
|
-
|
|
24
|
-
## Setup
|
|
25
|
-
|
|
26
|
-
<Steps>
|
|
27
|
-
<Step>
|
|
28
|
-
|
|
29
|
-
### Install the MCP client
|
|
30
|
-
|
|
31
|
-
<InstallCommand npm={["@ai-sdk/mcp"]} />
|
|
32
|
-
|
|
33
|
-
For stdio transports (local dev only), also install the official MCP SDK:
|
|
34
|
-
|
|
35
|
-
<InstallCommand npm={["@modelcontextprotocol/sdk"]} />
|
|
36
|
-
|
|
37
|
-
</Step>
|
|
38
|
-
<Step>
|
|
39
|
-
|
|
40
|
-
### Connect to an MCP server
|
|
41
|
-
|
|
42
|
-
Set the server URL and any auth token your server requires:
|
|
43
|
-
|
|
44
|
-
```sh title=".env.local"
|
|
45
|
-
MCP_SERVER_URL=https://your-mcp-server.example/mcp
|
|
46
|
-
MCP_TOKEN=...
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
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.
|
|
50
|
-
|
|
51
|
-
```ts title="app/api/chat/route.ts"
|
|
52
|
-
import { createMCPClient } from "@ai-sdk/mcp";
|
|
53
|
-
|
|
54
|
-
const mcpClient = await createMCPClient({
|
|
55
|
-
transport: {
|
|
56
|
-
type: "http",
|
|
57
|
-
url: process.env.MCP_SERVER_URL!,
|
|
58
|
-
headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` },
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
For stdio:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { createMCPClient } from "@ai-sdk/mcp";
|
|
67
|
-
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
68
|
-
|
|
69
|
-
const mcpClient = await createMCPClient({
|
|
70
|
-
transport: new StdioClientTransport({
|
|
71
|
-
command: "node",
|
|
72
|
-
args: ["./mcp-server/dist/index.js"],
|
|
73
|
-
}),
|
|
74
|
-
});
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
</Step>
|
|
78
|
-
<Step>
|
|
79
|
-
|
|
80
|
-
### Define MCP servers in your toolkit
|
|
81
|
-
|
|
82
|
-
In a generative toolkit, spread `defineMcpToolkit({ ... })` with one entry per
|
|
83
|
-
MCP server. The entry key names the server connection; the MCP server publishes
|
|
84
|
-
the actual tool names. Use a readable key because it appears in connection,
|
|
85
|
-
tool-listing, and close errors for debugging.
|
|
86
|
-
|
|
87
|
-
```tsx title="app/toolkit.tsx"
|
|
88
|
-
"use generative";
|
|
89
|
-
|
|
90
|
-
import { defineMcpToolkit, defineToolkit } from "@assistant-ui/react";
|
|
91
|
-
|
|
92
|
-
export default defineToolkit({
|
|
93
|
-
...defineMcpToolkit({
|
|
94
|
-
github: {
|
|
95
|
-
type: "http",
|
|
96
|
-
url: "https://mcp.example.com/mcp",
|
|
97
|
-
connectionTimeout: 10_000,
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
});
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Use `{ server, disabled }` when a whole MCP server should stay configured but
|
|
104
|
-
not expose tools for the current request, such as missing credentials, feature
|
|
105
|
-
flags, or plan gating:
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
defineMcpToolkit({
|
|
109
|
-
docs: {
|
|
110
|
-
server: {
|
|
111
|
-
type: "http",
|
|
112
|
-
url: process.env.DOCS_MCP_URL!,
|
|
113
|
-
},
|
|
114
|
-
disabled: !process.env.DOCS_MCP_URL,
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Use `tools` when the server should stay enabled but specific MCP tools should
|
|
120
|
-
be hidden from the model:
|
|
121
|
-
|
|
122
|
-
```tsx
|
|
123
|
-
defineMcpToolkit({
|
|
124
|
-
docs: {
|
|
125
|
-
server: {
|
|
126
|
-
type: "http",
|
|
127
|
-
url: process.env.DOCS_MCP_URL!,
|
|
128
|
-
},
|
|
129
|
-
tools: {
|
|
130
|
-
deleteDocument: {
|
|
131
|
-
disabled: !userCanDelete,
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
If multiple MCP servers expose the same tool name, wrap the entry with
|
|
139
|
-
`{ server, prefix }` to give each server's tools distinct model-visible names:
|
|
140
|
-
|
|
141
|
-
```tsx
|
|
142
|
-
export default defineToolkit({
|
|
143
|
-
...defineMcpToolkit({
|
|
144
|
-
docs: {
|
|
145
|
-
server: { type: "http", url: "https://docs.example.com/mcp" },
|
|
146
|
-
prefix: "docs_",
|
|
147
|
-
},
|
|
148
|
-
github: {
|
|
149
|
-
server: { type: "http", url: "https://github.example.com/mcp" },
|
|
150
|
-
prefix: "github_",
|
|
151
|
-
},
|
|
152
|
-
}),
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
If both servers publish `search`, the model receives `docs_search` and
|
|
157
|
-
`github_search` instead of an ambiguous duplicate.
|
|
158
|
-
|
|
159
|
-
Use `AISDKToolkit` in the route. It opens the MCP clients, merges their tools
|
|
160
|
-
with the rest of your toolkit, and closes them when you call `close()`:
|
|
161
|
-
|
|
162
|
-
`connectionTimeout` is optional and measured in milliseconds. Set it to fail
|
|
163
|
-
the server-side MCP readiness flow (`createMCPClient()` plus `tools()`) before
|
|
164
|
-
a bad URL or hanging local process can stall the route.
|
|
165
|
-
|
|
166
|
-
```ts title="app/api/chat/route.ts"
|
|
167
|
-
import { AISDKToolkit } from "@assistant-ui/react-ai-sdk";
|
|
168
|
-
import { openai } from "@ai-sdk/openai";
|
|
169
|
-
import { streamText, convertToModelMessages } from "ai";
|
|
170
|
-
import type { UIMessage } from "ai";
|
|
171
|
-
import toolkit from "../../toolkit";
|
|
172
|
-
|
|
173
|
-
export async function POST(req: Request) {
|
|
174
|
-
const { messages, tools }: { messages: UIMessage[]; tools?: Record<string, any> } =
|
|
175
|
-
await req.json();
|
|
176
|
-
|
|
177
|
-
const aiToolkit = new AISDKToolkit({ toolkit });
|
|
178
|
-
|
|
179
|
-
const result = streamText({
|
|
180
|
-
model: openai("gpt-5.6-luna"),
|
|
181
|
-
messages: await convertToModelMessages(messages),
|
|
182
|
-
tools: await aiToolkit.tools({ frontend: tools }),
|
|
183
|
-
onFinish: async () => {
|
|
184
|
-
await aiToolkit.close();
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
return result.toUIMessageStreamResponse();
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
</Step>
|
|
193
|
-
<Step>
|
|
194
|
-
|
|
195
|
-
### Wire the tools into the route
|
|
196
|
-
|
|
197
|
-
For manual MCP client control, `mcpClient.tools()` returns an object shaped
|
|
198
|
-
exactly like the `tools` argument of `streamText`. Spread it in alongside any of
|
|
199
|
-
your own tools, and close the client when the response finishes:
|
|
200
|
-
|
|
201
|
-
```ts title="app/api/chat/route.ts"
|
|
202
|
-
import { createMCPClient } from "@ai-sdk/mcp";
|
|
203
|
-
import { openai } from "@ai-sdk/openai";
|
|
204
|
-
import { streamText, convertToModelMessages } from "ai";
|
|
205
|
-
import type { UIMessage } from "ai";
|
|
206
|
-
|
|
207
|
-
export const maxDuration = 60;
|
|
208
|
-
|
|
209
|
-
export async function POST(req: Request) {
|
|
210
|
-
const { messages }: { messages: UIMessage[] } = await req.json();
|
|
211
|
-
|
|
212
|
-
const mcpClient = await createMCPClient({
|
|
213
|
-
transport: {
|
|
214
|
-
type: "http",
|
|
215
|
-
url: process.env.MCP_SERVER_URL!,
|
|
216
|
-
headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` },
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
const tools = await mcpClient.tools();
|
|
221
|
-
|
|
222
|
-
const result = streamText({
|
|
223
|
-
model: openai("gpt-5.6-luna"),
|
|
224
|
-
messages: await convertToModelMessages(messages),
|
|
225
|
-
tools,
|
|
226
|
-
onFinish: async () => {
|
|
227
|
-
await mcpClient.close();
|
|
228
|
-
},
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
return result.toUIMessageStreamResponse();
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
`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.
|
|
236
|
-
|
|
237
|
-
</Step>
|
|
238
|
-
<Step>
|
|
239
|
-
|
|
240
|
-
### Combine multiple MCP servers
|
|
241
|
-
|
|
242
|
-
Each server has its own client. Spread their tool maps together:
|
|
243
|
-
|
|
244
|
-
```ts
|
|
245
|
-
const githubClient = await createMCPClient({
|
|
246
|
-
transport: { type: "http", url: process.env.GITHUB_MCP_URL! },
|
|
247
|
-
});
|
|
248
|
-
const filesClient = await createMCPClient({
|
|
249
|
-
transport: { type: "http", url: process.env.FILES_MCP_URL! },
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
const tools = {
|
|
253
|
-
...(await githubClient.tools()),
|
|
254
|
-
...(await filesClient.tools()),
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
// remember to close both in onFinish
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
If two servers expose tools with the same name, the later spread wins. Rename or scope as needed.
|
|
261
|
-
|
|
262
|
-
</Step>
|
|
263
|
-
<Step>
|
|
264
|
-
|
|
265
|
-
### Render results in the UI
|
|
266
|
-
|
|
267
|
-
Tool calls flow through the existing assistant-ui tool-call rendering. With no
|
|
268
|
-
setup, the bundled `<ToolFallback>` component renders the call name, arguments,
|
|
269
|
-
and result. To customize the appearance for a specific tool in a generative
|
|
270
|
-
toolkit, add an `externalTool()` renderer whose key matches the MCP tool name:
|
|
271
|
-
|
|
272
|
-
<PlatformTabs>
|
|
273
|
-
<Tab value="React">
|
|
274
|
-
|
|
275
|
-
```tsx title="app/toolkit.tsx"
|
|
276
|
-
"use generative";
|
|
277
|
-
|
|
278
|
-
import { defineMcpToolkit, defineToolkit, externalTool } from "@assistant-ui/react";
|
|
279
|
-
|
|
280
|
-
type Args = { repo: string; number: number };
|
|
281
|
-
type Result = { title: string; state: string; url: string };
|
|
282
|
-
|
|
283
|
-
export default defineToolkit({
|
|
284
|
-
...defineMcpToolkit({
|
|
285
|
-
github: { type: "http", url: "https://mcp.example.com/mcp" },
|
|
286
|
-
}),
|
|
287
|
-
github_get_issue: {
|
|
288
|
-
execute: externalTool(),
|
|
289
|
-
render: ({ args, result }: { args: Args; result?: Result }) => (
|
|
290
|
-
<div className="rounded border p-3">
|
|
291
|
-
<div className="font-mono text-sm">{args.repo}#{args.number}</div>
|
|
292
|
-
{result && (
|
|
293
|
-
<a href={result.url} className="underline">
|
|
294
|
-
{result.title} ({result.state})
|
|
295
|
-
</a>
|
|
296
|
-
)}
|
|
297
|
-
</div>
|
|
298
|
-
),
|
|
299
|
-
},
|
|
300
|
-
});
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
</Tab>
|
|
304
|
-
<Tab value="React Native">
|
|
305
|
-
|
|
306
|
-
```tsx title="components/GitHubIssueToolUI.tsx"
|
|
307
|
-
import { defineToolkit } from "@assistant-ui/react-native";
|
|
308
|
-
import { Linking, Pressable, Text, View } from "react-native";
|
|
309
|
-
|
|
310
|
-
type Args = { repo: string; number: number };
|
|
311
|
-
type Result = { title: string; state: string; url: string };
|
|
312
|
-
|
|
313
|
-
export const toolkit = defineToolkit({
|
|
314
|
-
github_get_issue: {
|
|
315
|
-
type: "backend",
|
|
316
|
-
render: ({ args, result }: { args: Args; result?: Result }) => (
|
|
317
|
-
<View style={{ borderWidth: 1, borderRadius: 6, padding: 12 }}>
|
|
318
|
-
<Text style={{ fontFamily: "Menlo", fontSize: 13 }}>
|
|
319
|
-
{args.repo}#{args.number}
|
|
320
|
-
</Text>
|
|
321
|
-
{result && (
|
|
322
|
-
<Pressable onPress={() => Linking.openURL(result.url)}>
|
|
323
|
-
<Text style={{ textDecorationLine: "underline" }}>
|
|
324
|
-
{result.title} ({result.state})
|
|
325
|
-
</Text>
|
|
326
|
-
</Pressable>
|
|
327
|
-
)}
|
|
328
|
-
</View>
|
|
329
|
-
),
|
|
330
|
-
},
|
|
331
|
-
});
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
</Tab>
|
|
335
|
-
<Tab value="React Ink">
|
|
336
|
-
|
|
337
|
-
```tsx title="components/GitHubIssueToolUI.tsx"
|
|
338
|
-
import { defineToolkit } from "@assistant-ui/react-ink";
|
|
339
|
-
import { Box, Text } from "ink";
|
|
340
|
-
|
|
341
|
-
type Args = { repo: string; number: number };
|
|
342
|
-
type Result = { title: string; state: string; url: string };
|
|
343
|
-
|
|
344
|
-
export const toolkit = defineToolkit({
|
|
345
|
-
github_get_issue: {
|
|
346
|
-
type: "backend",
|
|
347
|
-
render: ({ args, result }: { args: Args; result?: Result }) => (
|
|
348
|
-
<Box borderStyle="round" paddingX={1} flexDirection="column">
|
|
349
|
-
<Text>
|
|
350
|
-
{args.repo}#{args.number}
|
|
351
|
-
</Text>
|
|
352
|
-
{result && (
|
|
353
|
-
<Text>
|
|
354
|
-
{result.title} ({result.state}) — {result.url}
|
|
355
|
-
</Text>
|
|
356
|
-
)}
|
|
357
|
-
</Box>
|
|
358
|
-
),
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
</Tab>
|
|
364
|
-
</PlatformTabs>
|
|
365
|
-
|
|
366
|
-
Register the toolkit once with `Tools({ toolkit })`. Renderer keys such as
|
|
367
|
-
`github_get_issue` must match the tool names your MCP server publishes.
|
|
368
|
-
|
|
369
|
-
```tsx title="app/components/RuntimeProvider.tsx"
|
|
370
|
-
"use client";
|
|
371
|
-
|
|
372
|
-
import { AssistantRuntimeProvider, AuiConfig, Tools } from "@assistant-ui/react";
|
|
373
|
-
import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
|
|
374
|
-
import type { ReactNode } from "react";
|
|
375
|
-
|
|
376
|
-
import { toolkit } from "./GitHubIssueToolUI";
|
|
377
|
-
|
|
378
|
-
export function MyRuntimeProvider({ children }: { children: ReactNode }) {
|
|
379
|
-
const runtime = useChatRuntime();
|
|
380
|
-
const config = AuiConfig({ tools: Tools({ toolkit }) });
|
|
381
|
-
return (
|
|
382
|
-
<AssistantRuntimeProvider
|
|
383
|
-
runtime={runtime}
|
|
384
|
-
config={config}
|
|
385
|
-
>
|
|
386
|
-
{children}
|
|
387
|
-
</AssistantRuntimeProvider>
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
`useChatRuntime()` targets `/api/chat` by default. To point at a different endpoint or customize requests, see [Custom transport](/docs/runtimes/ai-sdk/v7#custom-transport).
|
|
393
|
-
|
|
394
|
-
</Step>
|
|
395
|
-
<Step>
|
|
396
|
-
|
|
397
|
-
### Require approval before an MCP tool runs
|
|
398
|
-
|
|
399
|
-
MCP tools execute on the server, so approval is a server-side tool gate, not a `humanTool()` result. Gate the call with AI SDK v7's call-level `toolApproval` option, keyed by the tool's model-visible name. The tool name stays the same, so your custom renderer or the default `ToolFallback` receives `approval` and `respondToApproval` like any other backend tool:
|
|
400
|
-
|
|
401
|
-
```ts title="app/api/chat/route.ts"
|
|
402
|
-
const tools = await mcpClient.tools();
|
|
403
|
-
|
|
404
|
-
const result = streamText({
|
|
405
|
-
model: openai("gpt-5.6-luna"),
|
|
406
|
-
messages: await convertToModelMessages(messages),
|
|
407
|
-
tools,
|
|
408
|
-
toolApproval: {
|
|
409
|
-
github_delete_repository: "user-approval",
|
|
410
|
-
},
|
|
411
|
-
onFinish: async () => {
|
|
412
|
-
await mcpClient.close();
|
|
413
|
-
},
|
|
414
|
-
});
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
With `AISDKToolkit`, pass the same `toolApproval` option alongside the tools returned by `await aiToolkit.tools(...)`; key it by the prefixed name when the entry sets one.
|
|
418
|
-
|
|
419
|
-
On the client, let the AI SDK send the recorded approval decision back to the
|
|
420
|
-
route:
|
|
421
|
-
|
|
422
|
-
```tsx title="app/components/RuntimeProvider.tsx"
|
|
423
|
-
import { lastAssistantMessageIsCompleteWithApprovalResponses } from "ai";
|
|
424
|
-
|
|
425
|
-
const runtime = useChatRuntime({
|
|
426
|
-
sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithApprovalResponses,
|
|
427
|
-
});
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
Use this pattern for backend-owned actions such as deleting, writing, deploying, or calling privileged MCP tools. Use `humanTool()` only when the user supplies the tool result itself. For custom approval UIs, see [Server-side approval gates](/docs/tools/tool-ui#server-side-approval-gates); for the full wire setup, see [Server-side tool approval](/docs/runtimes/ai-sdk/v7#server-side-tool-approval).
|
|
431
|
-
|
|
432
|
-
</Step>
|
|
433
|
-
<Step>
|
|
434
|
-
|
|
435
|
-
### Run and verify
|
|
436
|
-
|
|
437
|
-
Start the app and trigger a tool call (e.g., ask the assistant to do something the MCP server can do). Confirm:
|
|
438
|
-
|
|
439
|
-
- The tool call appears in the chat with the expected arguments.
|
|
440
|
-
- The result renders (either via your custom `ToolUI` or the fallback).
|
|
441
|
-
- No connection leaks: the MCP client closes after each response. If you see open connections accumulating, check `onFinish`.
|
|
442
|
-
|
|
443
|
-
</Step>
|
|
444
|
-
</Steps>
|
|
445
|
-
|
|
446
|
-
## Notes
|
|
447
|
-
|
|
448
|
-
- **Server-side only.** The MCP client uses Node APIs (sockets, optionally child processes). Never instantiate it in client code.
|
|
449
|
-
- **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.
|
|
450
|
-
- **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.
|
|
451
|
-
- **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.
|
|
452
|
-
|
|
453
|
-
## Related
|
|
454
|
-
|
|
455
|
-
<Cards>
|
|
456
|
-
<Card
|
|
457
|
-
title="AI SDK runtime"
|
|
458
|
-
description="The runtime that ferries MCP tool calls to the chat UI."
|
|
459
|
-
href="/docs/runtimes/ai-sdk/v7"
|
|
460
|
-
/>
|
|
461
|
-
<Card
|
|
462
|
-
title="Tools and tool UI"
|
|
463
|
-
description="Build custom renderers for tool calls and approvals."
|
|
464
|
-
href="/docs/tools/defining-tools"
|
|
465
|
-
/>
|
|
466
|
-
</Cards>
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Multi-Agent Chat UI
|
|
3
|
-
description: Render sub-agent conversations and handoffs inside tool calls. Build supervisor and multi-agent patterns in a React chat UI with assistant-ui.
|
|
4
|
-
platforms: ["react"]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
In a multi-agent (orchestrator) architecture, a main agent invokes sub-agents via tool calls. Each sub-agent may produce its own conversation (user/assistant messages, tool calls, etc.). assistant-ui supports rendering these nested conversations using the `MessagePartPrimitive.Messages` primitive.
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
When a tool call includes a `messages` field (`ToolCallMessagePart.messages`), it represents a sub-agent's conversation history. `MessagePartPrimitive.Messages` reads this field from the current tool call part and renders it as a nested thread.
|
|
12
|
-
|
|
13
|
-
Key behaviors:
|
|
14
|
-
|
|
15
|
-
- **Scope inheritance** — Parent toolkit renderers are available in sub-agent messages. A `Tools({ toolkit })` registration at the top level works inside sub-agent conversations too.
|
|
16
|
-
- **Recursive** — Sub-agent messages can contain tool calls that themselves have nested messages. Just use `MessagePartPrimitive.Messages` again.
|
|
17
|
-
- **Read-only** — Sub-agent messages are rendered in a readonly context. No editing, branching, or composing.
|
|
18
|
-
|
|
19
|
-
<Callout type="info">
|
|
20
|
-
This renders a sub-agent's **messages**. To visualize a sub-agent's **execution trace** instead (timing, span hierarchy, waterfalls), see [react-o11y](/docs/utilities/react-o11y), which renders observability spans as collapsible trees and timelines.
|
|
21
|
-
</Callout>
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
<Steps>
|
|
26
|
-
<Step>
|
|
27
|
-
|
|
28
|
-
### Register a Tool UI for the Sub-Agent
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
import {
|
|
32
|
-
defineToolkit,
|
|
33
|
-
Tools,
|
|
34
|
-
MessagePartPrimitive,
|
|
35
|
-
} from "@assistant-ui/react";
|
|
36
|
-
|
|
37
|
-
const toolkit = defineToolkit({
|
|
38
|
-
invoke_researcher: {
|
|
39
|
-
type: "backend",
|
|
40
|
-
render: ({ args, status }) => (
|
|
41
|
-
<div className="my-2 rounded-lg border p-4">
|
|
42
|
-
<div className="mb-2 text-sm font-medium text-gray-500">
|
|
43
|
-
Researcher Agent {status.type === "running" && "(working...)"}
|
|
44
|
-
</div>
|
|
45
|
-
<MessagePartPrimitive.Messages>
|
|
46
|
-
{({ message }) => {
|
|
47
|
-
if (message.role === "user") return <MyUserMessage />;
|
|
48
|
-
return <MyAssistantMessage />;
|
|
49
|
-
}}
|
|
50
|
-
</MessagePartPrimitive.Messages>
|
|
51
|
-
</div>
|
|
52
|
-
),
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
</Step>
|
|
58
|
-
<Step>
|
|
59
|
-
|
|
60
|
-
### Provide the Messages from the Backend
|
|
61
|
-
|
|
62
|
-
Your backend must populate the `messages` field on the tool call result.
|
|
63
|
-
|
|
64
|
-
<Tabs items={["AI SDK", "LangGraph"]}>
|
|
65
|
-
<Tab value="AI SDK">
|
|
66
|
-
|
|
67
|
-
```ts title="api/chat/route.ts"
|
|
68
|
-
tools: {
|
|
69
|
-
invoke_researcher: tool({
|
|
70
|
-
description: "Invoke the researcher sub-agent",
|
|
71
|
-
parameters: z.object({ query: z.string() }),
|
|
72
|
-
execute: async ({ query }) => {
|
|
73
|
-
const subAgentMessages = await runResearcherAgent(query);
|
|
74
|
-
return {
|
|
75
|
-
answer: subAgentMessages.at(-1)?.content,
|
|
76
|
-
messages: subAgentMessages,
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
|
-
}),
|
|
80
|
-
},
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
</Tab>
|
|
84
|
-
<Tab value="LangGraph">
|
|
85
|
-
|
|
86
|
-
With `@assistant-ui/react-langgraph`, use `unstable_createLangGraphStream` and set `unstable_allowCancellation: true` to wire up the stop button. When your graph runs a subgraph, the subgraph's messages appear on `ToolCallMessagePart.messages` automatically once you handle the `onSubgraphValues` / `onSubgraphUpdates` events.
|
|
87
|
-
|
|
88
|
-
```ts title="runtime.ts"
|
|
89
|
-
import {
|
|
90
|
-
useLangGraphRuntime,
|
|
91
|
-
unstable_createLangGraphStream,
|
|
92
|
-
} from "@assistant-ui/react-langgraph";
|
|
93
|
-
|
|
94
|
-
const runtime = useLangGraphRuntime({
|
|
95
|
-
unstable_allowCancellation: true,
|
|
96
|
-
stream: unstable_createLangGraphStream({
|
|
97
|
-
client,
|
|
98
|
-
assistantId,
|
|
99
|
-
// "custom" is required for generative UI; "updates" for subgraph events
|
|
100
|
-
streamMode: ["messages", "updates", "custom"],
|
|
101
|
-
// abort the run server-side when the user clicks stop
|
|
102
|
-
onDisconnect: "cancel",
|
|
103
|
-
}),
|
|
104
|
-
eventHandlers: {
|
|
105
|
-
onSubgraphValues: (namespace, values) => {
|
|
106
|
-
// namespace = e.g. "tools:call_abc" — the sub-agent's node path
|
|
107
|
-
// values contains the subgraph state, including its messages array
|
|
108
|
-
},
|
|
109
|
-
onSubgraphUpdates: (namespace, updates) => {
|
|
110
|
-
// incremental state updates from the subgraph
|
|
111
|
-
},
|
|
112
|
-
onSubgraphError: (namespace, error) => {
|
|
113
|
-
// error scoped to the subgraph; does not mark the parent message failed
|
|
114
|
-
},
|
|
115
|
-
onMessageChunk: (chunk, metadata) => {
|
|
116
|
-
// metadata.namespace is set when the chunk originates from a subgraph
|
|
117
|
-
// use it to attribute the chunk to the correct sub-agent
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
See [LangGraph Streaming](/docs/runtimes/langgraph/streaming) for the full event handler reference.
|
|
124
|
-
|
|
125
|
-
</Tab>
|
|
126
|
-
</Tabs>
|
|
127
|
-
|
|
128
|
-
<Callout type="info">
|
|
129
|
-
The key requirement is that the tool result's corresponding
|
|
130
|
-
`ToolCallMessagePart` includes a `messages` array of `ThreadMessage` objects.
|
|
131
|
-
</Callout>
|
|
132
|
-
|
|
133
|
-
</Step>
|
|
134
|
-
<Step>
|
|
135
|
-
|
|
136
|
-
### Register the Tool UI Component
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
function App() {
|
|
140
|
-
return (
|
|
141
|
-
<AssistantRuntimeProvider runtime={runtime}>
|
|
142
|
-
<Thread />
|
|
143
|
-
<ResearchAgentToolUI />
|
|
144
|
-
</AssistantRuntimeProvider>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
</Step>
|
|
150
|
-
</Steps>
|
|
151
|
-
|
|
152
|
-
## Subgraph Namespace Events
|
|
153
|
-
|
|
154
|
-
When using LangGraph, subgraph events (`onSubgraphValues` / `onSubgraphUpdates` / `onSubgraphError`, plus the `namespace` on `onMessageChunk`) carry a `namespace` that identifies which sub-agent emitted them, letting you attribute messages and state to specific sub-agents. See [LangGraph Streaming](/docs/runtimes/langgraph/streaming) for the full reference.
|
|
155
|
-
|
|
156
|
-
## Recursive Sub-Agents
|
|
157
|
-
|
|
158
|
-
If a sub-agent's tool calls also have nested messages, the same pattern applies recursively:
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
const toolkit = defineToolkit({
|
|
162
|
-
invoke_planner: {
|
|
163
|
-
type: "backend",
|
|
164
|
-
render: () => (
|
|
165
|
-
<div className="rounded border p-3">
|
|
166
|
-
<h4>Planner Agent</h4>
|
|
167
|
-
<MessagePartPrimitive.Messages>
|
|
168
|
-
{({ message }) => {
|
|
169
|
-
if (message.role === "user") return <MyUserMessage />;
|
|
170
|
-
return (
|
|
171
|
-
<MessagePrimitive.Parts>
|
|
172
|
-
{({ part }) => {
|
|
173
|
-
if (part.type === "text") return <MyText />;
|
|
174
|
-
if (part.type === "tool-call" && part.toolName === "invoke_researcher") return (
|
|
175
|
-
<div className="ml-4 rounded border p-3">
|
|
176
|
-
<h5>Researcher Agent</h5>
|
|
177
|
-
{/* Nested sub-agent renders recursively */}
|
|
178
|
-
<MessagePartPrimitive.Messages>
|
|
179
|
-
{({ message }) => {
|
|
180
|
-
if (message.role === "user") return <MyUserMessage />;
|
|
181
|
-
return <MyAssistantMessage />;
|
|
182
|
-
}}
|
|
183
|
-
</MessagePartPrimitive.Messages>
|
|
184
|
-
</div>
|
|
185
|
-
);
|
|
186
|
-
if (part.type === "tool-call") return <MyToolFallback {...part} />;
|
|
187
|
-
return null;
|
|
188
|
-
}}
|
|
189
|
-
</MessagePrimitive.Parts>
|
|
190
|
-
);
|
|
191
|
-
}}
|
|
192
|
-
</MessagePartPrimitive.Messages>
|
|
193
|
-
</div>
|
|
194
|
-
),
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## ReadonlyThreadProvider
|
|
200
|
-
|
|
201
|
-
For advanced use cases where you have a `ThreadMessage[]` array and want to render it as a thread outside of a tool call context, use `ReadonlyThreadProvider` directly:
|
|
202
|
-
|
|
203
|
-
```tsx
|
|
204
|
-
import {
|
|
205
|
-
ReadonlyThreadProvider,
|
|
206
|
-
ThreadPrimitive,
|
|
207
|
-
type ThreadMessage,
|
|
208
|
-
} from "@assistant-ui/react";
|
|
209
|
-
|
|
210
|
-
function SubConversation({
|
|
211
|
-
messages,
|
|
212
|
-
}: {
|
|
213
|
-
messages: readonly ThreadMessage[];
|
|
214
|
-
}) {
|
|
215
|
-
return (
|
|
216
|
-
<ReadonlyThreadProvider messages={messages}>
|
|
217
|
-
<ThreadPrimitive.Messages>
|
|
218
|
-
{({ message }) => {
|
|
219
|
-
if (message.role === "user") return <MyUserMessage />;
|
|
220
|
-
return <MyAssistantMessage />;
|
|
221
|
-
}}
|
|
222
|
-
</ThreadPrimitive.Messages>
|
|
223
|
-
</ReadonlyThreadProvider>
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
`ReadonlyThreadProvider` inherits the parent's tool UI registrations and model context through scope inheritance.
|
|
229
|
-
|
|
230
|
-
## Related
|
|
231
|
-
|
|
232
|
-
- [Generative UI](/docs/tools/tool-ui) — Creating tool call UIs
|
|
233
|
-
- [react-o11y](/docs/utilities/react-o11y) — Visualize sub-agent execution as collapsible span trees, waterfalls, and call timelines
|
|
234
|
-
- [MessagePartPrimitive](/docs/api-reference/primitives/message-part) — API reference for message part primitives
|
|
235
|
-
- [Sub-Agent Model Tracking](/docs/cloud/ai-sdk#sub-agent-model-tracking) — Track delegated model usage and costs in the Cloud dashboard
|
|
236
|
-
- [LangGraph Streaming](/docs/runtimes/langgraph/streaming) — Event handlers, subgraph events, and message metadata
|
|
237
|
-
- [LangGraph Generative UI](/docs/runtimes/langgraph/generative-ui) — Structured UI components emitted by your graph
|