@assistant-ui/mcp-docs-server 0.1.20 → 0.1.22
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-ag-ui.md +112 -16
- package/.docs/organized/code-examples/with-ai-sdk-v6.md +5 -5
- package/.docs/organized/code-examples/with-assistant-transport.md +3 -3
- package/.docs/organized/code-examples/with-chain-of-thought.md +598 -0
- package/.docs/organized/code-examples/with-cloud.md +5 -5
- package/.docs/organized/code-examples/with-custom-thread-list.md +5 -5
- package/.docs/organized/code-examples/with-elevenlabs-scribe.md +8 -8
- package/.docs/organized/code-examples/with-external-store.md +4 -4
- package/.docs/organized/code-examples/with-ffmpeg.md +5 -5
- package/.docs/organized/code-examples/with-langgraph.md +4 -4
- package/.docs/organized/code-examples/with-parent-id-grouping.md +4 -4
- package/.docs/organized/code-examples/with-react-hook-form.md +6 -6
- package/.docs/organized/code-examples/with-react-router.md +4 -4
- package/.docs/organized/code-examples/with-store.md +3 -3
- package/.docs/organized/code-examples/with-tanstack.md +6 -6
- package/.docs/organized/code-examples/with-tap-runtime.md +812 -0
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool-ui.mdx +0 -1
- package/.docs/raw/docs/(docs)/copilots/make-assistant-tool.mdx +0 -1
- package/.docs/raw/docs/(docs)/devtools.mdx +0 -1
- package/.docs/raw/docs/(docs)/guides/attachments.mdx +0 -1
- package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +162 -0
- package/.docs/raw/docs/(docs)/index.mdx +1 -1
- package/.docs/raw/docs/(docs)/installation.mdx +0 -1
- package/.docs/raw/docs/(docs)/llm.mdx +1 -1
- package/.docs/raw/docs/(reference)/api-reference/context-providers/assistant-runtime-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/context-providers/text-message-part-provider.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-data-stream.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/integrations/react-hook-form.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/integrations/vercel-ai-sdk.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +13 -45
- package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +12 -35
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-modal.mdx +3 -11
- package/.docs/raw/docs/(reference)/api-reference/primitives/attachment.mdx +0 -3
- package/.docs/raw/docs/(reference)/api-reference/primitives/branch-picker.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +5 -16
- package/.docs/raw/docs/(reference)/api-reference/primitives/composition.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/error.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/suggestion.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item-more.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list-item.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread-list.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/assistant-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/attachment-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/composer-runtime.mdx +2 -3
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-part-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/message-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-item-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-list-runtime.mdx +0 -1
- package/.docs/raw/docs/(reference)/api-reference/runtimes/thread-runtime.mdx +1 -2
- package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +0 -1
- package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +0 -1
- package/.docs/raw/docs/(reference)/react-compatibility.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -1
- package/.docs/raw/docs/cloud/persistence/langgraph.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +0 -1
- package/.docs/raw/docs/runtimes/ai-sdk/v5-legacy.mdx +118 -0
- package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +198 -0
- package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +0 -1
- package/.docs/raw/docs/runtimes/custom/external-store.mdx +9 -11
- package/.docs/raw/docs/runtimes/custom/local.mdx +0 -2
- package/.docs/raw/docs/runtimes/data-stream.mdx +0 -1
- package/.docs/raw/docs/runtimes/langgraph/index.mdx +1 -2
- package/.docs/raw/docs/runtimes/langgraph/tutorial/part-3.mdx +0 -1
- package/.docs/raw/docs/runtimes/langserve.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/full-stack-integration.mdx +0 -1
- package/.docs/raw/docs/runtimes/mastra/separate-server-integration.mdx +0 -1
- package/.docs/raw/docs/ui/accordion.mdx +0 -2
- package/.docs/raw/docs/ui/assistant-modal.mdx +1 -3
- package/.docs/raw/docs/ui/assistant-sidebar.mdx +1 -3
- package/.docs/raw/docs/ui/attachment.mdx +0 -2
- package/.docs/raw/docs/ui/badge.mdx +0 -2
- package/.docs/raw/docs/ui/diff-viewer.mdx +279 -0
- package/.docs/raw/docs/ui/file.mdx +0 -1
- package/.docs/raw/docs/ui/image.mdx +0 -1
- package/.docs/raw/docs/ui/markdown.mdx +0 -1
- package/.docs/raw/docs/ui/mermaid.mdx +0 -1
- package/.docs/raw/docs/ui/model-selector.mdx +0 -2
- package/.docs/raw/docs/ui/part-grouping.mdx +2 -3
- package/.docs/raw/docs/ui/reasoning.mdx +2 -3
- package/.docs/raw/docs/ui/scrollbar.mdx +26 -9
- package/.docs/raw/docs/ui/select.mdx +0 -2
- package/.docs/raw/docs/ui/sources.mdx +0 -1
- package/.docs/raw/docs/ui/syntax-highlighting.mdx +8 -63
- package/.docs/raw/docs/ui/tabs.mdx +0 -2
- package/.docs/raw/docs/ui/thread-list.mdx +98 -16
- package/.docs/raw/docs/ui/thread.mdx +1 -3
- package/.docs/raw/docs/ui/tool-fallback.mdx +0 -1
- package/.docs/raw/docs/ui/tool-group.mdx +1 -3
- package/package.json +3 -3
- package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +0 -219
|
@@ -162,29 +162,68 @@ export default function RootLayout({
|
|
|
162
162
|
```tsx
|
|
163
163
|
"use client";
|
|
164
164
|
|
|
165
|
-
import
|
|
166
|
-
import {
|
|
165
|
+
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
166
|
+
import {
|
|
167
|
+
AssistantRuntimeProvider,
|
|
168
|
+
type ThreadMessage,
|
|
169
|
+
} from "@assistant-ui/react";
|
|
167
170
|
import { HttpAgent } from "@ag-ui/client";
|
|
168
171
|
import { useAgUiRuntime } from "@assistant-ui/react-ag-ui";
|
|
169
172
|
|
|
173
|
+
type StoredThread = {
|
|
174
|
+
id: string;
|
|
175
|
+
messages: readonly ThreadMessage[];
|
|
176
|
+
};
|
|
177
|
+
|
|
170
178
|
/**
|
|
171
|
-
*
|
|
179
|
+
* AG-UI runtime with threadList adapter for multi-thread support.
|
|
172
180
|
*/
|
|
173
181
|
export function MyRuntimeProvider({
|
|
174
182
|
children,
|
|
175
|
-
}: Readonly<{ children:
|
|
183
|
+
}: Readonly<{ children: ReactNode }>) {
|
|
176
184
|
const agentUrl =
|
|
177
185
|
(process.env["NEXT_PUBLIC_AGUI_AGENT_URL"] as string | undefined) ??
|
|
178
186
|
"http://localhost:8000/agent";
|
|
179
187
|
|
|
188
|
+
// Simple in-memory thread storage
|
|
189
|
+
const threadsRef = useRef<Map<string, StoredThread>>(new Map());
|
|
190
|
+
const [currentThreadId, setCurrentThreadId] = useState<string>(() => {
|
|
191
|
+
const id = crypto.randomUUID();
|
|
192
|
+
threadsRef.current.set(id, { id, messages: [] });
|
|
193
|
+
return id;
|
|
194
|
+
});
|
|
195
|
+
|
|
180
196
|
const agent = useMemo(() => {
|
|
181
197
|
return new HttpAgent({
|
|
182
198
|
url: agentUrl,
|
|
199
|
+
threadId: currentThreadId,
|
|
183
200
|
headers: {
|
|
184
201
|
Accept: "text/event-stream",
|
|
185
202
|
},
|
|
186
203
|
});
|
|
187
|
-
}, [agentUrl]);
|
|
204
|
+
}, [agentUrl, currentThreadId]);
|
|
205
|
+
|
|
206
|
+
const threadListAdapter = useMemo(
|
|
207
|
+
() => ({
|
|
208
|
+
threadId: currentThreadId,
|
|
209
|
+
onSwitchToNewThread: async () => {
|
|
210
|
+
const newId = crypto.randomUUID();
|
|
211
|
+
threadsRef.current.set(newId, { id: newId, messages: [] });
|
|
212
|
+
setCurrentThreadId(newId);
|
|
213
|
+
console.debug("[agui] Switched to new thread:", newId);
|
|
214
|
+
},
|
|
215
|
+
onSwitchToThread: async (threadId: string) => {
|
|
216
|
+
const thread = threadsRef.current.get(threadId);
|
|
217
|
+
if (!thread) {
|
|
218
|
+
throw new Error(`Thread ${threadId} not found`);
|
|
219
|
+
}
|
|
220
|
+
setCurrentThreadId(threadId);
|
|
221
|
+
console.debug("[agui] Switched to thread:", threadId);
|
|
222
|
+
return { messages: thread.messages };
|
|
223
|
+
},
|
|
224
|
+
}),
|
|
225
|
+
[currentThreadId],
|
|
226
|
+
);
|
|
188
227
|
|
|
189
228
|
const runtime = useAgUiRuntime({
|
|
190
229
|
agent,
|
|
@@ -192,8 +231,21 @@ export function MyRuntimeProvider({
|
|
|
192
231
|
debug: (...a: any[]) => console.debug("[agui]", ...a),
|
|
193
232
|
error: (...a: any[]) => console.error("[agui]", ...a),
|
|
194
233
|
},
|
|
234
|
+
adapters: {
|
|
235
|
+
threadList: threadListAdapter,
|
|
236
|
+
},
|
|
195
237
|
});
|
|
196
238
|
|
|
239
|
+
// Persist messages to threadsRef when they change
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
return runtime.thread.subscribe(() => {
|
|
242
|
+
threadsRef.current.set(currentThreadId, {
|
|
243
|
+
id: currentThreadId,
|
|
244
|
+
messages: runtime.thread.getState().messages,
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}, [runtime, currentThreadId]);
|
|
248
|
+
|
|
197
249
|
return (
|
|
198
250
|
<AssistantRuntimeProvider runtime={runtime}>
|
|
199
251
|
{children}
|
|
@@ -208,10 +260,11 @@ export function MyRuntimeProvider({
|
|
|
208
260
|
```tsx
|
|
209
261
|
"use client";
|
|
210
262
|
|
|
211
|
-
import { useAssistantTool } from "@assistant-ui/react";
|
|
263
|
+
import { useAssistantRuntime, useAssistantTool } from "@assistant-ui/react";
|
|
212
264
|
import { Thread } from "@/components/assistant-ui/thread";
|
|
265
|
+
import { PlusIcon } from "lucide-react";
|
|
213
266
|
|
|
214
|
-
|
|
267
|
+
function BrowserAlertTool() {
|
|
215
268
|
useAssistantTool<{ message: string }, { status: string }>({
|
|
216
269
|
toolName: "browser_alert",
|
|
217
270
|
description: "Display a native browser alert dialog to the user.",
|
|
@@ -248,11 +301,26 @@ const BrowserAlertTool = () => {
|
|
|
248
301
|
});
|
|
249
302
|
|
|
250
303
|
return null;
|
|
251
|
-
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function NewThreadButton() {
|
|
307
|
+
const runtime = useAssistantRuntime();
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<button
|
|
311
|
+
onClick={() => runtime.switchToNewThread()}
|
|
312
|
+
className="absolute top-4 right-4 z-10 flex items-center gap-2 rounded-lg border bg-background px-3 py-2 font-medium text-sm shadow-sm transition-colors hover:bg-accent"
|
|
313
|
+
>
|
|
314
|
+
<PlusIcon className="size-4" />
|
|
315
|
+
New Thread
|
|
316
|
+
</button>
|
|
317
|
+
);
|
|
318
|
+
}
|
|
252
319
|
|
|
253
320
|
export default function Home() {
|
|
254
321
|
return (
|
|
255
|
-
<main className="h-dvh">
|
|
322
|
+
<main className="relative h-dvh">
|
|
323
|
+
<NewThreadButton />
|
|
256
324
|
<Thread />
|
|
257
325
|
<BrowserAlertTool />
|
|
258
326
|
</main>
|
|
@@ -330,7 +398,7 @@ export default nextConfig;
|
|
|
330
398
|
"start": "next start"
|
|
331
399
|
},
|
|
332
400
|
"dependencies": {
|
|
333
|
-
"@ag-ui/client": "^0.0.
|
|
401
|
+
"@ag-ui/client": "^0.0.44",
|
|
334
402
|
"@assistant-ui/react": "workspace:*",
|
|
335
403
|
"@assistant-ui/react-ag-ui": "workspace:*",
|
|
336
404
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
@@ -343,7 +411,7 @@ export default nextConfig;
|
|
|
343
411
|
"class-variance-authority": "^0.7.1",
|
|
344
412
|
"clsx": "^2.1.1",
|
|
345
413
|
"lucide-react": "^0.563.0",
|
|
346
|
-
"next": "^16.1.
|
|
414
|
+
"next": "^16.1.6",
|
|
347
415
|
"react": "^19.2.4",
|
|
348
416
|
"react-dom": "^19.2.4",
|
|
349
417
|
"tailwind-merge": "^3.4.0"
|
|
@@ -351,8 +419,8 @@ export default nextConfig;
|
|
|
351
419
|
"devDependencies": {
|
|
352
420
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
353
421
|
"@tailwindcss/postcss": "^4.1.18",
|
|
354
|
-
"@types/node": "^25.
|
|
355
|
-
"@types/react": "^19.2.
|
|
422
|
+
"@types/node": "^25.2.1",
|
|
423
|
+
"@types/react": "^19.2.13",
|
|
356
424
|
"@types/react-dom": "^19.2.3",
|
|
357
425
|
"postcss": "^8.5.6",
|
|
358
426
|
"tailwindcss": "^4.1.18",
|
|
@@ -379,7 +447,22 @@ npx assistant-ui@latest create my-app --example with-ag-ui
|
|
|
379
447
|
cd my-app
|
|
380
448
|
```
|
|
381
449
|
|
|
382
|
-
###
|
|
450
|
+
### 1. Start the Backend Agent
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
# Install Python dependencies
|
|
454
|
+
pip install -r server/requirements.txt
|
|
455
|
+
|
|
456
|
+
# Run the agent (echo mode by default)
|
|
457
|
+
python server/agent.py
|
|
458
|
+
|
|
459
|
+
# Or with OpenAI integration
|
|
460
|
+
OPENAI_API_KEY=sk-xxx python server/agent.py
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
The agent will start at `http://localhost:8000/agent`.
|
|
464
|
+
|
|
465
|
+
### 2. Configure Environment
|
|
383
466
|
|
|
384
467
|
Create `.env.local`:
|
|
385
468
|
|
|
@@ -387,19 +470,32 @@ Create `.env.local`:
|
|
|
387
470
|
NEXT_PUBLIC_AGUI_AGENT_URL=http://localhost:8000/agent
|
|
388
471
|
```
|
|
389
472
|
|
|
390
|
-
### Run
|
|
473
|
+
### 3. Run the Frontend
|
|
391
474
|
|
|
392
475
|
```bash
|
|
393
|
-
|
|
476
|
+
pnpm dev
|
|
394
477
|
```
|
|
395
478
|
|
|
396
479
|
## Features
|
|
397
480
|
|
|
398
481
|
- AG-UI protocol integration via `@assistant-ui/react-ag-ui`
|
|
482
|
+
- Multi-thread support with "New Thread" button
|
|
399
483
|
- Custom browser alert tool demonstration
|
|
400
484
|
- Client-side tool execution
|
|
401
485
|
- Tool result rendering
|
|
402
486
|
|
|
487
|
+
## Backend Agent
|
|
488
|
+
|
|
489
|
+
The included `server/agent.py` provides:
|
|
490
|
+
|
|
491
|
+
- **Echo mode** (default): Echoes back user messages for testing
|
|
492
|
+
- **OpenAI mode**: Uses GPT-4o-mini when `OPENAI_API_KEY` is set
|
|
493
|
+
|
|
494
|
+
### Endpoints
|
|
495
|
+
|
|
496
|
+
- `POST /agent` - AG-UI agent endpoint (SSE streaming)
|
|
497
|
+
- `GET /health` - Health check
|
|
498
|
+
|
|
403
499
|
## Related Documentation
|
|
404
500
|
|
|
405
501
|
- [assistant-ui Documentation](https://www.assistant-ui.com/docs)
|
|
@@ -289,7 +289,7 @@ export default nextConfig;
|
|
|
289
289
|
"start": "next start"
|
|
290
290
|
},
|
|
291
291
|
"dependencies": {
|
|
292
|
-
"@ai-sdk/openai": "^3.0.
|
|
292
|
+
"@ai-sdk/openai": "^3.0.25",
|
|
293
293
|
"@assistant-ui/react": "workspace:*",
|
|
294
294
|
"@assistant-ui/react-ai-sdk": "workspace:*",
|
|
295
295
|
"@assistant-ui/react-markdown": "workspace:*",
|
|
@@ -299,11 +299,11 @@ export default nextConfig;
|
|
|
299
299
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
300
300
|
"@radix-ui/react-slot": "^1.2.4",
|
|
301
301
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
302
|
-
"ai": "^6.0.
|
|
302
|
+
"ai": "^6.0.73",
|
|
303
303
|
"class-variance-authority": "^0.7.1",
|
|
304
304
|
"clsx": "^2.1.1",
|
|
305
305
|
"lucide-react": "^0.563.0",
|
|
306
|
-
"next": "^16.1.
|
|
306
|
+
"next": "^16.1.6",
|
|
307
307
|
"react": "^19.2.4",
|
|
308
308
|
"react-dom": "^19.2.4",
|
|
309
309
|
"tailwind-merge": "^3.4.0",
|
|
@@ -312,8 +312,8 @@ export default nextConfig;
|
|
|
312
312
|
"devDependencies": {
|
|
313
313
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
314
314
|
"@tailwindcss/postcss": "^4.1.18",
|
|
315
|
-
"@types/node": "^25.
|
|
316
|
-
"@types/react": "^19.2.
|
|
315
|
+
"@types/node": "^25.2.1",
|
|
316
|
+
"@types/react": "^19.2.13",
|
|
317
317
|
"@types/react-dom": "^19.2.3",
|
|
318
318
|
"postcss": "^8.5.6",
|
|
319
319
|
"tailwindcss": "^4.1.18",
|
|
@@ -418,7 +418,7 @@ export default nextConfig;
|
|
|
418
418
|
"class-variance-authority": "^0.7.1",
|
|
419
419
|
"clsx": "^2.1.1",
|
|
420
420
|
"lucide-react": "^0.563.0",
|
|
421
|
-
"next": "^16.1.
|
|
421
|
+
"next": "^16.1.6",
|
|
422
422
|
"react": "^19.2.4",
|
|
423
423
|
"react-dom": "^19.2.4",
|
|
424
424
|
"tailwind-merge": "^3.4.0",
|
|
@@ -427,8 +427,8 @@ export default nextConfig;
|
|
|
427
427
|
"devDependencies": {
|
|
428
428
|
"@assistant-ui/x-buildutils": "workspace:*",
|
|
429
429
|
"@tailwindcss/postcss": "^4.1.18",
|
|
430
|
-
"@types/node": "^25.
|
|
431
|
-
"@types/react": "^19.2.
|
|
430
|
+
"@types/node": "^25.2.1",
|
|
431
|
+
"@types/react": "^19.2.13",
|
|
432
432
|
"@types/react-dom": "^19.2.3",
|
|
433
433
|
"postcss": "^8.5.6",
|
|
434
434
|
"tailwindcss": "^4.1.18",
|