@assistant-ui/mcp-docs-server 0.1.6 → 0.1.8

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 (47) hide show
  1. package/.docs/organized/code-examples/with-ai-sdk-v5.md +15 -13
  2. package/.docs/organized/code-examples/with-cloud.md +19 -25
  3. package/.docs/organized/code-examples/with-external-store.md +9 -7
  4. package/.docs/organized/code-examples/with-ffmpeg.md +21 -21
  5. package/.docs/organized/code-examples/with-langgraph.md +72 -46
  6. package/.docs/organized/code-examples/with-parent-id-grouping.md +9 -7
  7. package/.docs/organized/code-examples/with-react-hook-form.md +19 -21
  8. package/.docs/raw/docs/api-reference/integrations/react-data-stream.mdx +194 -0
  9. package/.docs/raw/docs/api-reference/overview.mdx +7 -4
  10. package/.docs/raw/docs/api-reference/primitives/Composer.mdx +31 -0
  11. package/.docs/raw/docs/api-reference/primitives/Message.mdx +108 -3
  12. package/.docs/raw/docs/api-reference/primitives/Thread.mdx +59 -0
  13. package/.docs/raw/docs/api-reference/primitives/ThreadList.mdx +128 -0
  14. package/.docs/raw/docs/api-reference/primitives/ThreadListItem.mdx +160 -0
  15. package/.docs/raw/docs/api-reference/runtimes/AssistantRuntime.mdx +0 -11
  16. package/.docs/raw/docs/api-reference/runtimes/ComposerRuntime.mdx +3 -3
  17. package/.docs/raw/docs/copilots/assistant-frame.mdx +397 -0
  18. package/.docs/raw/docs/getting-started.mdx +53 -52
  19. package/.docs/raw/docs/guides/Attachments.mdx +7 -115
  20. package/.docs/raw/docs/guides/ToolUI.mdx +3 -3
  21. package/.docs/raw/docs/guides/Tools.mdx +152 -92
  22. package/.docs/raw/docs/guides/context-api.mdx +574 -0
  23. package/.docs/raw/docs/migrations/v0-12.mdx +125 -0
  24. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +134 -55
  25. package/.docs/raw/docs/runtimes/ai-sdk/v4-legacy.mdx +182 -0
  26. package/.docs/raw/docs/runtimes/custom/local.mdx +16 -3
  27. package/.docs/raw/docs/runtimes/data-stream.mdx +287 -0
  28. package/.docs/raw/docs/runtimes/langgraph/index.mdx +0 -1
  29. package/.docs/raw/docs/runtimes/langserve.mdx +9 -11
  30. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +5 -0
  31. package/.docs/raw/docs/ui/ThreadList.mdx +54 -16
  32. package/dist/{chunk-L4K23SWI.js → chunk-NVNFQ5ZO.js} +4 -1
  33. package/dist/index.js +1 -1
  34. package/dist/prepare-docs/prepare.js +1 -1
  35. package/dist/stdio.js +1 -1
  36. package/package.json +7 -7
  37. package/.docs/organized/code-examples/local-ollama.md +0 -1135
  38. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +0 -1721
  39. package/.docs/organized/code-examples/with-ai-sdk.md +0 -1082
  40. package/.docs/organized/code-examples/with-openai-assistants.md +0 -1175
  41. package/.docs/raw/docs/concepts/architecture.mdx +0 -19
  42. package/.docs/raw/docs/concepts/runtime-layer.mdx +0 -163
  43. package/.docs/raw/docs/concepts/why.mdx +0 -9
  44. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +0 -226
  45. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +0 -195
  46. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +0 -138
  47. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-v5.mdx +0 -212
@@ -1,138 +0,0 @@
1
- ---
2
- title: useChat Hook Integration (Legacy)
3
- ---
4
-
5
- ## Overview
6
-
7
- Integration with the Vercel AI SDK UI's `useChat` hook.
8
- It allows integration with OpenAI, Anthropic, Mistral, Perplexity, AWS Bedrock, Azure, Google Gemini, Hugging Face, Fireworks, Cohere, LangChain, Replicate, Ollama, and more.
9
-
10
- ## Getting Started
11
-
12
- import { Steps, Step } from "fumadocs-ui/components/steps";
13
-
14
- <Steps>
15
- <Step>
16
- ### Create a Next.JS project
17
-
18
- ```sh
19
- npx create-next-app@latest my-app
20
- cd my-app
21
- ```
22
-
23
- </Step>
24
- <Step>
25
-
26
- ### Install Vercel AI SDK and `@assistant-ui/react`
27
-
28
- ```sh npm2yarn
29
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/openai
30
- ```
31
-
32
- </Step>
33
- <Step>
34
-
35
- ### Setup a backend route under `/api/chat`
36
-
37
- `@/app/api/chat/route.ts`
38
-
39
- ```tsx
40
- import { openai } from "@ai-sdk/openai";
41
- import { streamText } from "ai";
42
-
43
- export const maxDuration = 30;
44
-
45
- export async function POST(req: Request) {
46
- const { messages } = await req.json();
47
-
48
- const result = streamText({
49
- model: openai("gpt-4o"),
50
- messages: convertToCoreMessages(messages),
51
- });
52
-
53
- return result.toDataStreamResponse();
54
- }
55
- ```
56
-
57
- </Step>
58
- <Step>
59
-
60
- ### Define a `MyRuntimeProvider` component
61
-
62
- `@/app/MyRuntimeProvider.tsx`
63
-
64
- ```tsx
65
- "use client";
66
-
67
- import { useChat } from "@ai-sdk/react";
68
- import { AssistantRuntimeProvider } from "@assistant-ui/react";
69
- import { useVercelUseChatRuntime } from "@assistant-ui/react-ai-sdk";
70
-
71
- export function MyRuntimeProvider({
72
- children,
73
- }: Readonly<{
74
- children: React.ReactNode;
75
- }>) {
76
- const chat = useChat({
77
- api: "/api/chat",
78
- });
79
-
80
- const runtime = useVercelUseChatRuntime(chat);
81
-
82
- return (
83
- <AssistantRuntimeProvider runtime={runtime}>
84
- {children}
85
- </AssistantRuntimeProvider>
86
- );
87
- }
88
- ```
89
-
90
- </Step>
91
- <Step>
92
-
93
- ### Wrap your app in `MyRuntimeProvider`
94
-
95
- `@/app/layout.tsx`
96
-
97
- ```tsx {1,11,17}
98
- import { MyRuntimeProvider } from '@/app/MyRuntimeProvider';
99
-
100
- ...
101
-
102
- export default function RootLayout({
103
- children,
104
- }: Readonly<{
105
- children: React.ReactNode;
106
- }>) {
107
- return (
108
- <MyRuntimeProvider>
109
- <html lang="en">
110
- <body className={inter.className}>
111
- {children}
112
- </body>
113
- </html>
114
- </MyRuntimeProvider>
115
- )
116
- }
117
- ```
118
-
119
- </Step>
120
- </Steps>
121
-
122
- ## Accessing AI SDK Messages
123
-
124
- You can use the `getExternalStoreMessages` utility to convert `ThreadMessage`s back to `Message`s from AI SDK.
125
-
126
- ```tsx
127
- const MyAssistantMessage = () => {
128
- const aiSDKMessages = useMessage((m) => getExternalStoreMessages(m));
129
- // ...
130
- };
131
-
132
- const WeatherToolUI = makeAssistantToolUI({
133
- render: () => {
134
- const aiSDKMessage = useMessagePart((p) => getExternalStoreMessages(p)[0]);
135
- // ...
136
- },
137
- });
138
- ```
@@ -1,212 +0,0 @@
1
- ---
2
- title: AI SDK v5 with useChatRuntime
3
- ---
4
-
5
- import { Callout } from "fumadocs-ui/components/callout";
6
-
7
-
8
- ## Overview
9
-
10
- Integration with the Vercel AI SDK v5 using the new `useChatRuntime` hook from `@assistant-ui/react-ai-sdk`.
11
- This provides a streamlined way to integrate AI SDK v5 features including the new streamText API and improved TypeScript support.
12
-
13
- ## Getting Started
14
-
15
- import { Steps, Step } from "fumadocs-ui/components/steps";
16
-
17
- <Steps>
18
- <Step>
19
- ### Create a Next.JS project
20
-
21
- ```sh
22
- npx create-next-app@latest my-app
23
- cd my-app
24
- ```
25
-
26
- </Step>
27
- <Step>
28
-
29
- ### Install AI SDK v5 and `@assistant-ui/react`
30
-
31
- ```sh npm2yarn
32
- npm install @assistant-ui/react @assistant-ui/react-ai-sdk ai @ai-sdk/openai
33
- ```
34
-
35
- </Step>
36
- <Step>
37
-
38
- ### Setup a backend route under `/api/chat`
39
-
40
- `@/app/api/chat/route.ts`
41
-
42
- ```tsx
43
- import { openai } from "@ai-sdk/openai";
44
- import {
45
- streamText,
46
- UIMessage,
47
- convertToModelMessages,
48
- tool,
49
- } from "ai";
50
- import { frontendTools } from "@assistant-ui/assistant-stream/ai-sdk";
51
- import { z } from "zod";
52
-
53
- // Allow streaming responses up to 30 seconds
54
- export const maxDuration = 30;
55
-
56
- export async function POST(req: Request) {
57
- const { messages, system, tools }: {
58
- messages: UIMessage[];
59
- system?: string; // System message forwarded from AssistantChatTransport
60
- tools?: any; // Frontend tools forwarded from AssistantChatTransport
61
- } = await req.json();
62
-
63
- const result = streamText({
64
- model: openai("gpt-4o"),
65
- system, // Use the system message from the frontend if provided
66
- messages: convertToModelMessages(messages),
67
- tools: {
68
- // Wrap frontend tools with frontendTools helper
69
- ...frontendTools(tools),
70
- // Backend tools
71
- get_current_weather: tool({
72
- description: "Get the current weather",
73
- inputSchema: z.object({
74
- city: z.string(),
75
- }),
76
- execute: async ({ city }) => {
77
- return `The weather in ${city} is sunny`;
78
- },
79
- }),
80
- },
81
- });
82
-
83
- return result.toUIMessageStreamResponse();
84
- }
85
- ```
86
-
87
- </Step>
88
- <Step>
89
-
90
- ### Wrap your app with `AssistantRuntimeProvider` using `useChatRuntime`
91
-
92
- `@/app/page.tsx`
93
-
94
- ```tsx
95
- "use client";
96
-
97
- import { Thread } from "@/components/assistant-ui/thread";
98
- import { AssistantRuntimeProvider } from "@assistant-ui/react";
99
- import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
100
-
101
- export default function Home() {
102
- const runtime = useChatRuntime();
103
-
104
- return (
105
- <AssistantRuntimeProvider runtime={runtime}>
106
- <div className="h-full">
107
- <Thread />
108
- </div>
109
- </AssistantRuntimeProvider>
110
- );
111
- }
112
- ```
113
-
114
- </Step>
115
- </Steps>
116
-
117
- ## API Reference
118
-
119
- ### useChatRuntime
120
-
121
- Creates a runtime directly with AI SDK v5's `useChat` hook integration.
122
-
123
- ```tsx
124
- import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
125
-
126
- const runtime = useChatRuntime({
127
- api: "/api/chat",
128
- // All standard useChat options are supported
129
- });
130
- ```
131
-
132
- <Callout type="info">
133
- By default, `useChatRuntime` uses `AssistantChatTransport` which automatically forwards system messages and frontend tools to your backend API. This enables your backend to receive the full context from the Assistant UI.
134
- </Callout>
135
-
136
- ### Custom Transport Configuration
137
-
138
- If you need to customize the transport configuration:
139
-
140
- ```tsx
141
- import { DefaultChatTransport } from "ai";
142
- import { AssistantChatTransport } from "@assistant-ui/react-ai-sdk";
143
- import { useChatRuntime } from "@assistant-ui/react-ai-sdk";
144
-
145
- // Example 1: Custom API URL while keeping system/tools forwarding
146
- const runtime = useChatRuntime({
147
- transport: new AssistantChatTransport({
148
- api: "/my-custom-api/chat" // Custom API URL with forwarding
149
- })
150
- });
151
-
152
- // Example 2: Disable system/tools forwarding
153
- const runtime = useChatRuntime({
154
- api: "/api/chat",
155
- transport: new DefaultChatTransport() // Standard AI SDK transport without forwarding
156
- });
157
- ```
158
-
159
- <Callout type="warning">
160
- When customizing the API URL, you must explicitly use `AssistantChatTransport` if you want to keep frontend system messages and tools forwarding. Simply passing `api` to `useChatRuntime` will use the default transport configuration.
161
- </Callout>
162
-
163
- #### Transport Options
164
-
165
- - **`AssistantChatTransport`** (default): Automatically forwards system messages and frontend tools from the Assistant UI context to your backend
166
- - **`DefaultChatTransport`**: Standard AI SDK transport without automatic forwarding
167
-
168
- ### Using Frontend Tools with `frontendTools`
169
-
170
- When using `AssistantChatTransport`, frontend tools are forwarded to your backend. Use the `frontendTools` helper to properly integrate them:
171
-
172
- ```tsx
173
- import { frontendTools } from "@assistant-ui/assistant-stream/ai-sdk";
174
-
175
- export async function POST(req: Request) {
176
- const { messages, system, tools } = await req.json();
177
-
178
- const result = streamText({
179
- model: openai("gpt-4o"),
180
- system,
181
- messages: convertToModelMessages(messages),
182
- tools: {
183
- // Wrap frontend tools with the helper
184
- ...frontendTools(tools),
185
- // Your backend tools
186
- myBackendTool: tool({
187
- // ...
188
- }),
189
- },
190
- });
191
-
192
- return result.toUIMessageStreamResponse();
193
- }
194
- ```
195
-
196
- The `frontendTools` helper converts frontend tool definitions to the AI SDK format and ensures they are properly handled by the streaming response.
197
-
198
- ### useAISDKRuntime (Advanced)
199
-
200
- For advanced use cases where you need direct access to the `useChat` hook:
201
-
202
- ```tsx
203
- import { useChat } from "@ai-sdk/react";
204
- import { useAISDKRuntime } from "@assistant-ui/react-ai-sdk";
205
-
206
- const chat = useChat();
207
- const runtime = useAISDKRuntime(chat);
208
- ```
209
-
210
- ## Example
211
-
212
- For a complete example, check out the [AI SDK v5 example](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-ai-sdk-v5) in our repository.