@assistant-ui/mcp-docs-server 0.1.22 → 0.1.23

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 (74) hide show
  1. package/.docs/organized/code-examples/waterfall.md +801 -0
  2. package/.docs/organized/code-examples/with-ag-ui.md +38 -26
  3. package/.docs/organized/code-examples/with-ai-sdk-v6.md +38 -28
  4. package/.docs/organized/code-examples/with-artifacts.md +467 -0
  5. package/.docs/organized/code-examples/with-assistant-transport.md +31 -24
  6. package/.docs/organized/code-examples/with-chain-of-thought.md +41 -32
  7. package/.docs/organized/code-examples/with-cloud-standalone.md +675 -0
  8. package/.docs/organized/code-examples/with-cloud.md +34 -27
  9. package/.docs/organized/code-examples/with-custom-thread-list.md +34 -27
  10. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +41 -30
  11. package/.docs/organized/code-examples/with-expo.md +2031 -0
  12. package/.docs/organized/code-examples/with-external-store.md +32 -25
  13. package/.docs/organized/code-examples/with-ffmpeg.md +31 -27
  14. package/.docs/organized/code-examples/with-langgraph.md +96 -38
  15. package/.docs/organized/code-examples/with-parent-id-grouping.md +32 -25
  16. package/.docs/organized/code-examples/with-react-hook-form.md +63 -58
  17. package/.docs/organized/code-examples/with-react-router.md +38 -30
  18. package/.docs/organized/code-examples/with-store.md +16 -24
  19. package/.docs/organized/code-examples/with-tanstack.md +36 -26
  20. package/.docs/organized/code-examples/with-tap-runtime.md +10 -24
  21. package/.docs/raw/docs/(docs)/cli.mdx +13 -6
  22. package/.docs/raw/docs/(docs)/guides/attachments.mdx +26 -3
  23. package/.docs/raw/docs/(docs)/guides/chain-of-thought.mdx +5 -5
  24. package/.docs/raw/docs/(docs)/guides/context-api.mdx +53 -52
  25. package/.docs/raw/docs/(docs)/guides/dictation.mdx +0 -2
  26. package/.docs/raw/docs/(docs)/guides/message-timing.mdx +169 -0
  27. package/.docs/raw/docs/(docs)/guides/quoting.mdx +327 -0
  28. package/.docs/raw/docs/(docs)/guides/speech.mdx +0 -1
  29. package/.docs/raw/docs/(docs)/index.mdx +12 -2
  30. package/.docs/raw/docs/(docs)/installation.mdx +8 -2
  31. package/.docs/raw/docs/(docs)/llm.mdx +9 -7
  32. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar-more.mdx +1 -1
  33. package/.docs/raw/docs/(reference)/api-reference/primitives/action-bar.mdx +2 -2
  34. package/.docs/raw/docs/(reference)/api-reference/primitives/assistant-if.mdx +27 -27
  35. package/.docs/raw/docs/(reference)/api-reference/primitives/composer.mdx +60 -0
  36. package/.docs/raw/docs/(reference)/api-reference/primitives/message-part.mdx +78 -4
  37. package/.docs/raw/docs/(reference)/api-reference/primitives/message.mdx +32 -0
  38. package/.docs/raw/docs/(reference)/api-reference/primitives/selection-toolbar.mdx +61 -0
  39. package/.docs/raw/docs/(reference)/api-reference/primitives/thread.mdx +1 -1
  40. package/.docs/raw/docs/(reference)/legacy/styled/assistant-modal.mdx +1 -6
  41. package/.docs/raw/docs/(reference)/legacy/styled/decomposition.mdx +2 -2
  42. package/.docs/raw/docs/(reference)/legacy/styled/markdown.mdx +1 -6
  43. package/.docs/raw/docs/(reference)/legacy/styled/thread.mdx +1 -5
  44. package/.docs/raw/docs/(reference)/migrations/v0-12.mdx +17 -17
  45. package/.docs/raw/docs/cloud/ai-sdk-assistant-ui.mdx +205 -0
  46. package/.docs/raw/docs/cloud/ai-sdk.mdx +292 -0
  47. package/.docs/raw/docs/cloud/authorization.mdx +178 -79
  48. package/.docs/raw/docs/cloud/{persistence/langgraph.mdx → langgraph.mdx} +2 -2
  49. package/.docs/raw/docs/cloud/overview.mdx +29 -39
  50. package/.docs/raw/docs/react-native/adapters.mdx +118 -0
  51. package/.docs/raw/docs/react-native/custom-backend.mdx +210 -0
  52. package/.docs/raw/docs/react-native/hooks.mdx +364 -0
  53. package/.docs/raw/docs/react-native/index.mdx +332 -0
  54. package/.docs/raw/docs/react-native/primitives.mdx +653 -0
  55. package/.docs/raw/docs/runtimes/ai-sdk/v6.mdx +7 -15
  56. package/.docs/raw/docs/runtimes/assistant-transport.mdx +103 -0
  57. package/.docs/raw/docs/runtimes/custom/external-store.mdx +25 -2
  58. package/.docs/raw/docs/runtimes/data-stream.mdx +1 -3
  59. package/.docs/raw/docs/runtimes/langgraph/index.mdx +113 -9
  60. package/.docs/raw/docs/runtimes/pick-a-runtime.mdx +1 -4
  61. package/.docs/raw/docs/ui/attachment.mdx +4 -2
  62. package/.docs/raw/docs/ui/message-timing.mdx +92 -0
  63. package/.docs/raw/docs/ui/part-grouping.mdx +1 -1
  64. package/.docs/raw/docs/ui/reasoning.mdx +4 -4
  65. package/.docs/raw/docs/ui/scrollbar.mdx +2 -2
  66. package/.docs/raw/docs/ui/syntax-highlighting.mdx +55 -50
  67. package/.docs/raw/docs/ui/thread.mdx +16 -9
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/package.json +3 -3
  71. package/src/tools/tests/integration.test.ts +2 -2
  72. package/src/tools/tests/json-parsing.test.ts +1 -1
  73. package/src/tools/tests/mcp-protocol.test.ts +1 -3
  74. package/.docs/raw/docs/cloud/persistence/ai-sdk.mdx +0 -108
@@ -1,56 +1,46 @@
1
1
  ---
2
2
  title: Overview
3
- description: Hosted service for thread management, chat history, and user authentication.
3
+ description: Add thread persistence and chat history to your AI app in minutes.
4
4
  ---
5
5
 
6
- Assistant Cloud is a hosted service built for assistant-ui frontends that offers comprehensive thread management and message history. It automatically persists threads, supports human-in-the-loop workflows, and integrates with common auth providers to seamlessly allow users to resume conversations at any point.
6
+ Assistant Cloud is a hosted service that adds thread management, message persistence, and user authorization to AI chat applications. It works with any React UI—whether you use assistant-ui components or your own.
7
7
 
8
+ ## What You Get
8
9
 
9
- ## Features
10
+ - **Thread Persistence** — Messages automatically save as conversations progress. Users can resume chats at any time, even across sessions.
11
+ - **Thread List** — Built-in UI components (or hooks) for browsing, switching, and managing conversations.
12
+ - **Auto-Generated Titles** — Conversations get meaningful titles based on the initial messages.
13
+ - **User Authorization** — Integrates with your auth provider to scope threads per user or workspace.
10
14
 
11
- ### Thread management
15
+ ## Supported Backends
12
16
 
13
- Using our `<ThreadList />` component, show the users a list of conversations. Allow the users to seamlessly switch between conversations and even let long running tasks run in the background.
17
+ | Backend | Standalone Mode | With assistant-ui |
18
+ |---------|----------------|-------------------|
19
+ | AI SDK | [`useCloudChat`](/docs/cloud/ai-sdk) | [`useChatRuntime`](/docs/cloud/ai-sdk-assistant-ui) |
20
+ | LangGraph | — | [`useLangGraphRuntime`](/docs/cloud/langgraph) |
21
+ | Custom | — | Local Runtime |
14
22
 
15
- Assistant Cloud automatically persists a list of threads and corresponding metadata. It also automatically generates a title for conversations based on the initial messages.
16
-
17
- Supported backends:
18
-
19
- - AI SDK
20
- - LangGraph
21
- - Custom
22
-
23
- ### Chat history
24
-
25
- For every conversation, Assistant Cloud can store the history of messages, allowing the user to resume the conversation at any point in time.
26
- This supports human in the loop workflows, where the execution of an agent is interrupted until user feedback is collected.
27
-
28
- Supported backends:
29
-
30
- - AI SDK
31
- - LangGraph
32
- - Custom (currently only Local Runtime)
33
-
34
- ### Authorization
23
+ ## Getting Started
35
24
 
36
- Assistant Cloud integrates with your auth provider (Clerk, Auth0, Supabase, Firebase, ...) to identify your users and authorize them to access just the conversations they are allowed to see.
25
+ <Callout type="info">
26
+ You'll need an Assistant Cloud account. [Sign up here](https://cloud.assistant-ui.com/) to create a project.
37
27
 
38
- Supported auth providers:
28
+ From your project settings, copy the **Frontend API URL** (`https://proj-[ID].assistant-api.com`)—you'll need it for the guides below.
29
+ </Callout>
39
30
 
40
- - Clerk
41
- - Auth0
42
- - Supabase
43
- - Firebase
44
- - Your own
31
+ ### Choose Your Integration Path
45
32
 
46
- ## Getting Started
33
+ **Using AI SDK with your own UI?**
34
+ → Follow the [AI SDK guide](/docs/cloud/ai-sdk) for the `useCloudChat` hook. One hook, minimal changes to your existing code.
47
35
 
48
- To get started, create an account at [Assistant Cloud Dashboard](https://cloud.assistant-ui.com/) and follow one of the walkthroughs for your preferred backend:
36
+ **Want pre-built components like `<Thread />` and `<ThreadList />`?**
37
+ → Follow the [AI SDK + assistant-ui guide](/docs/cloud/ai-sdk-assistant-ui) for full UI components with cloud persistence.
49
38
 
50
- - [AI SDK](/docs/cloud/persistence/ai-sdk)
51
- - [LangGraph](/docs/cloud/persistence/langgraph)
39
+ **Using LangGraph?**
40
+ Follow the [LangGraph guide](/docs/cloud/langgraph) for cloud-backed LangGraph Cloud integration.
52
41
 
53
- You can also check out our example repositories to see how to integrate Assistant Cloud with your frontend:
42
+ ## Example Repositories
54
43
 
55
- - [With AI SDK](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-cloud)
56
- - [With LangGraph](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-langgraph)
44
+ - [AI SDK (standalone)](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-cloud-standalone) — Minimal `useCloudChat` setup
45
+ - [AI SDK + assistant-ui](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-cloud) — Full component integration
46
+ - [LangGraph + assistant-ui](https://github.com/assistant-ui/assistant-ui/tree/main/examples/with-langgraph) — LangGraph Cloud with persistence
@@ -0,0 +1,118 @@
1
+ ---
2
+ title: Adapters
3
+ description: Storage and title generation adapters for React Native.
4
+ ---
5
+
6
+ Adapters customize how the local runtime persists threads and generates titles. Pass them to `useLocalRuntime` via options.
7
+
8
+ ```tsx
9
+ import AsyncStorage from "@react-native-async-storage/async-storage";
10
+ import {
11
+ useLocalRuntime,
12
+ createSimpleTitleAdapter,
13
+ } from "@assistant-ui/react-native";
14
+
15
+ const runtime = useLocalRuntime(chatModel, {
16
+ storage: AsyncStorage,
17
+ titleGenerator: createSimpleTitleAdapter(),
18
+ });
19
+ ```
20
+
21
+ ## Storage
22
+
23
+ The `storage` option accepts any object with `getItem`, `setItem`, and `removeItem` methods (matching the `AsyncStorage` interface). When provided, threads and messages are persisted across app restarts.
24
+
25
+ ```tsx
26
+ type AsyncStorageLike = {
27
+ getItem(key: string): Promise<string | null>;
28
+ setItem(key: string, value: string): Promise<void>;
29
+ removeItem(key: string): Promise<void>;
30
+ };
31
+ ```
32
+
33
+ ### AsyncStorage
34
+
35
+ The most common choice for React Native:
36
+
37
+ ```tsx
38
+ import AsyncStorage from "@react-native-async-storage/async-storage";
39
+
40
+ const runtime = useLocalRuntime(chatModel, {
41
+ storage: AsyncStorage,
42
+ });
43
+ ```
44
+
45
+ An optional `storagePrefix` parameter namespaces the keys:
46
+
47
+ ```tsx
48
+ const runtime = useLocalRuntime(chatModel, {
49
+ storage: AsyncStorage,
50
+ storagePrefix: "chat:",
51
+ // Keys: "chat:threads", "chat:messages:<threadId>", ...
52
+ });
53
+ ```
54
+
55
+ ### No storage (default)
56
+
57
+ When `storage` is omitted, threads live in memory only — lost on app restart.
58
+
59
+ ```tsx
60
+ const runtime = useLocalRuntime(chatModel);
61
+ ```
62
+
63
+ ### Advanced: createLocalStorageAdapter
64
+
65
+ For more control, use `createLocalStorageAdapter` directly to create a `RemoteThreadListAdapter`:
66
+
67
+ ```tsx
68
+ import AsyncStorage from "@react-native-async-storage/async-storage";
69
+ import {
70
+ createLocalStorageAdapter,
71
+ createSimpleTitleAdapter,
72
+ } from "@assistant-ui/react-native";
73
+
74
+ const adapter = createLocalStorageAdapter({
75
+ storage: AsyncStorage,
76
+ prefix: "chat:",
77
+ titleGenerator: createSimpleTitleAdapter(),
78
+ });
79
+ ```
80
+
81
+ ## TitleGenerationAdapter
82
+
83
+ Generates a title for a thread based on its messages.
84
+
85
+ ```tsx
86
+ interface TitleGenerationAdapter {
87
+ generateTitle(messages: ThreadMessage[]): Promise<string>;
88
+ }
89
+ ```
90
+
91
+ ### Built-in implementations
92
+
93
+ #### Simple title adapter
94
+
95
+ Returns the first 50 characters of the first user message.
96
+
97
+ ```tsx
98
+ import { createSimpleTitleAdapter } from "@assistant-ui/react-native";
99
+
100
+ const titleGenerator = createSimpleTitleAdapter();
101
+ ```
102
+
103
+ ### Custom implementation
104
+
105
+ ```tsx
106
+ import type { TitleGenerationAdapter } from "@assistant-ui/react-native";
107
+
108
+ const aiTitleGenerator: TitleGenerationAdapter = {
109
+ async generateTitle(messages) {
110
+ const response = await fetch("/api/generate-title", {
111
+ method: "POST",
112
+ body: JSON.stringify({ messages }),
113
+ });
114
+ const { title } = await response.json();
115
+ return title;
116
+ },
117
+ };
118
+ ```
@@ -0,0 +1,210 @@
1
+ ---
2
+ title: Custom Backend
3
+ description: Connect your React Native app to your own backend API.
4
+ ---
5
+
6
+ By default, `useLocalRuntime` manages threads and messages on-device. You can connect to your own backend in two ways depending on your needs.
7
+
8
+ ## Option 1: ChatModelAdapter only
9
+
10
+ The simplest approach — keep thread management local, but send messages to your backend for inference.
11
+
12
+ ```tsx title="adapters/my-chat-adapter.ts"
13
+ import type { ChatModelAdapter } from "@assistant-ui/react-native";
14
+
15
+ export const myChatAdapter: ChatModelAdapter = {
16
+ async *run({ messages, abortSignal }) {
17
+ const response = await fetch("https://my-api.com/chat", {
18
+ method: "POST",
19
+ headers: { "Content-Type": "application/json" },
20
+ body: JSON.stringify({ messages }),
21
+ signal: abortSignal,
22
+ });
23
+
24
+ const reader = response.body?.getReader();
25
+ if (!reader) throw new Error("No response body");
26
+
27
+ const decoder = new TextDecoder();
28
+ let fullText = "";
29
+
30
+ while (true) {
31
+ const { done, value } = await reader.read();
32
+ if (done) break;
33
+
34
+ const chunk = decoder.decode(value, { stream: true });
35
+ fullText += chunk;
36
+ yield { content: [{ type: "text", text: fullText }] };
37
+ }
38
+ },
39
+ };
40
+ ```
41
+
42
+ ```tsx title="hooks/use-app-runtime.ts"
43
+ import AsyncStorage from "@react-native-async-storage/async-storage";
44
+ import { useLocalRuntime } from "@assistant-ui/react-native";
45
+ import { myChatAdapter } from "@/adapters/my-chat-adapter";
46
+
47
+ export function useAppRuntime() {
48
+ return useLocalRuntime(myChatAdapter, {
49
+ storage: AsyncStorage, // threads + messages persisted locally
50
+ });
51
+ }
52
+ ```
53
+
54
+ This gives you:
55
+
56
+ - Streaming chat responses from your API
57
+ - Local thread list with persistence (AsyncStorage)
58
+ - Message history saved across app restarts
59
+
60
+ ## Option 2: Full backend thread management
61
+
62
+ When you want your backend to own thread state (e.g. for cross-device sync, team sharing, or server-side history), implement a `RemoteThreadListAdapter`.
63
+
64
+ <Steps>
65
+ <Step>
66
+
67
+ ### Implement the adapter
68
+
69
+ ```tsx title="adapters/my-thread-list-adapter.ts"
70
+ import type { RemoteThreadListAdapter } from "@assistant-ui/react-native";
71
+ import { createAssistantStream } from "assistant-stream";
72
+
73
+ const API_BASE = "https://my-api.com";
74
+
75
+ export const myThreadListAdapter: RemoteThreadListAdapter = {
76
+ async list() {
77
+ const res = await fetch(`${API_BASE}/threads`);
78
+ const threads = await res.json();
79
+ return {
80
+ threads: threads.map((t: any) => ({
81
+ remoteId: t.id,
82
+ status: t.archived ? "archived" : "regular",
83
+ title: t.title,
84
+ })),
85
+ };
86
+ },
87
+
88
+ async initialize(localId) {
89
+ const res = await fetch(`${API_BASE}/threads`, {
90
+ method: "POST",
91
+ headers: { "Content-Type": "application/json" },
92
+ body: JSON.stringify({ localId }),
93
+ });
94
+ const { id } = await res.json();
95
+ return { remoteId: id, externalId: undefined };
96
+ },
97
+
98
+ async rename(remoteId, title) {
99
+ await fetch(`${API_BASE}/threads/${remoteId}`, {
100
+ method: "PATCH",
101
+ headers: { "Content-Type": "application/json" },
102
+ body: JSON.stringify({ title }),
103
+ });
104
+ },
105
+
106
+ async archive(remoteId) {
107
+ await fetch(`${API_BASE}/threads/${remoteId}/archive`, {
108
+ method: "POST",
109
+ });
110
+ },
111
+
112
+ async unarchive(remoteId) {
113
+ await fetch(`${API_BASE}/threads/${remoteId}/unarchive`, {
114
+ method: "POST",
115
+ });
116
+ },
117
+
118
+ async delete(remoteId) {
119
+ await fetch(`${API_BASE}/threads/${remoteId}`, { method: "DELETE" });
120
+ },
121
+
122
+ async fetch(remoteId) {
123
+ const res = await fetch(`${API_BASE}/threads/${remoteId}`);
124
+ const t = await res.json();
125
+ return {
126
+ remoteId: t.id,
127
+ status: t.archived ? "archived" : "regular",
128
+ title: t.title,
129
+ };
130
+ },
131
+
132
+ async generateTitle(remoteId, messages) {
133
+ return createAssistantStream(async (controller) => {
134
+ const res = await fetch(`${API_BASE}/threads/${remoteId}/title`, {
135
+ method: "POST",
136
+ headers: { "Content-Type": "application/json" },
137
+ body: JSON.stringify({ messages }),
138
+ });
139
+ const { title } = await res.json();
140
+ controller.appendText(title);
141
+ });
142
+ },
143
+ };
144
+ ```
145
+
146
+ </Step>
147
+ <Step>
148
+
149
+ ### Compose the runtime
150
+
151
+ ```tsx title="hooks/use-app-runtime.ts"
152
+ import {
153
+ useLocalRuntime,
154
+ useRemoteThreadListRuntime,
155
+ } from "@assistant-ui/react-native";
156
+ import { myChatAdapter } from "@/adapters/my-chat-adapter";
157
+ import { myThreadListAdapter } from "@/adapters/my-thread-list-adapter";
158
+
159
+ export function useAppRuntime() {
160
+ return useRemoteThreadListRuntime({
161
+ runtimeHook: () => useLocalRuntime(myChatAdapter),
162
+ adapter: myThreadListAdapter,
163
+ });
164
+ }
165
+ ```
166
+
167
+ </Step>
168
+ <Step>
169
+
170
+ ### Use in your app
171
+
172
+ ```tsx title="app/index.tsx"
173
+ import { AssistantProvider } from "@assistant-ui/react-native";
174
+ import { useAppRuntime } from "@/hooks/use-app-runtime";
175
+
176
+ export default function App() {
177
+ const runtime = useAppRuntime();
178
+ return (
179
+ <AssistantProvider runtime={runtime}>
180
+ {/* your chat UI */}
181
+ </AssistantProvider>
182
+ );
183
+ }
184
+ ```
185
+
186
+ </Step>
187
+ </Steps>
188
+
189
+ ## Adapter methods
190
+
191
+ | Method | Description |
192
+ |--------|-------------|
193
+ | `list()` | Return all threads on mount |
194
+ | `initialize(localId)` | Create a thread server-side, return `{ remoteId }` |
195
+ | `rename(remoteId, title)` | Persist title changes |
196
+ | `archive(remoteId)` | Mark thread as archived |
197
+ | `unarchive(remoteId)` | Restore archived thread |
198
+ | `delete(remoteId)` | Permanently remove thread |
199
+ | `fetch(remoteId)` | Fetch single thread metadata |
200
+ | `generateTitle(remoteId, messages)` | Return an `AssistantStream` with the generated title |
201
+
202
+ ## Which option to choose?
203
+
204
+ | | Option 1: ChatModelAdapter | Option 2: RemoteThreadListAdapter |
205
+ |---|---|---|
206
+ | **Thread storage** | On-device (AsyncStorage) | Your backend |
207
+ | **Message storage** | On-device (AsyncStorage) | On-device (can add history adapter for server-side) |
208
+ | **Cross-device sync** | No | Yes |
209
+ | **Setup complexity** | Minimal | Moderate |
210
+ | **Best for** | Single-device apps, prototypes | Production apps with user accounts |