@assistant-ui/mcp-docs-server 0.1.28 → 0.1.29

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 (36) hide show
  1. package/.docs/organized/code-examples/waterfall.md +6 -6
  2. package/.docs/organized/code-examples/with-a2a.md +7 -7
  3. package/.docs/organized/code-examples/with-ag-ui.md +8 -8
  4. package/.docs/organized/code-examples/with-ai-sdk-v6.md +9 -9
  5. package/.docs/organized/code-examples/with-artifacts.md +9 -9
  6. package/.docs/organized/code-examples/with-assistant-transport.md +7 -7
  7. package/.docs/organized/code-examples/with-chain-of-thought.md +9 -9
  8. package/.docs/organized/code-examples/with-cloud-standalone.md +9 -9
  9. package/.docs/organized/code-examples/with-cloud.md +9 -9
  10. package/.docs/organized/code-examples/with-custom-thread-list.md +9 -9
  11. package/.docs/organized/code-examples/with-elevenlabs-conversational.md +11 -11
  12. package/.docs/organized/code-examples/with-elevenlabs-scribe.md +11 -11
  13. package/.docs/organized/code-examples/with-expo.md +17 -17
  14. package/.docs/organized/code-examples/with-external-store.md +7 -7
  15. package/.docs/organized/code-examples/with-ffmpeg.md +9 -9
  16. package/.docs/organized/code-examples/with-generative-ui.md +9 -9
  17. package/.docs/organized/code-examples/with-google-adk.md +7 -7
  18. package/.docs/organized/code-examples/with-heat-graph.md +6 -6
  19. package/.docs/organized/code-examples/with-interactables.md +9 -9
  20. package/.docs/organized/code-examples/with-langgraph.md +8 -8
  21. package/.docs/organized/code-examples/with-livekit.md +50 -14
  22. package/.docs/organized/code-examples/with-opencode.md +2394 -0
  23. package/.docs/organized/code-examples/with-parent-id-grouping.md +8 -8
  24. package/.docs/organized/code-examples/with-react-hook-form.md +9 -9
  25. package/.docs/organized/code-examples/with-react-ink.md +3 -3
  26. package/.docs/organized/code-examples/with-react-router.md +8 -8
  27. package/.docs/organized/code-examples/with-store.md +6 -6
  28. package/.docs/organized/code-examples/with-tanstack.md +10 -10
  29. package/.docs/organized/code-examples/with-tap-runtime.md +7 -7
  30. package/.docs/raw/docs/(docs)/guides/voice.mdx +10 -3
  31. package/.docs/raw/docs/runtimes/custom/custom-thread-list.mdx +2 -2
  32. package/.docs/raw/docs/runtimes/custom/external-store.mdx +38 -0
  33. package/.docs/raw/docs/runtimes/custom/local.mdx +65 -18
  34. package/.docs/raw/docs/runtimes/google-adk/index.mdx +62 -0
  35. package/.docs/raw/docs/runtimes/langgraph/index.mdx +137 -1
  36. package/package.json +4 -4
@@ -178,7 +178,10 @@ export const sendMessage = async (params: {
178
178
  ? { messages: params.messages }
179
179
  : null,
180
180
  command: params.command,
181
- streamMode: ["messages", "updates"],
181
+ // Include "custom" if you use LangSmith Generative UI
182
+ // (`push_ui_message` / `typedUi().push()`). See the Generative UI
183
+ // section below for details.
184
+ streamMode: ["messages", "updates", "custom"],
182
185
  },
183
186
  );
184
187
  };
@@ -469,3 +472,136 @@ LangGraph supports interrupting the execution flow to request user input or hand
469
472
  3. The runtime will automatically restore the interrupt state when switching threads
470
473
 
471
474
  This feature is particularly useful for applications that require user approval flows, multi-step forms, or any other interactive elements that might span multiple thread switches.
475
+
476
+ ## Generative UI (`ui_message`)
477
+
478
+ LangGraph's [Generative UI](https://docs.langchain.com/langsmith/generative-ui-react) lets your graph emit structured UI components alongside assistant messages via `push_ui_message` (Python) or `typedUi().push()` (TypeScript). The assistant-ui LangGraph adapter translates these into [`DataMessagePart`s](/docs/guides/tool-ui) on the associated assistant message, which you render with the existing `makeAssistantDataUI` API.
479
+
480
+ ### Enable the `custom` stream mode
481
+
482
+ UI messages are emitted through LangGraph's `custom` stream channel. Make sure your `sendMessage` helper includes `"custom"` in `streamMode`:
483
+
484
+ ```ts
485
+ streamMode: ["messages", "updates", "custom"]
486
+ ```
487
+
488
+ Alternatively, if your graph accumulates UI messages in state under the `ui` key (the default for `typedUi`), `"values"` also works — the adapter reads both paths.
489
+
490
+ ### Custom state key
491
+
492
+ If your graph uses a non-default `stateKey` with `typedUi(config, { stateKey: "my_ui" })` on the server, pass the matching `uiStateKey` option to `useLangGraphRuntime` on the client:
493
+
494
+ ```ts
495
+ const runtime = useLangGraphRuntime({
496
+ stream: async function* (messages, { initialize }) { /* ... */ },
497
+ uiStateKey: "my_ui",
498
+ });
499
+ ```
500
+
501
+ This only affects the `values` stream path — the `custom` channel carries each UI event individually and doesn't rely on the state key.
502
+
503
+ ### Emit a UI message from your graph
504
+
505
+ ```python title="Python"
506
+ from langgraph.graph.ui import push_ui_message
507
+ from langchain_core.messages import AIMessage
508
+
509
+ async def chart_node(state, config):
510
+ message = AIMessage(id="msg-1", content="Here's your chart.")
511
+ push_ui_message(
512
+ "chart",
513
+ {"series": [1, 2, 3], "title": "Sales"},
514
+ message=message, # Links the UI to this AI message
515
+ )
516
+ return {"messages": [message]}
517
+ ```
518
+
519
+ ```ts title="TypeScript"
520
+ import { typedUi } from "@langchain/langgraph-sdk/react-ui/server";
521
+ import type { ComponentRegistry } from "./components";
522
+
523
+ export async function chartNode(state, config) {
524
+ const ui = typedUi<ComponentRegistry>(config);
525
+ const message = { id: "msg-1", type: "ai", content: "Here's your chart." };
526
+ ui.push(
527
+ { name: "chart", props: { series: [1, 2, 3], title: "Sales" } },
528
+ { message },
529
+ );
530
+ return { messages: [message] };
531
+ }
532
+ ```
533
+
534
+ Passing `message` (Python) or `{ message }` (TypeScript) is what links the UI component to a specific assistant message — the adapter reads `metadata.message_id` to attach the generated `DataMessagePart` to the correct message in the thread.
535
+
536
+ ### Register a renderer on the client
537
+
538
+ ```tsx title="@/components/ChartUI.tsx"
539
+ import { makeAssistantDataUI } from "@assistant-ui/react";
540
+
541
+ type ChartProps = {
542
+ series: number[];
543
+ title: string;
544
+ };
545
+
546
+ export const ChartUI = makeAssistantDataUI<ChartProps>({
547
+ name: "chart",
548
+ render: ({ data }) => (
549
+ <div>
550
+ <h3>{data.title}</h3>
551
+ <Chart series={data.series} />
552
+ </div>
553
+ ),
554
+ });
555
+ ```
556
+
557
+ Mount the component once somewhere inside the `AssistantRuntimeProvider` tree. It renders nothing itself — it only registers the renderer:
558
+
559
+ ```tsx title="@/components/MyAssistant.tsx"
560
+ <AssistantRuntimeProvider runtime={runtime}>
561
+ <ChartUI />
562
+ <Thread />
563
+ </AssistantRuntimeProvider>
564
+ ```
565
+
566
+ When a matching UI message arrives, the adapter appends a `{ type: "data", name: "chart", data: { series, title } }` part to the parent assistant message and the registered component renders inline.
567
+
568
+ ### Semantics
569
+
570
+ The adapter mirrors the reducer in `@langchain/langgraph-sdk/react-ui` exactly:
571
+
572
+ - UI messages are keyed by their own `id`. Pushing the same id again **replaces** the existing entry
573
+ - Passing `metadata: { merge: true }` shallow-merges `props` onto the previous entry
574
+ - Emitting `{ type: "remove-ui", id }` (via `delete_ui_message` / `ui.delete(id)`) removes the entry
575
+ - UI messages without `metadata.message_id` are held in the runtime but not injected into any message; use `useLangGraphUIMessages()` to access the raw list if needed
576
+
577
+ ### Restore persisted UI messages on thread switch
578
+
579
+ If your graph persists UI messages in state via `typedUi`, return them from the `load` callback so they're restored when the user switches threads or refreshes the page:
580
+
581
+ ```tsx
582
+ const runtime = useLangGraphRuntime({
583
+ stream: async function* (messages, { initialize }) { /* ... */ },
584
+ load: async (externalId) => {
585
+ const state = await getThreadState(externalId);
586
+ return {
587
+ messages: state.values.messages,
588
+ uiMessages: state.values.ui,
589
+ interrupts: state.tasks[0]?.interrupts,
590
+ };
591
+ },
592
+ });
593
+ ```
594
+
595
+ Without this, each reload starts with an empty UI list even though the messages themselves are loaded.
596
+
597
+ ### Escape hatch: `useLangGraphUIMessages`
598
+
599
+ ```tsx
600
+ import { useLangGraphUIMessages } from "@assistant-ui/react-langgraph";
601
+
602
+ function Sidebar() {
603
+ const uiMessages = useLangGraphUIMessages();
604
+ // Filter, group, or render UI messages outside the thread
605
+ return <>{uiMessages.map(/* ... */)}</>;
606
+ }
607
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@assistant-ui/mcp-docs-server",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "MCP server for assistant-ui documentation and examples",
5
5
  "keywords": [
6
6
  "mcp",
@@ -37,10 +37,10 @@
37
37
  "zod": "^4.3.6"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/node": "^25.5.2",
40
+ "@types/node": "^25.6.0",
41
41
  "tsx": "^4.21.0",
42
- "vitest": "^4.1.2",
43
- "@assistant-ui/x-buildutils": "0.0.4"
42
+ "vitest": "^4.1.4",
43
+ "@assistant-ui/x-buildutils": "0.0.5"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public",