@assistant-ui/mcp-docs-server 0.1.15 → 0.1.17

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 (55) hide show
  1. package/.docs/organized/code-examples/store-example.md +249 -147
  2. package/.docs/organized/code-examples/with-ag-ui.md +250 -186
  3. package/.docs/organized/code-examples/with-ai-sdk-v5.md +250 -199
  4. package/.docs/organized/code-examples/with-assistant-transport.md +195 -243
  5. package/.docs/organized/code-examples/with-cloud.md +277 -226
  6. package/.docs/organized/code-examples/with-custom-thread-list.md +1855 -0
  7. package/.docs/organized/code-examples/with-external-store.md +246 -180
  8. package/.docs/organized/code-examples/with-ffmpeg.md +255 -189
  9. package/.docs/organized/code-examples/with-langgraph.md +293 -242
  10. package/.docs/organized/code-examples/with-parent-id-grouping.md +243 -263
  11. package/.docs/organized/code-examples/with-react-hook-form.md +262 -196
  12. package/.docs/organized/code-examples/with-tanstack.md +1578 -0
  13. package/.docs/raw/blog/2024-07-29-hello/index.mdx +2 -2
  14. package/.docs/raw/docs/api-reference/overview.mdx +6 -6
  15. package/.docs/raw/docs/api-reference/primitives/ActionBar.mdx +85 -4
  16. package/.docs/raw/docs/api-reference/primitives/AssistantIf.mdx +200 -0
  17. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +0 -20
  18. package/.docs/raw/docs/api-reference/primitives/Message.mdx +0 -45
  19. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +0 -50
  20. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +2 -3
  21. package/.docs/raw/docs/cloud/persistence/langgraph.mdx +2 -3
  22. package/.docs/raw/docs/devtools.mdx +2 -3
  23. package/.docs/raw/docs/getting-started.mdx +36 -1102
  24. package/.docs/raw/docs/guides/Attachments.mdx +3 -25
  25. package/.docs/raw/docs/guides/Branching.mdx +1 -1
  26. package/.docs/raw/docs/guides/Speech.mdx +1 -1
  27. package/.docs/raw/docs/guides/ToolUI.mdx +1 -1
  28. package/.docs/raw/docs/legacy/styled/AssistantModal.mdx +2 -3
  29. package/.docs/raw/docs/legacy/styled/Decomposition.mdx +6 -5
  30. package/.docs/raw/docs/legacy/styled/Markdown.mdx +2 -3
  31. package/.docs/raw/docs/legacy/styled/Thread.mdx +2 -3
  32. package/.docs/raw/docs/react-compatibility.mdx +2 -5
  33. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +3 -4
  34. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +3 -6
  35. package/.docs/raw/docs/runtimes/custom/external-store.mdx +2 -3
  36. package/.docs/raw/docs/runtimes/custom/local.mdx +11 -41
  37. package/.docs/raw/docs/runtimes/data-stream.mdx +15 -11
  38. package/.docs/raw/docs/runtimes/langgraph/index.mdx +3 -3
  39. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +1 -1
  40. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +2 -3
  41. package/.docs/raw/docs/runtimes/langserve.mdx +2 -3
  42. package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +2 -3
  43. package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +2 -3
  44. package/.docs/raw/docs/ui/AssistantModal.mdx +3 -25
  45. package/.docs/raw/docs/ui/AssistantSidebar.mdx +2 -24
  46. package/.docs/raw/docs/ui/Attachment.mdx +3 -25
  47. package/.docs/raw/docs/ui/Markdown.mdx +2 -24
  48. package/.docs/raw/docs/ui/Mermaid.mdx +2 -24
  49. package/.docs/raw/docs/ui/Reasoning.mdx +2 -24
  50. package/.docs/raw/docs/ui/Scrollbar.mdx +4 -6
  51. package/.docs/raw/docs/ui/SyntaxHighlighting.mdx +3 -47
  52. package/.docs/raw/docs/ui/Thread.mdx +38 -53
  53. package/.docs/raw/docs/ui/ThreadList.mdx +4 -47
  54. package/.docs/raw/docs/ui/ToolFallback.mdx +2 -24
  55. package/package.json +6 -7
@@ -2,10 +2,10 @@
2
2
  title: Attachments
3
3
  ---
4
4
 
5
- import { AttachmentSample } from "../../../components/samples/attachment-sample";
5
+ import { AttachmentSample } from "@/components/samples/attachment-sample";
6
6
  import { Steps, Step } from "fumadocs-ui/components/steps";
7
7
  import { Callout } from "fumadocs-ui/components/callout";
8
- import { Tab, Tabs } from "fumadocs-ui/components/tabs";
8
+ import { InstallCommand } from "@/components/docs/install-command";
9
9
 
10
10
  Enable users to attach files to their messages, enhancing conversations with images, documents, and other content.
11
11
 
@@ -28,29 +28,7 @@ The attachment system in assistant-ui provides a flexible framework for handling
28
28
 
29
29
  First, add the attachment UI components to your project:
30
30
 
31
- <Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
32
- <Tab>
33
-
34
- ```sh
35
- npx assistant-ui@latest add attachment
36
- ```
37
-
38
- </Tab>
39
- <Tab>
40
-
41
- ```sh
42
- npx shadcn@latest add @assistant-ui/attachment
43
- ```
44
-
45
- </Tab>
46
- <Tab>
47
-
48
- ```sh
49
- npx shadcn@latest add "https://r.assistant-ui.com/attachment"
50
- ```
51
-
52
- </Tab>
53
- </Tabs>
31
+ <InstallCommand shadcn={["attachment"]} />
54
32
 
55
33
  This adds `/components/assistant-ui/attachment.tsx` to your project.
56
34
 
@@ -2,7 +2,7 @@
2
2
  title: Message Branching
3
3
  ---
4
4
 
5
- import { BranchingSample } from "../../../components/samples/branching-sample";
5
+ import { BranchingSample } from "@/components/samples/branching-sample";
6
6
 
7
7
  Switch between different conversation branches.
8
8
 
@@ -2,7 +2,7 @@
2
2
  title: Speech
3
3
  ---
4
4
 
5
- import { SpeechSample } from "../../../components/samples/speech-sample";
5
+ import { SpeechSample } from "@/components/samples/speech-sample";
6
6
 
7
7
  ## Text-to-Speech
8
8
 
@@ -2,7 +2,7 @@
2
2
  title: Generative UI
3
3
  ---
4
4
 
5
- import { ToolUISample } from "../../../components/samples/tool-ui-sample";
5
+ import { ToolUISample } from "@/components/samples/tool-ui-sample";
6
6
  import { Steps, Step } from "fumadocs-ui/components/steps";
7
7
  import { Callout } from "fumadocs-ui/components/callout";
8
8
 
@@ -4,6 +4,7 @@ title: AssistantModal
4
4
 
5
5
  import { Steps, Step } from "fumadocs-ui/components/steps";
6
6
  import { Tabs, Tab } from "fumadocs-ui/components/tabs";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  ## Overview
9
10
 
@@ -16,9 +17,7 @@ A chat bubble shown in the bottom right corner of the screen. Useful for support
16
17
 
17
18
  ### Install `@assistant-ui/react-ui`
18
19
 
19
- ```sh npm2yarn
20
- npm install @assistant-ui/react-ui
21
- ```
20
+ <InstallCommand npm={["@assistant-ui/react-ui"]} />
22
21
 
23
22
  </Step>
24
23
  <Step>
@@ -174,17 +174,18 @@ The text input field for the user to type a new message.
174
174
  The button to send or cancel the message.
175
175
 
176
176
  ```tsx
177
- import { Composer, ThreadPrimitive } from "@assistant-ui/react-ui";
177
+ import { Composer } from "@assistant-ui/react-ui";
178
+ import { AssistantIf } from "@assistant-ui/react";
178
179
 
179
180
  const MyComposerAction: FC = () => {
180
181
  return (
181
182
  <>
182
- <ThreadPrimitive.If running={false}>
183
+ <AssistantIf condition={({ thread }) => !thread.isRunning}>
183
184
  <Composer.Send />
184
- </ThreadPrimitive.If>
185
- <ThreadPrimitive.If running>
185
+ </AssistantIf>
186
+ <AssistantIf condition={({ thread }) => thread.isRunning}>
186
187
  <Composer.Cancel />
187
- </ThreadPrimitive.If>
188
+ </AssistantIf>
188
189
  </>
189
190
  );
190
191
  };
@@ -7,6 +7,7 @@ Allow the assistant to display rich text using markdown.
7
7
  import { Step, Steps } from "fumadocs-ui/components/steps";
8
8
  import { Callout } from "fumadocs-ui/components/callout";
9
9
  import { Tabs } from "fumadocs-ui/components/tabs";
10
+ import { InstallCommand } from "@/components/docs/install-command";
10
11
 
11
12
  ## Enabling markdown support
12
13
 
@@ -15,9 +16,7 @@ import { Tabs } from "fumadocs-ui/components/tabs";
15
16
  <Step>
16
17
  ### Install `@assistant-ui/react-markdown`
17
18
 
18
- ```sh npm2yarn
19
- npm install @assistant-ui/react-markdown
20
- ```
19
+ <InstallCommand npm={["@assistant-ui/react-markdown"]} />
21
20
 
22
21
  </Step>
23
22
  <Step>
@@ -4,6 +4,7 @@ title: Thread
4
4
 
5
5
  import { Steps, Step } from "fumadocs-ui/components/steps";
6
6
  import { Tabs, Tab } from "fumadocs-ui/components/tabs";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  ## Overview
9
10
 
@@ -16,9 +17,7 @@ The raw message list and message composer UI. Useful for full screen chat use ca
16
17
 
17
18
  ### Install `@assistant-ui/react-ui`
18
19
 
19
- ```sh npm2yarn
20
- npm install @assistant-ui/react-ui
21
- ```
20
+ <InstallCommand npm={["@assistant-ui/react-ui"]} />
22
21
 
23
22
  </Step>
24
23
  <Step>
@@ -4,6 +4,7 @@ description: Guide for using assistant-ui with older React versions (18, 17, 16)
4
4
  ---
5
5
 
6
6
  import { Callout } from "fumadocs-ui/components/callout";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  <Callout type="warning" title="Older React Versions">
9
10
  Older React versions are not continuously tested. If you encounter any issues
@@ -78,11 +79,7 @@ Since the assistant-ui uses zustand internally, which depends on `useSyncExterna
78
79
 
79
80
  1. Install the required packages:
80
81
 
81
- ```bash
82
- npm install use-sync-external-store patch-package
83
- # or
84
- yarn add use-sync-external-store patch-package
85
- ```
82
+ <InstallCommand npm={["use-sync-external-store", "patch-package"]} />
86
83
 
87
84
  2. Add a postinstall script to your package.json:
88
85
 
@@ -3,10 +3,11 @@ title: AI SDK v5
3
3
  ---
4
4
 
5
5
  import { Callout } from "fumadocs-ui/components/callout";
6
+ import { InstallCommand } from "@/components/docs/install-command";
6
7
 
7
8
  ## Overview
8
9
 
9
- Integration with the Vercel AI SDK v5 using the new `useChatRuntime` hook from `@assistant-ui/react-ai-sdk`.
10
+ Integration with the Vercel AI SDK v5 using the new `useChatRuntime` hook from `@assistant-ui/react-ai-sdk`.
10
11
  This provides a streamlined way to integrate AI SDK v5 features including the new streamText API and improved TypeScript support.
11
12
 
12
13
  ## Getting Started
@@ -27,9 +28,7 @@ cd my-app
27
28
 
28
29
  ### Install AI SDK v5 and `@assistant-ui/react`
29
30
 
30
- ```sh npm2yarn
31
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/openai
32
- ```
31
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk", "ai", "@ai-sdk/openai"]} />
33
32
 
34
33
  </Step>
35
34
  <Step>
@@ -3,6 +3,7 @@ title: AI SDK v4 (Legacy)
3
3
  ---
4
4
 
5
5
  import { Callout } from "fumadocs-ui/components/callout";
6
+ import { InstallCommand } from "@/components/docs/install-command";
6
7
 
7
8
  ## Overview
8
9
 
@@ -27,9 +28,7 @@ import { Steps, Step } from "fumadocs-ui/components/steps";
27
28
 
28
29
  Install `@assistant-ui/react-data-stream` alongside assistant-ui and AI SDK v4:
29
30
 
30
- ```sh npm2yarn
31
- npm install @assistant-ui/react @assistant-ui/react-data-stream ai@^4
32
- ```
31
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-data-stream", "ai@^4"]} />
33
32
 
34
33
  </Step>
35
34
  <Step>
@@ -92,9 +91,7 @@ export default function Home() {
92
91
 
93
92
  Alternatively, you can use the older version of the AI SDK integration package, though this version is no longer actively maintained:
94
93
 
95
- ```sh npm2yarn
96
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk@0.1.10 ai@^4
97
- ```
94
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk@0.1.10", "ai@^4"]} />
98
95
 
99
96
  <Callout type="warning">
100
97
  Version 0.1.10 of `@assistant-ui/react-ai-sdk` is no longer actively
@@ -6,6 +6,7 @@ import { Callout } from "fumadocs-ui/components/callout";
6
6
  import { Steps, Step } from "fumadocs-ui/components/steps";
7
7
  import { Card, Cards } from "fumadocs-ui/components/card";
8
8
  import { ParametersTable } from "@/components/docs";
9
+ import { InstallCommand } from "@/components/docs/install-command";
9
10
 
10
11
  ## Overview
11
12
 
@@ -152,9 +153,7 @@ graph TD
152
153
  <Step>
153
154
  ### Install Dependencies
154
155
 
155
- ```sh npm2yarn
156
- npm install @assistant-ui/react
157
- ```
156
+ <InstallCommand npm={["@assistant-ui/react"]} />
158
157
 
159
158
  </Step>
160
159
 
@@ -6,6 +6,7 @@ import { Callout } from "fumadocs-ui/components/callout";
6
6
  import { Steps, Step } from "fumadocs-ui/components/steps";
7
7
  import { Card, Cards } from "fumadocs-ui/components/card";
8
8
  import { ParametersTable } from "@/components/docs";
9
+ import { InstallCommand } from "@/components/docs/install-command";
9
10
 
10
11
  ## Overview
11
12
 
@@ -68,8 +69,15 @@ Use `LocalRuntime` if you need:
68
69
 
69
70
  ### Install `@assistant-ui/react`
70
71
 
72
+ <InstallCommand npm={["@assistant-ui/react"]} />
73
+
74
+ </Step>
75
+ <Step>
76
+
77
+ ### Add `assistant-ui` Thread component
78
+
71
79
  ```sh npm2yarn
72
- npm install @assistant-ui/react
80
+ npx assistant-ui@latest add thread
73
81
  ```
74
82
 
75
83
  </Step>
@@ -406,12 +414,11 @@ For custom thread storage, use `useRemoteThreadListRuntime` with your own adapte
406
414
 
407
415
  ```tsx
408
416
  import {
409
- useLocalThreadRuntime,
410
417
  unstable_useRemoteThreadListRuntime as useRemoteThreadListRuntime,
411
418
  useThreadListItem,
412
419
  RuntimeAdapterProvider,
413
420
  AssistantRuntimeProvider,
414
- type RemoteThreadListAdapter,
421
+ type unstable_RemoteThreadListAdapter as RemoteThreadListAdapter,
415
422
  type ThreadHistoryAdapter,
416
423
  } from "@assistant-ui/react";
417
424
  import { createAssistantStream } from "assistant-stream";
@@ -472,7 +479,7 @@ const myDatabaseAdapter: RemoteThreadListAdapter = {
472
479
  export function MyRuntimeProvider({ children }) {
473
480
  const runtime = useRemoteThreadListRuntime({
474
481
  runtimeHook: () => {
475
- return useLocalThreadRuntime(MyModelAdapter);
482
+ return useLocalRuntime(MyModelAdapter);
476
483
  },
477
484
  adapter: {
478
485
  ...myDatabaseAdapter,
@@ -827,43 +834,6 @@ function MyComponent() {
827
834
  }
828
835
  ```
829
836
 
830
- ### Custom Runtime Implementation
831
-
832
- `useLocalThreadRuntime` provides the core single-thread runtime for building custom implementations:
833
-
834
- ```tsx
835
- import {
836
- useLocalThreadRuntime,
837
- unstable_useRemoteThreadListRuntime as useRemoteThreadListRuntime,
838
- AssistantRuntimeProvider,
839
- } from "@assistant-ui/react";
840
-
841
- // Build your own multi-thread runtime
842
- function MyCustomRuntimeProvider({ children }) {
843
- const runtime = useRemoteThreadListRuntime({
844
- runtimeHook: () => useLocalThreadRuntime(MyModelAdapter, options),
845
- adapter: myCustomThreadListAdapter,
846
- });
847
-
848
- return (
849
- <AssistantRuntimeProvider runtime={runtime}>
850
- {children}
851
- </AssistantRuntimeProvider>
852
- );
853
- }
854
- ```
855
-
856
- <Callout type="info">
857
- `useLocalRuntime` internally uses `useLocalThreadRuntime` +
858
- `useRemoteThreadListRuntime` for multi-thread support.
859
- </Callout>
860
-
861
- <Callout type="warning">
862
- **`useThreadRuntime` vs `useLocalThreadRuntime`:** - `useThreadRuntime` -
863
- Access the current thread's runtime from within components -
864
- `useLocalThreadRuntime` - Create a new single-thread runtime instance
865
- </Callout>
866
-
867
837
  ## Integration Examples
868
838
 
869
839
  ### OpenAI Integration
@@ -4,6 +4,7 @@ title: Data Stream Protocol
4
4
 
5
5
  import { Step, Steps } from "fumadocs-ui/components/steps";
6
6
  import { Callout } from "fumadocs-ui/components/callout";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  The `@assistant-ui/react-data-stream` package provides integration with data stream protocol endpoints, enabling streaming AI responses with tool support and state management.
9
10
 
@@ -19,9 +20,7 @@ The data stream protocol is a standardized format for streaming AI responses tha
19
20
 
20
21
  ## Installation
21
22
 
22
- ```bash npm2yarn
23
- npm install @assistant-ui/react-data-stream
24
- ```
23
+ <InstallCommand npm={["@assistant-ui/react-data-stream"]} />
25
24
 
26
25
  ## Basic Usage
27
26
 
@@ -61,19 +60,24 @@ export default function ChatPage() {
61
60
  Your backend endpoint should accept POST requests and return data stream responses:
62
61
 
63
62
  ```typescript title="app/api/chat/route.ts"
64
- import { DataStreamResponse } from "assistant-stream";
63
+ import { createAssistantStreamResponse } from "assistant-stream";
65
64
 
66
65
  export async function POST(request: Request) {
67
66
  const { messages, tools, system } = await request.json();
68
67
 
69
- // Process the request with your AI provider
70
- const stream = await processWithAI({
71
- messages,
72
- tools,
73
- system,
68
+ return createAssistantStreamResponse(async (controller) => {
69
+ // Process the request with your AI provider
70
+ const stream = await processWithAI({
71
+ messages,
72
+ tools,
73
+ system,
74
+ });
75
+
76
+ // Stream the response
77
+ for await (const chunk of stream) {
78
+ controller.appendText(chunk.text);
79
+ }
74
80
  });
75
-
76
- return new DataStreamResponse(stream);
77
81
  }
78
82
  ```
79
83
 
@@ -36,6 +36,8 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
36
36
  </Step>
37
37
  </Steps>
38
38
 
39
+ import { InstallCommand } from "@/components/docs/install-command";
40
+
39
41
  ## Installation in existing React project
40
42
 
41
43
  <Steps>
@@ -43,9 +45,7 @@ NEXT_PUBLIC_LANGGRAPH_ASSISTANT_ID=your_graph_id
43
45
 
44
46
  ### Install dependencies
45
47
 
46
- ```sh npm2yarn
47
- npm install @assistant-ui/react @assistant-ui/react-ui @assistant-ui/react-langgraph @langchain/langgraph-sdk
48
- ```
48
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-langgraph", "@langchain/langgraph-sdk"]} />
49
49
 
50
50
  </Step>
51
51
  <Step>
@@ -276,7 +276,7 @@ Then create a new file under `/components/tools/ToolFallback.tsx` to define the
276
276
  import { ToolCallMessagePartComponent } from "@assistant-ui/react";
277
277
  import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
278
278
  import { useState } from "react";
279
- import { Button } from "../ui/button";
279
+ import { Button } from "@/components/ui/button";
280
280
 
281
281
  export const ToolFallback: ToolCallMessagePartComponent = ({
282
282
  toolName,
@@ -5,6 +5,7 @@ title: "Part 3: Approval UI"
5
5
  ## Background: LangGraph implementation details
6
6
 
7
7
  import Image from "next/image";
8
+ import { InstallCommand } from "@/components/docs/install-command";
8
9
  import approval from "./images/stockbroker-langgraph.png";
9
10
 
10
11
  <Image
@@ -127,9 +128,7 @@ Finally, we add a `TransactionConfirmationPending` component to ask for approval
127
128
 
128
129
  This requires shadcn/ui's `Card` and `Button` components. We will install them as a dependency.
129
130
 
130
- ```sh
131
- npx shadcn@latest add card button
132
- ```
131
+ <InstallCommand shadcn={["card", "button"]} />
133
132
 
134
133
  Then create a new file under `/components/tools/purchase-stock/transaction-confirmation-pending.tsx` to define the approval UI.
135
134
 
@@ -13,6 +13,7 @@ Integration with a LangServe server via Vercel AI SDK.
13
13
  ## Getting Started
14
14
 
15
15
  import { Steps, Step } from "fumadocs-ui/components/steps";
16
+ import { InstallCommand } from "@/components/docs/install-command";
16
17
 
17
18
  <Steps>
18
19
  <Step>
@@ -28,9 +29,7 @@ cd my-app
28
29
 
29
30
  ### Install `@langchain/core`, AI SDK and `@assistant-ui/react`
30
31
 
31
- ```sh npm2yarn
32
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/react @langchain/core
33
- ```
32
+ <InstallCommand npm={["@assistant-ui/react", "@assistant-ui/react-ai-sdk", "ai", "@ai-sdk/react", "@langchain/core"]} />
34
33
 
35
34
  </Step>
36
35
  <Step>
@@ -4,6 +4,7 @@ title: Full-Stack Integration
4
4
 
5
5
  import { Step, Steps } from "fumadocs-ui/components/steps";
6
6
  import { Callout } from "fumadocs-ui/components/callout";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  Integrate Mastra directly into your Next.js application's API routes. This approach keeps your backend and frontend code within the same project.
9
10
 
@@ -65,9 +66,7 @@ This default route uses the Vercel AI SDK directly with OpenAI. In the following
65
66
 
66
67
  Add the `@mastra/core` package and its peer dependency `zod` (which you can use later inside tools for example). Also add `@mastra/ai-sdk` to convert Mastra's stream to an AI SDK-compatible format:
67
68
 
68
- ```bash npm2yarn
69
- npm install @mastra/core@latest @mastra/ai-sdk@latest zod@latest
70
- ```
69
+ <InstallCommand npm={["@mastra/core@latest", "@mastra/ai-sdk@latest", "zod@latest"]} />
71
70
 
72
71
  </Step>
73
72
  <Step>
@@ -4,6 +4,7 @@ title: Separate Server Integration
4
4
 
5
5
  import { Step, Steps } from "fumadocs-ui/components/steps";
6
6
  import { Callout } from "fumadocs-ui/components/callout";
7
+ import { InstallCommand } from "@/components/docs/install-command";
7
8
 
8
9
  Run Mastra as a standalone server and connect your Next.js frontend (using assistant-ui) to its API endpoints. This approach separates your AI backend from your frontend application, allowing for independent development and scaling.
9
10
 
@@ -31,9 +32,7 @@ cd your-mastra-server-directory # Replace with the actual directory name
31
32
 
32
33
  In the next steps you'll need to use the `@mastra/ai-sdk` package. Add it to your Mastra project:
33
34
 
34
- ```bash
35
- npm install @mastra/ai-sdk@latest
36
- ```
35
+ <InstallCommand npm={["@mastra/ai-sdk@latest"]} />
37
36
 
38
37
  You now have a basic Mastra server project ready.
39
38
 
@@ -3,8 +3,8 @@ title: AssistantModal
3
3
  ---
4
4
 
5
5
  import { Steps, Step } from "fumadocs-ui/components/steps";
6
- import { Tab, Tabs } from "fumadocs-ui/components/tabs";
7
- import { AssistantModalSample } from "../../../components/samples/assistant-modal-sample";
6
+ import { InstallCommand } from "@/components/docs/install-command";
7
+ import { AssistantModalSample } from "@/components/samples/assistant-modal-sample";
8
8
 
9
9
  ## Overview
10
10
 
@@ -20,29 +20,7 @@ A chat bubble shown in the bottom right corner of the screen. Useful for support
20
20
 
21
21
  ### Add `assistant-modal`
22
22
 
23
- <Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
24
- <Tab>
25
-
26
- ```sh
27
- npx assistant-ui@latest add assistant-modal
28
- ```
29
-
30
- </Tab>
31
- <Tab>
32
-
33
- ```sh
34
- npx shadcn@latest add @assistant-ui/assistant-modal
35
- ```
36
-
37
- </Tab>
38
- <Tab>
39
-
40
- ```sh
41
- npx shadcn@latest add "https://r.assistant-ui.com/assistant-modal"
42
- ```
43
-
44
- </Tab>
45
- </Tabs>
23
+ <InstallCommand shadcn={["assistant-modal"]} />
46
24
 
47
25
  This adds `/components/assistant-ui/assistant-modal.tsx` to your project, which you can adjust as needed.
48
26
 
@@ -3,7 +3,7 @@ title: AssistantSidebar
3
3
  ---
4
4
 
5
5
  import { Steps, Step } from "fumadocs-ui/components/steps";
6
- import { Tab, Tabs } from "fumadocs-ui/components/tabs";
6
+ import { InstallCommand } from "@/components/docs/install-command";
7
7
 
8
8
  ## Overview
9
9
 
@@ -16,29 +16,7 @@ A chat sidebar show on the right side of the screen. Useful for co-pilot use cas
16
16
 
17
17
  ### Add `assistant-sidebar`
18
18
 
19
- <Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
20
- <Tab>
21
-
22
- ```sh
23
- npx assistant-ui@latest add assistant-sidebar
24
- ```
25
-
26
- </Tab>
27
- <Tab>
28
-
29
- ```sh
30
- npx shadcn@latest add @assistant-ui/assistant-sidebar
31
- ```
32
-
33
- </Tab>
34
- <Tab>
35
-
36
- ```sh
37
- npx shadcn@latest add "https://r.assistant-ui.com/assistant-sidebar"
38
- ```
39
-
40
- </Tab>
41
- </Tabs>
19
+ <InstallCommand shadcn={["assistant-sidebar"]} />
42
20
 
43
21
  This adds `/components/assistant-ui/assistant-sidebar.tsx` to your project, which you can adjust as needed.
44
22
 
@@ -3,9 +3,9 @@ title: Attachment
3
3
  ---
4
4
 
5
5
  import { Steps, Step } from "fumadocs-ui/components/steps";
6
- import { AttachmentSample } from "../../../components/samples/attachment-sample";
6
+ import { AttachmentSample } from "@/components/samples/attachment-sample";
7
7
  import { Callout } from "fumadocs-ui/components/callout";
8
- import { Tab, Tabs } from "fumadocs-ui/components/tabs";
8
+ import { InstallCommand } from "@/components/docs/install-command";
9
9
 
10
10
  ## Overview
11
11
 
@@ -27,29 +27,7 @@ The Attachment components let the user attach files and view the attachments.
27
27
 
28
28
  ### Add `attachment`
29
29
 
30
- <Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
31
- <Tab>
32
-
33
- ```sh
34
- npx assistant-ui@latest add attachment
35
- ```
36
-
37
- </Tab>
38
- <Tab>
39
-
40
- ```sh
41
- npx shadcn@latest add @assistant-ui/attachment
42
- ```
43
-
44
- </Tab>
45
- <Tab>
46
-
47
- ```sh
48
- npx shadcn@latest add "https://r.assistant-ui.com/attachment"
49
- ```
50
-
51
- </Tab>
52
- </Tabs>
30
+ <InstallCommand shadcn={["attachment"]} />
53
31
 
54
32
  This adds a `/components/assistant-ui/attachment.tsx` file to your project, which you can adjust as needed.
55
33
 
@@ -6,7 +6,7 @@ Allow the assistant to display rich text using markdown.
6
6
 
7
7
  import { Step, Steps } from "fumadocs-ui/components/steps";
8
8
  import { Callout } from "fumadocs-ui/components/callout";
9
- import { Tab, Tabs } from "fumadocs-ui/components/tabs";
9
+ import { InstallCommand } from "@/components/docs/install-command";
10
10
 
11
11
  <Callout>
12
12
  Markdown support is already included by default in the `Thread` component.
@@ -19,29 +19,7 @@ import { Tab, Tabs } from "fumadocs-ui/components/tabs";
19
19
  <Step>
20
20
  ### Add `markdown-text`
21
21
 
22
- <Tabs items={["assistant-ui", "shadcn (namespace)", "shadcn"]}>
23
- <Tab>
24
-
25
- ```sh
26
- npx assistant-ui@latest add markdown-text
27
- ```
28
-
29
- </Tab>
30
- <Tab>
31
-
32
- ```sh
33
- npx shadcn@latest add @assistant-ui/markdown-text
34
- ```
35
-
36
- </Tab>
37
- <Tab>
38
-
39
- ```sh
40
- npx shadcn@latest add "https://r.assistant-ui.com/markdown-text"
41
- ```
42
-
43
- </Tab>
44
- </Tabs>
22
+ <InstallCommand shadcn={["markdown-text"]} />
45
23
 
46
24
  This adds a `/components/assistant-ui/markdown-text.tsx` file to your project, which you can adjust as needed.
47
25