@assistant-ui/mcp-docs-server 0.1.8 → 0.1.10
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/.docs/organized/code-examples/with-ai-sdk-v5.md +24 -17
- package/.docs/organized/code-examples/with-assistant-transport.md +1599 -0
- package/.docs/organized/code-examples/with-cloud.md +11 -11
- package/.docs/organized/code-examples/with-external-store.md +9 -9
- package/.docs/organized/code-examples/with-ffmpeg.md +17 -16
- package/.docs/organized/code-examples/with-langgraph.md +33 -110
- package/.docs/organized/code-examples/with-parent-id-grouping.md +9 -9
- package/.docs/organized/code-examples/with-react-hook-form.md +17 -16
- package/.docs/raw/docs/api-reference/primitives/Thread.mdx +40 -8
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +42 -66
- package/.docs/raw/docs/copilots/assistant-frame.mdx +18 -16
- package/.docs/raw/docs/devtools.mdx +51 -0
- package/.docs/raw/docs/getting-started.mdx +2 -4
- package/.docs/raw/docs/guides/ToolUI.mdx +112 -37
- package/.docs/raw/docs/guides/Tools.mdx +170 -6
- package/.docs/raw/docs/migrations/react-langgraph-v0-7.mdx +324 -0
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
- package/.docs/raw/docs/runtimes/custom/local.mdx +1 -1
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +55 -20
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +6 -5
- package/.docs/raw/docs/runtimes/mastra/overview.mdx +3 -3
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +13 -13
- package/.docs/raw/docs/ui/Thread.mdx +368 -5
- package/package.json +8 -8
- package/.docs/raw/docs/migrations/v0-7.mdx +0 -188
- package/.docs/raw/docs/migrations/v0-8.mdx +0 -160
- package/.docs/raw/docs/migrations/v0-9.mdx +0 -75
- package/.docs/raw/docs/ui/primitives/Thread.mdx +0 -197
|
@@ -10,9 +10,9 @@ Integrate Mastra directly into your Next.js application's API routes. This appro
|
|
|
10
10
|
<Steps>
|
|
11
11
|
<Step>
|
|
12
12
|
|
|
13
|
-
### Initialize
|
|
13
|
+
### Initialize assistant-ui
|
|
14
14
|
|
|
15
|
-
Start by setting up
|
|
15
|
+
Start by setting up assistant-ui in your project. Run one of the following commands:
|
|
16
16
|
|
|
17
17
|
```sh title="New Project"
|
|
18
18
|
npx assistant-ui@latest create
|
|
@@ -190,10 +190,11 @@ export async function POST(req: Request) {
|
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
Key changes:
|
|
193
|
+
|
|
193
194
|
- We import the `mastra` instance created in `mastra/index.ts`. Make sure the import path (`@/mastra`) is correct for your project setup (you might need `~/mastra`, `../../../mastra`, etc., depending on your path aliases and project structure).
|
|
194
195
|
- We retrieve the `chefAgent` using `mastra.getAgent("chefAgent")`.
|
|
195
196
|
- Instead of calling the AI SDK's `streamText` directly, we call `agent.stream(messages)` to process the chat messages using the agent's configuration and model.
|
|
196
|
-
- The result is still returned in a format compatible with
|
|
197
|
+
- The result is still returned in a format compatible with assistant-ui using `toDataStreamResponse()`.
|
|
197
198
|
|
|
198
199
|
Your API route is now powered by Mastra!
|
|
199
200
|
|
|
@@ -208,11 +209,11 @@ You're all set! Start your Next.js development server:
|
|
|
208
209
|
npm run dev
|
|
209
210
|
```
|
|
210
211
|
|
|
211
|
-
Open your browser to `http://localhost:3000` (or the port specified in your terminal). You should now be able to interact with your `chefAgent` through the
|
|
212
|
+
Open your browser to `http://localhost:3000` (or the port specified in your terminal). You should now be able to interact with your `chefAgent` through the assistant-ui chat interface. Ask it for cooking advice based on ingredients you have!
|
|
212
213
|
|
|
213
214
|
</Step>
|
|
214
215
|
</Steps>
|
|
215
216
|
|
|
216
|
-
Congratulations! You have successfully integrated Mastra into your Next.js application using the full-stack approach. Your
|
|
217
|
+
Congratulations! You have successfully integrated Mastra into your Next.js application using the full-stack approach. Your assistant-ui frontend now communicates with a Mastra agent running in your Next.js backend API route.
|
|
217
218
|
|
|
218
219
|
To explore more advanced Mastra features like memory, tools, workflows, and more, please refer to the [official Mastra documentation](https://mastra.ai/docs).
|
|
@@ -4,9 +4,9 @@ title: Overview
|
|
|
4
4
|
|
|
5
5
|
Mastra is an open-source TypeScript agent framework designed to provide the essential primitives for building AI applications. It enables developers to create AI agents with memory and tool-calling capabilities, implement deterministic LLM workflows, and leverage RAG for knowledge integration. With features like model routing, workflow graphs, and automated evals, Mastra provides a complete toolkit for developing, testing, and deploying AI applications.
|
|
6
6
|
|
|
7
|
-
## Integrating with Next.js and
|
|
7
|
+
## Integrating with Next.js and assistant-ui
|
|
8
8
|
|
|
9
|
-
There are two primary ways to integrate Mastra into your Next.js project when using
|
|
9
|
+
There are two primary ways to integrate Mastra into your Next.js project when using assistant-ui:
|
|
10
10
|
|
|
11
11
|
1. **Full-Stack Integration**: Integrate Mastra directly into your Next.js application's API routes. This approach keeps your backend and frontend code within the same project.
|
|
12
12
|
[Learn how to set up Full-Stack Integration](./full-stack-integration)
|
|
@@ -14,4 +14,4 @@ There are two primary ways to integrate Mastra into your Next.js project when us
|
|
|
14
14
|
2. **Separate Server Integration**: Run Mastra as a standalone server and connect your Next.js frontend to its API endpoints. This approach separates concerns and allows for independent scaling.
|
|
15
15
|
[Learn how to set up Separate Server Integration](./separate-server-integration)
|
|
16
16
|
|
|
17
|
-
Choose the guide that best fits your project architecture. Both methods allow seamless integration with the
|
|
17
|
+
Choose the guide that best fits your project architecture. Both methods allow seamless integration with the assistant-ui components.
|
|
@@ -5,7 +5,7 @@ title: Separate Server Integration
|
|
|
5
5
|
import { Step, Steps } from "fumadocs-ui/components/steps";
|
|
6
6
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
7
|
|
|
8
|
-
Run Mastra as a standalone server and connect your Next.js frontend (using
|
|
8
|
+
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
9
|
|
|
10
10
|
<Steps>
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Run Mastra as a standalone server and connect your Next.js frontend (using Assis
|
|
|
13
13
|
|
|
14
14
|
### Create Mastra Server Project
|
|
15
15
|
|
|
16
|
-
First, create a dedicated project for your Mastra server. Choose a directory separate from your Next.js/
|
|
16
|
+
First, create a dedicated project for your Mastra server. Choose a directory separate from your Next.js/assistant-ui frontend project.
|
|
17
17
|
|
|
18
18
|
Navigate to your chosen parent directory in the terminal and run the Mastra create command:
|
|
19
19
|
|
|
@@ -97,15 +97,15 @@ With the agent defined and registered, start the Mastra development server:
|
|
|
97
97
|
npm run dev
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
By default, the Mastra server will run on `http://localhost:4111`. Your `chefAgent` should now be accessible via a POST request endpoint, typically `http://localhost:4111/api/agents/chefAgent/stream`. Keep this server running for the next steps where we'll set up the
|
|
100
|
+
By default, the Mastra server will run on `http://localhost:4111`. Your `chefAgent` should now be accessible via a POST request endpoint, typically `http://localhost:4111/api/agents/chefAgent/stream`. Keep this server running for the next steps where we'll set up the assistant-ui frontend to connect to it.
|
|
101
101
|
|
|
102
102
|
</Step>
|
|
103
103
|
|
|
104
104
|
<Step>
|
|
105
105
|
|
|
106
|
-
### Initialize
|
|
106
|
+
### Initialize assistant-ui Frontend
|
|
107
107
|
|
|
108
|
-
Now, set up your frontend application using
|
|
108
|
+
Now, set up your frontend application using assistant-ui. Navigate to a **different directory** from your Mastra server project. You can either create a new Next.js project or use an existing one.
|
|
109
109
|
|
|
110
110
|
Inside your frontend project directory, run one of the following commands:
|
|
111
111
|
|
|
@@ -117,10 +117,10 @@ npx assistant-ui@latest create
|
|
|
117
117
|
npx assistant-ui@latest init
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
This command installs the necessary
|
|
120
|
+
This command installs the necessary assistant-ui dependencies and sets up basic configuration files, including a default chat page and an API route (`app/api/chat/route.ts`).
|
|
121
121
|
|
|
122
122
|
<Callout title="Need Help?">
|
|
123
|
-
For detailed setup instructions for
|
|
123
|
+
For detailed setup instructions for assistant-ui, including manual setup
|
|
124
124
|
steps, please refer to the main [Getting Started
|
|
125
125
|
guide](/docs/getting-started).
|
|
126
126
|
</Callout>
|
|
@@ -133,9 +133,9 @@ In the next step, we will configure this frontend to communicate with the separa
|
|
|
133
133
|
|
|
134
134
|
### Configure Frontend API Endpoint
|
|
135
135
|
|
|
136
|
-
The default
|
|
136
|
+
The default assistant-ui setup configures the chat runtime to use a local API route (`/api/chat`) within the Next.js project. Since our Mastra agent is running on a separate server, we need to update the frontend to point to that server's endpoint.
|
|
137
137
|
|
|
138
|
-
Open the main page file in your
|
|
138
|
+
Open the main page file in your assistant-ui frontend project (usually `app/page.tsx` or `src/app/page.tsx`). Find the `useChatRuntime` hook and change the `api` property to the full URL of your Mastra agent's stream endpoint:
|
|
139
139
|
|
|
140
140
|
```tsx {10} title="app/page.tsx"
|
|
141
141
|
"use client";
|
|
@@ -163,7 +163,7 @@ export default function Home() {
|
|
|
163
163
|
|
|
164
164
|
Replace `"http://localhost:4111/api/agents/chefAgent/stream"` with the actual URL if your Mastra server runs on a different port or host, or if your agent has a different name.
|
|
165
165
|
|
|
166
|
-
Now, the
|
|
166
|
+
Now, the assistant-ui frontend will send chat requests directly to your running Mastra server.
|
|
167
167
|
|
|
168
168
|
<Callout title="Delete Default API Route">
|
|
169
169
|
Since the frontend no longer uses the local `/api/chat` route created by the
|
|
@@ -179,18 +179,18 @@ Now, the Assistant UI frontend will send chat requests directly to your running
|
|
|
179
179
|
|
|
180
180
|
You're ready to connect the pieces! Make sure your separate Mastra server is still running (from Step 4).
|
|
181
181
|
|
|
182
|
-
In your
|
|
182
|
+
In your assistant-ui frontend project directory, start the Next.js development server:
|
|
183
183
|
|
|
184
184
|
```bash npm2yarn
|
|
185
185
|
npm run dev
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
Open your browser to `http://localhost:3000` (or the port specified in your terminal for the frontend app). You should now be able to interact with your `chefAgent` through the
|
|
188
|
+
Open your browser to `http://localhost:3000` (or the port specified in your terminal for the frontend app). You should now be able to interact with your `chefAgent` through the assistant-ui chat interface. The frontend will make requests to your Mastra server running on `http://localhost:4111`.
|
|
189
189
|
|
|
190
190
|
</Step>
|
|
191
191
|
|
|
192
192
|
</Steps>
|
|
193
193
|
|
|
194
|
-
Congratulations! You have successfully integrated Mastra with
|
|
194
|
+
Congratulations! You have successfully integrated Mastra with assistant-ui using a separate server approach. Your assistant-ui frontend now communicates with a standalone Mastra agent server.
|
|
195
195
|
|
|
196
196
|
This setup provides a clear separation between your frontend and AI backend. To explore more advanced Mastra features like memory, tools, workflows, and deployment options, please refer to the [official Mastra documentation](https://mastra.ai/docs).
|
|
@@ -4,26 +4,64 @@ title: Thread
|
|
|
4
4
|
|
|
5
5
|
import { Steps, Step } from "fumadocs-ui/components/steps";
|
|
6
6
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
7
|
+
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
|
|
8
|
+
import { ParametersTable } from "@/components/docs";
|
|
7
9
|
import { ThreadSample } from "../../../components/samples/thread-sample";
|
|
8
10
|
|
|
11
|
+
A complete chat interface that combines message rendering, auto-scrolling, composer input,
|
|
12
|
+
attachments, and conditional UI states. Fully customizable and composable.
|
|
9
13
|
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
The raw message list and message composer UI.
|
|
13
14
|
|
|
14
15
|
<ThreadSample />
|
|
15
16
|
|
|
17
|
+
## Anatomy
|
|
18
|
+
|
|
19
|
+
The Thread component is built with the following primitives:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { ThreadPrimitive } from "@assistant-ui/react";
|
|
23
|
+
|
|
24
|
+
<ThreadPrimitive.Root>
|
|
25
|
+
<ThreadPrimitive.Viewport>
|
|
26
|
+
<ThreadPrimitive.Empty />
|
|
27
|
+
<ThreadPrimitive.Messages
|
|
28
|
+
components={{
|
|
29
|
+
EditComposer,
|
|
30
|
+
UserMessage,
|
|
31
|
+
AssistantMessage,
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
<ThreadPrimitive.ScrollToBottom />
|
|
35
|
+
</ThreadPrimitive.Viewport>
|
|
36
|
+
<ThreadPrimitive.Suggestion />
|
|
37
|
+
<ThreadPrimitive.If />
|
|
38
|
+
</ThreadPrimitive.Root>
|
|
39
|
+
```
|
|
40
|
+
|
|
16
41
|
## Getting Started
|
|
17
42
|
|
|
18
43
|
<Steps>
|
|
19
44
|
<Step>
|
|
20
45
|
|
|
21
|
-
### Add
|
|
46
|
+
### Add the component
|
|
47
|
+
|
|
48
|
+
<Tabs items={["assistant-ui", "shadcn"]}>
|
|
49
|
+
<Tab>
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npx assistant-ui@latest add thread
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
</Tab>
|
|
56
|
+
<Tab>
|
|
22
57
|
|
|
23
58
|
```sh
|
|
24
59
|
npx shadcn@latest add "https://r.assistant-ui.com/thread"
|
|
25
60
|
```
|
|
26
61
|
|
|
62
|
+
</Tab>
|
|
63
|
+
</Tabs>
|
|
64
|
+
|
|
27
65
|
This adds a `/components/assistant-ui/thread.tsx` file to your project, which you can adjust as needed.
|
|
28
66
|
|
|
29
67
|
</Step>
|
|
@@ -34,7 +72,7 @@ This adds a `/components/assistant-ui/thread.tsx` file to your project, which yo
|
|
|
34
72
|
```tsx title="/app/page.tsx" {1,6}
|
|
35
73
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
36
74
|
|
|
37
|
-
export default function
|
|
75
|
+
export default function Chat() {
|
|
38
76
|
return (
|
|
39
77
|
<div className="h-full">
|
|
40
78
|
<Thread />
|
|
@@ -45,3 +83,328 @@ export default function Home() {
|
|
|
45
83
|
|
|
46
84
|
</Step>
|
|
47
85
|
</Steps>
|
|
86
|
+
|
|
87
|
+
## Examples
|
|
88
|
+
|
|
89
|
+
### Welcome Screen
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
<ThreadPrimitive.If empty>
|
|
93
|
+
<ThreadWelcome />
|
|
94
|
+
</ThreadPrimitive.If>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Viewport Spacer
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<ThreadPrimitive.If empty={false}>
|
|
101
|
+
<div className="min-h-8 grow" />
|
|
102
|
+
</ThreadPrimitive.If>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Conditional Send/Cancel Button
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<ThreadPrimitive.If running={false}>
|
|
109
|
+
<ComposerPrimitive.Send>
|
|
110
|
+
Send
|
|
111
|
+
</ComposerPrimitive.Send>
|
|
112
|
+
</ThreadPrimitive.If>
|
|
113
|
+
|
|
114
|
+
<ThreadPrimitive.If running>
|
|
115
|
+
<ComposerPrimitive.Cancel>
|
|
116
|
+
Cancel
|
|
117
|
+
</ComposerPrimitive.Cancel>
|
|
118
|
+
</ThreadPrimitive.If>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Suggestions
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<ThreadPrimitive.Suggestion
|
|
125
|
+
prompt="What's the weather in San Francisco?"
|
|
126
|
+
send
|
|
127
|
+
/>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## API Reference
|
|
131
|
+
|
|
132
|
+
The following primitives are used within the Thread component and can be customized in your `/components/assistant-ui/thread.tsx` file.
|
|
133
|
+
|
|
134
|
+
### Root
|
|
135
|
+
|
|
136
|
+
Contains all parts of the thread.
|
|
137
|
+
|
|
138
|
+
<ParametersTable
|
|
139
|
+
type="ThreadPrimitiveRootProps"
|
|
140
|
+
parameters={[
|
|
141
|
+
{
|
|
142
|
+
name: "asChild",
|
|
143
|
+
type: "boolean",
|
|
144
|
+
default: "false",
|
|
145
|
+
description: "Merge props with child element instead of rendering a wrapper div.",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "className",
|
|
149
|
+
type: "string",
|
|
150
|
+
description: "CSS class name.",
|
|
151
|
+
},
|
|
152
|
+
]}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
This primitive renders a `<div>` element unless `asChild` is set.
|
|
156
|
+
|
|
157
|
+
### Viewport
|
|
158
|
+
|
|
159
|
+
The scrollable area containing all messages. Automatically scrolls to the bottom as new messages are added.
|
|
160
|
+
|
|
161
|
+
<ParametersTable
|
|
162
|
+
type="ThreadPrimitiveViewportProps"
|
|
163
|
+
parameters={[
|
|
164
|
+
{
|
|
165
|
+
name: "asChild",
|
|
166
|
+
type: "boolean",
|
|
167
|
+
default: "false",
|
|
168
|
+
description: "Merge props with child element instead of rendering a wrapper div.",
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "autoScroll",
|
|
172
|
+
type: "boolean",
|
|
173
|
+
default: "true",
|
|
174
|
+
description:
|
|
175
|
+
"Whether to automatically scroll to the bottom when new messages are added while the viewport was previously scrolled to the bottom.",
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "className",
|
|
179
|
+
type: "string",
|
|
180
|
+
description: "CSS class name.",
|
|
181
|
+
},
|
|
182
|
+
]}
|
|
183
|
+
/>
|
|
184
|
+
|
|
185
|
+
This primitive renders a `<div>` element unless `asChild` is set.
|
|
186
|
+
|
|
187
|
+
### Messages
|
|
188
|
+
|
|
189
|
+
Renders all messages in the thread. This primitive renders a separate component for each message.
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<ThreadPrimitive.Messages
|
|
193
|
+
components={{
|
|
194
|
+
UserMessage: UserMessage,
|
|
195
|
+
EditComposer: EditComposer,
|
|
196
|
+
AssistantMessage: AssistantMessage,
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
<ParametersTable
|
|
202
|
+
type="ThreadPrimitiveMessagesProps"
|
|
203
|
+
parameters={[
|
|
204
|
+
{
|
|
205
|
+
name: "components",
|
|
206
|
+
type: "MessageComponents",
|
|
207
|
+
required: true,
|
|
208
|
+
description: "Components to render for different message types.",
|
|
209
|
+
children: [
|
|
210
|
+
{
|
|
211
|
+
type: "MessageComponents",
|
|
212
|
+
parameters: [
|
|
213
|
+
{
|
|
214
|
+
name: "Message",
|
|
215
|
+
type: "ComponentType",
|
|
216
|
+
description: "Default component for all messages.",
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "UserMessage",
|
|
220
|
+
type: "ComponentType",
|
|
221
|
+
description: "Component for user messages.",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "EditComposer",
|
|
225
|
+
type: "ComponentType",
|
|
226
|
+
description:
|
|
227
|
+
"Component for user messages being edited.",
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "AssistantMessage",
|
|
231
|
+
type: "ComponentType",
|
|
232
|
+
description: "Component for assistant messages.",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
name: "SystemMessage",
|
|
236
|
+
type: "ComponentType",
|
|
237
|
+
description: "Component for system messages.",
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
]}
|
|
244
|
+
/>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### MessageByIndex
|
|
248
|
+
|
|
249
|
+
Renders a single message at the specified index.
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
<ThreadPrimitive.MessageByIndex
|
|
253
|
+
index={0}
|
|
254
|
+
components={{
|
|
255
|
+
UserMessage: UserMessage,
|
|
256
|
+
AssistantMessage: AssistantMessage
|
|
257
|
+
}}
|
|
258
|
+
/>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
<ParametersTable
|
|
262
|
+
type="ThreadPrimitiveMessageByIndexProps"
|
|
263
|
+
parameters={[
|
|
264
|
+
{
|
|
265
|
+
name: "index",
|
|
266
|
+
type: "number",
|
|
267
|
+
required: true,
|
|
268
|
+
description: "The index of the message to render.",
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
name: "components",
|
|
272
|
+
type: "MessageComponents",
|
|
273
|
+
description: "Components to render for different message types.",
|
|
274
|
+
},
|
|
275
|
+
]}
|
|
276
|
+
/>
|
|
277
|
+
|
|
278
|
+
### Empty
|
|
279
|
+
|
|
280
|
+
Renders children only when there are no messages in the thread.
|
|
281
|
+
|
|
282
|
+
<ParametersTable
|
|
283
|
+
type="ThreadPrimitiveEmptyProps"
|
|
284
|
+
parameters={[
|
|
285
|
+
{
|
|
286
|
+
name: "children",
|
|
287
|
+
type: "ReactNode",
|
|
288
|
+
description: "Content to display when the thread is empty.",
|
|
289
|
+
},
|
|
290
|
+
]}
|
|
291
|
+
/>
|
|
292
|
+
|
|
293
|
+
### ScrollToBottom
|
|
294
|
+
|
|
295
|
+
A button to scroll the viewport to the bottom. Disabled when the viewport is already at the bottom.
|
|
296
|
+
|
|
297
|
+
<ParametersTable
|
|
298
|
+
type="ThreadPrimitiveScrollToBottomProps"
|
|
299
|
+
parameters={[
|
|
300
|
+
{
|
|
301
|
+
name: "asChild",
|
|
302
|
+
type: "boolean",
|
|
303
|
+
default: "false",
|
|
304
|
+
description: "Merge props with child element instead of rendering a wrapper button.",
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: "className",
|
|
308
|
+
type: "string",
|
|
309
|
+
description: "CSS class name.",
|
|
310
|
+
},
|
|
311
|
+
]}
|
|
312
|
+
/>
|
|
313
|
+
|
|
314
|
+
This primitive renders a `<button>` element unless `asChild` is set.
|
|
315
|
+
|
|
316
|
+
### Suggestion
|
|
317
|
+
|
|
318
|
+
Shows a suggestion to the user. When clicked, replaces the composer's value with the suggestion and optionally sends it.
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
<ThreadPrimitive.Suggestion
|
|
322
|
+
prompt="Tell me about React hooks"
|
|
323
|
+
send
|
|
324
|
+
/>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
<ParametersTable
|
|
328
|
+
type="ThreadPrimitiveSuggestionProps"
|
|
329
|
+
parameters={[
|
|
330
|
+
{
|
|
331
|
+
name: "prompt",
|
|
332
|
+
type: "string",
|
|
333
|
+
required: true,
|
|
334
|
+
description: "The suggestion text to use when clicked.",
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "send",
|
|
338
|
+
type: "boolean",
|
|
339
|
+
description:
|
|
340
|
+
"When true, automatically sends the message. When false, replaces or appends the composer text with the suggestion - depending on the value of `clearComposer`",
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: "clearComposer",
|
|
344
|
+
type: "boolean",
|
|
345
|
+
default: "true",
|
|
346
|
+
description:
|
|
347
|
+
"Whether to clear the composer after sending. When send is set to false, determines if composer text is replaced with suggestion (true, default), or if the suggestion's prompt is appended to the composer text (false).",
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: "autoSend",
|
|
351
|
+
type: "boolean",
|
|
352
|
+
deprecated: true,
|
|
353
|
+
description: "Deprecated. Use 'send' instead.",
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "method",
|
|
357
|
+
type: "'replace'",
|
|
358
|
+
deprecated: true,
|
|
359
|
+
description: "Deprecated. This parameter is no longer used.",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
name: "asChild",
|
|
363
|
+
type: "boolean",
|
|
364
|
+
default: "false",
|
|
365
|
+
description: "Merge props with child element instead of rendering a wrapper button.",
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
name: "className",
|
|
369
|
+
type: "string",
|
|
370
|
+
description: "CSS class name.",
|
|
371
|
+
},
|
|
372
|
+
]}
|
|
373
|
+
/>
|
|
374
|
+
|
|
375
|
+
This primitive renders a `<button>` element unless `asChild` is set.
|
|
376
|
+
|
|
377
|
+
### If
|
|
378
|
+
|
|
379
|
+
Conditionally renders children based on thread state.
|
|
380
|
+
|
|
381
|
+
<ParametersTable
|
|
382
|
+
type="ThreadPrimitiveIfProps"
|
|
383
|
+
parameters={[
|
|
384
|
+
{
|
|
385
|
+
name: "empty",
|
|
386
|
+
type: "boolean | undefined",
|
|
387
|
+
description: "Render children if the thread is empty (no messages).",
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
name: "running",
|
|
391
|
+
type: "boolean | undefined",
|
|
392
|
+
description: "Render children if the thread is running (assistant is responding).",
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "disabled",
|
|
396
|
+
type: "boolean | undefined",
|
|
397
|
+
description: "Render children if the thread is disabled.",
|
|
398
|
+
},
|
|
399
|
+
]}
|
|
400
|
+
/>
|
|
401
|
+
|
|
402
|
+
<Callout type="info">
|
|
403
|
+
Multiple conditions can be combined on `ThreadPrimitive.If` - all specified conditions must match for children to render.
|
|
404
|
+
</Callout>
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
## Related Components
|
|
408
|
+
|
|
409
|
+
- [ThreadList](/docs/ui/ThreadList) - List of threads
|
|
410
|
+
- [ThreadListSidebar](/docs/ui/ThreadListSidebar) - Sidebar with thread list
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/mcp-docs-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "MCP server for assistant-ui documentation and examples",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"assistant-ui-mcp": "./dist/stdio.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
12
|
-
"zod": "^4.
|
|
11
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
12
|
+
"zod": "^4.1.11",
|
|
13
13
|
"gray-matter": "^4.0.3",
|
|
14
|
-
"cross-env": "^10.
|
|
14
|
+
"cross-env": "^10.1.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^24.
|
|
17
|
+
"@types/node": "^24.6.2",
|
|
18
18
|
"tsup": "^8.5.0",
|
|
19
|
-
"tsx": "^4.20.
|
|
20
|
-
"typescript": "^5.9.
|
|
19
|
+
"tsx": "^4.20.6",
|
|
20
|
+
"typescript": "^5.9.3",
|
|
21
21
|
"vitest": "^3.2.4",
|
|
22
|
-
"eslint": "^9.
|
|
22
|
+
"eslint": "^9.36.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|