@seed-ship/mcp-ui-solid 5.2.0 → 5.3.0

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 (38) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/components/ElicitationForm.cjs +51 -0
  3. package/dist/components/ElicitationForm.cjs.map +1 -0
  4. package/dist/components/ElicitationForm.d.ts +68 -0
  5. package/dist/components/ElicitationForm.d.ts.map +1 -0
  6. package/dist/components/ElicitationForm.js +51 -0
  7. package/dist/components/ElicitationForm.js.map +1 -0
  8. package/dist/components/index.d.ts +2 -0
  9. package/dist/components/index.d.ts.map +1 -1
  10. package/dist/components.cjs +2 -0
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +2 -0
  13. package/dist/components.d.ts +2 -0
  14. package/dist/components.js +2 -0
  15. package/dist/components.js.map +1 -1
  16. package/dist/index.cjs +8 -0
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +4 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +8 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/stores/server-capabilities-store.cjs +61 -0
  24. package/dist/stores/server-capabilities-store.cjs.map +1 -0
  25. package/dist/stores/server-capabilities-store.d.ts +172 -0
  26. package/dist/stores/server-capabilities-store.d.ts.map +1 -0
  27. package/dist/stores/server-capabilities-store.js +61 -0
  28. package/dist/stores/server-capabilities-store.js.map +1 -0
  29. package/docs/recipes/elicitation-pseudo-spec-adapter.md +171 -0
  30. package/docs/recipes/feedback-inline-wiring.md +142 -0
  31. package/package.json +1 -1
  32. package/src/components/ElicitationForm.test.tsx +197 -0
  33. package/src/components/ElicitationForm.tsx +126 -0
  34. package/src/components/index.ts +4 -0
  35. package/src/index.ts +16 -0
  36. package/src/stores/server-capabilities-store.test.tsx +206 -0
  37. package/src/stores/server-capabilities-store.tsx +215 -0
  38. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,49 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [5.3.0] - 2026-04-22
9
+
10
+ ### Added — A. `<ElicitationForm>` schema-driven renderer
11
+
12
+ - **`<ElicitationForm event onAccept onCancel? onDecline? dismissLabel?>`** — thin wrapper over `<ChatPrompt>` + `elicitationToPromptConfig()` that accepts a spec-shaped `ElicitationEvent` (MCP 2025-06-18) and exposes a spec-shaped `onAccept(content)` callback whose payload is ready to send back as the `accept` outcome of an `elicitation/create` reply.
13
+ - Inverse mapping owned here : single boolean → `{ propName: true }`, single enum → `{ propName: enumValue }` (numeric coerced when schema is `integer`/`number`), multi-property form → values map passed through unchanged.
14
+ - Forward mapping (spec → ChatPromptConfig) reuses the existing `elicitationToPromptConfig` helper from v5.2.0 — same rules, same tests, no duplication.
15
+ - `dismissLabel="Decline"` + `onDecline` lets you surface an explicit decline action distinct from passive cancel.
16
+ - Type export : `ElicitationFormProps`.
17
+
18
+ ### Added — B. `useServerCapabilities()` hook + store
19
+
20
+ - **`createServerCapabilitiesStore()`** factory + module singleton + **`<ServerCapabilitiesProvider>`** for multi-instance scoping (mirrors the v5.2.0 `scratchpad-store` pattern).
21
+ - **`setServerCapabilities(info)`** — push the parsed MCP `initialize` response into the singleton from your transport adapter.
22
+ - **`useServerCapabilities()`** — reactive accessor returning `{ info, capabilities, serverInfo, protocolVersion, hasCapability }`. Components can gate rendering on advertised capabilities (e.g. `<Show when={hasCapability('tools')}>`).
23
+ - Type exports : `ServerCapabilities`, `ServerInitializeInfo`, `ServerCapabilitiesStoreHandle`.
24
+ - Note : `elicitation` is a **client** capability per MCP spec 2025-06-18 — this store tracks **server** capabilities only. Gate `<ElicitationForm>` on your own client-side state, not on this store.
25
+
26
+ ### Added — C. Recipe : pseudo-elicit → spec adapter
27
+
28
+ - New doc `docs/recipes/elicitation-pseudo-spec-adapter.md` — drop-in TypeScript adapter for consumer apps talking to MCP servers that ship a legacy "pseudo-elicit" payload inline with `tools/call` results (e.g. deposium_MCPs as of 2026-04). Adapter lives in the consumer app — mcp-ui stays vendor-agnostic by design.
29
+
30
+ ### Added — D. Recipe : `<FeedbackInline>` wiring
31
+
32
+ - New doc `docs/recipes/feedback-inline-wiring.md` — concrete pattern for wiring `<FeedbackInline>.onSubmit` to a feedback HTTP endpoint, with the Deposium `POST /api/feedback` shape as a worked example. Mapping `'positive' | 'negative'` to the endpoint is direct.
33
+
34
+ ### Tests
35
+
36
+ - New file : `components/ElicitationForm.test.tsx` (7 tests) — covers boolean/enum/numeric/multi-property accept paths, X-dismiss, confirm-cancel button, and `onDecline` precedence.
37
+ - New file : `stores/server-capabilities-store.test.tsx` (10 tests) — factory isolation, derived accessors, singleton fallback, provider scoping, reactive update propagation.
38
+
39
+ ### Non-breaking
40
+
41
+ - All additions are optional and additive. v5.2.0 consumers upgrade with zero code changes.
42
+
43
+ ### Aligned with deposium_MCPs
44
+
45
+ - v5.3.0 closes the items in mcp-ui's court per the `mcp-ui ↔ deposium_MCPs alignment 2026-04-22` doc :
46
+ - Plan B B.3.5 unblock acknowledged (HTTP transport now bidirectional via SDK `StreamableHTTPServerTransport`).
47
+ - Pseudo-elicit confirmed as stable legacy ; consumer-side adapter pattern now documented.
48
+ - Feedback endpoint `POST /api/feedback` wire shape documented.
49
+ - `<ElicitationForm>` and `useServerCapabilities()` deferred items shipped.
50
+
8
51
  ## [5.2.0] - 2026-04-22
9
52
 
10
53
  ### Added — D1 multi-instance scratchpad store
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const web = require("solid-js/web");
4
+ const ChatPrompt = require("./ChatPrompt.cjs");
5
+ const chatBus = require("../services/chat-bus.cjs");
6
+ const ElicitationForm = (props) => {
7
+ const config = () => chatBus.elicitationToPromptConfig(props.event);
8
+ const handleSubmit = (response) => {
9
+ var _a;
10
+ if (response.dismissed) {
11
+ (_a = props.onDecline ?? props.onCancel) == null ? void 0 : _a();
12
+ return;
13
+ }
14
+ props.onAccept(extractContent(response, props.event));
15
+ };
16
+ return web.createComponent(ChatPrompt.ChatPrompt, {
17
+ get config() {
18
+ return config();
19
+ },
20
+ get dismissLabel() {
21
+ return props.dismissLabel;
22
+ },
23
+ onSubmit: handleSubmit
24
+ });
25
+ };
26
+ function extractContent(response, event) {
27
+ if (typeof response.value !== "string") {
28
+ return response.value;
29
+ }
30
+ const propEntries = Object.entries(event.requestedSchema.properties);
31
+ if (propEntries.length === 1) {
32
+ const [name, schema] = propEntries[0];
33
+ return {
34
+ [name]: coerceScalar(response.value, schema)
35
+ };
36
+ }
37
+ console.warn("[MCP-UI] ElicitationForm: received string value for multi-property schema. Falling back to _value.");
38
+ return {
39
+ _value: response.value
40
+ };
41
+ }
42
+ function coerceScalar(value, schema) {
43
+ if (schema.type === "boolean") return true;
44
+ if (schema.type === "number" || schema.type === "integer") {
45
+ const n = Number(value);
46
+ return Number.isFinite(n) ? n : value;
47
+ }
48
+ return value;
49
+ }
50
+ exports.ElicitationForm = ElicitationForm;
51
+ //# sourceMappingURL=ElicitationForm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElicitationForm.cjs","sources":["../../src/components/ElicitationForm.tsx"],"sourcesContent":["/**\n * ElicitationForm — schema-driven renderer for MCP `elicitation/create` requests\n *\n * @experimental\n * @since v5.3.0\n *\n * Thin wrapper over `<ChatPrompt>` + `elicitationToPromptConfig()` that\n * accepts a spec-shaped `ElicitationEvent` (MCP 2025-06-18) and exposes a\n * spec-shaped `onAccept(content)` callback whose payload is ready to send\n * back as the `accept` outcome of an `elicitation/create` reply.\n *\n * The mapping (boolean → confirm, single enum ≤4 → choice, else → form) is\n * delegated to the `elicitationToPromptConfig` helper — same rules, same\n * tests. This component owns the inverse mapping : extracting a spec-shaped\n * `Record<string, unknown>` from the `ChatPromptResponse`.\n *\n * ## Outcome semantics (per MCP spec 2025-06-18)\n *\n * | User action | Callback fired | Payload |\n * |---------------------------------------|--------------------|----------------------------------|\n * | Submit form / pick choice / confirm | `onAccept(content)`| `{ [propName]: value, ... }` |\n * | X icon / Cancel button | `onCancel()` *or* `onDecline()` if provided | none |\n *\n * mcp-ui's `<ChatPrompt>` does not natively distinguish \"decline\" (explicit\n * refusal) from \"cancel\" (passive close). To surface a decline action,\n * pass `dismissLabel=\"Decline\"` and route the callback via `onDecline`.\n *\n * @example\n * ```tsx\n * bus.events.on('onElicitation', ({ elicitation }) => {\n * render(() => (\n * <ElicitationForm\n * event={elicitation}\n * onAccept={(content) => sendElicitationReply({ action: 'accept', content })}\n * onCancel={() => sendElicitationReply({ action: 'cancel' })}\n * />\n * ), mountPoint)\n * })\n * ```\n */\n\nimport { Component } from 'solid-js'\nimport { ChatPrompt } from './ChatPrompt'\nimport { elicitationToPromptConfig } from '../services/chat-bus'\nimport type {\n ChatPromptResponse,\n ElicitationEvent,\n ElicitationPropertySchema,\n} from '../types/chat-bus'\n\nexport interface ElicitationFormProps {\n /** MCP `elicitation/create` request payload to render. */\n event: ElicitationEvent\n /**\n * Called when user submits a valid response. `content` is keyed by the\n * elicitation `requestedSchema.properties` names — ready to send back as\n * the `accept` outcome of an `elicitation/create` reply.\n */\n onAccept: (content: Record<string, unknown>) => void\n /** Called when user dismisses (X icon, confirm-cancel button). */\n onCancel?: () => void\n /**\n * Optional explicit decline action. When provided, takes precedence over\n * `onCancel` on dismiss. Pair with `dismissLabel=\"Decline\"` to surface as\n * a decline action in the UI.\n */\n onDecline?: () => void\n /** Label on the dismiss button (default: X icon). */\n dismissLabel?: string\n}\n\n/**\n * @experimental\n * Schema-driven renderer for MCP `elicitation/create` requests.\n */\nexport const ElicitationForm: Component<ElicitationFormProps> = (props) => {\n const config = () => elicitationToPromptConfig(props.event)\n\n const handleSubmit = (response: ChatPromptResponse): void => {\n if (response.dismissed) {\n ;(props.onDecline ?? props.onCancel)?.()\n return\n }\n props.onAccept(extractContent(response, props.event))\n }\n\n return <ChatPrompt config={config()} dismissLabel={props.dismissLabel} onSubmit={handleSubmit} />\n}\n\nfunction extractContent(\n response: ChatPromptResponse,\n event: ElicitationEvent\n): Record<string, unknown> {\n // Form: response.value is already a Record keyed by property names.\n if (typeof response.value !== 'string') {\n return response.value\n }\n\n const propEntries = Object.entries(event.requestedSchema.properties)\n\n // Single-property cases (boolean confirm or single enum choice).\n if (propEntries.length === 1) {\n const [name, schema] = propEntries[0]\n return { [name]: coerceScalar(response.value, schema) }\n }\n\n // Multi-property string response — shouldn't happen since the helper\n // routes multi-prop schemas to 'form'. Fall back gracefully.\n console.warn(\n '[MCP-UI] ElicitationForm: received string value for multi-property schema. Falling back to _value.'\n )\n return { _value: response.value }\n}\n\nfunction coerceScalar(value: string, schema: ElicitationPropertySchema): unknown {\n // Confirm always emits the literal 'confirmed' on accept (cancel path is\n // trapped earlier by `dismissed: true`). Map to boolean true.\n if (schema.type === 'boolean') return true\n\n if (schema.type === 'number' || schema.type === 'integer') {\n const n = Number(value)\n return Number.isFinite(n) ? n : value\n }\n\n return value\n}\n"],"names":["ElicitationForm","props","config","elicitationToPromptConfig","event","handleSubmit","response","dismissed","onDecline","onCancel","onAccept","extractContent","_$createComponent","ChatPrompt","dismissLabel","onSubmit","value","propEntries","Object","entries","requestedSchema","properties","length","name","schema","coerceScalar","console","warn","_value","type","n","Number","isFinite"],"mappings":";;;;;AA2EO,MAAMA,kBAAoDC,CAAAA,UAAU;AACzE,QAAMC,SAASA,MAAMC,kCAA0BF,MAAMG,KAAK;AAE1D,QAAMC,eAAeA,CAACC,aAAuC;;AAC3D,QAAIA,SAASC,WAAW;AACrB,OAACN,WAAMO,aAAaP,MAAMQ,aAAzBR;AACF;AAAA,IACF;AACAA,UAAMS,SAASC,eAAeL,UAAUL,MAAMG,KAAK,CAAC;AAAA,EACtD;AAEA,SAAAQ,IAAAA,gBAAQC,WAAAA,YAAU;AAAA,IAAA,IAACX,SAAM;AAAA,aAAEA,OAAAA;AAAAA,IAAQ;AAAA,IAAA,IAAEY,eAAY;AAAA,aAAEb,MAAMa;AAAAA,IAAY;AAAA,IAAEC,UAAUV;AAAAA,EAAAA,CAAY;AAC/F;AAEA,SAASM,eACPL,UACAF,OACyB;AAEzB,MAAI,OAAOE,SAASU,UAAU,UAAU;AACtC,WAAOV,SAASU;AAAAA,EAClB;AAEA,QAAMC,cAAcC,OAAOC,QAAQf,MAAMgB,gBAAgBC,UAAU;AAGnE,MAAIJ,YAAYK,WAAW,GAAG;AAC5B,UAAM,CAACC,MAAMC,MAAM,IAAIP,YAAY,CAAC;AACpC,WAAO;AAAA,MAAE,CAACM,IAAI,GAAGE,aAAanB,SAASU,OAAOQ,MAAM;AAAA,IAAA;AAAA,EACtD;AAIAE,UAAQC,KACN,oGACF;AACA,SAAO;AAAA,IAAEC,QAAQtB,SAASU;AAAAA,EAAAA;AAC5B;AAEA,SAASS,aAAaT,OAAeQ,QAA4C;AAG/E,MAAIA,OAAOK,SAAS,UAAW,QAAO;AAEtC,MAAIL,OAAOK,SAAS,YAAYL,OAAOK,SAAS,WAAW;AACzD,UAAMC,IAAIC,OAAOf,KAAK;AACtB,WAAOe,OAAOC,SAASF,CAAC,IAAIA,IAAId;AAAAA,EAClC;AAEA,SAAOA;AACT;;"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * ElicitationForm — schema-driven renderer for MCP `elicitation/create` requests
3
+ *
4
+ * @experimental
5
+ * @since v5.3.0
6
+ *
7
+ * Thin wrapper over `<ChatPrompt>` + `elicitationToPromptConfig()` that
8
+ * accepts a spec-shaped `ElicitationEvent` (MCP 2025-06-18) and exposes a
9
+ * spec-shaped `onAccept(content)` callback whose payload is ready to send
10
+ * back as the `accept` outcome of an `elicitation/create` reply.
11
+ *
12
+ * The mapping (boolean → confirm, single enum ≤4 → choice, else → form) is
13
+ * delegated to the `elicitationToPromptConfig` helper — same rules, same
14
+ * tests. This component owns the inverse mapping : extracting a spec-shaped
15
+ * `Record<string, unknown>` from the `ChatPromptResponse`.
16
+ *
17
+ * ## Outcome semantics (per MCP spec 2025-06-18)
18
+ *
19
+ * | User action | Callback fired | Payload |
20
+ * |---------------------------------------|--------------------|----------------------------------|
21
+ * | Submit form / pick choice / confirm | `onAccept(content)`| `{ [propName]: value, ... }` |
22
+ * | X icon / Cancel button | `onCancel()` *or* `onDecline()` if provided | none |
23
+ *
24
+ * mcp-ui's `<ChatPrompt>` does not natively distinguish "decline" (explicit
25
+ * refusal) from "cancel" (passive close). To surface a decline action,
26
+ * pass `dismissLabel="Decline"` and route the callback via `onDecline`.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * bus.events.on('onElicitation', ({ elicitation }) => {
31
+ * render(() => (
32
+ * <ElicitationForm
33
+ * event={elicitation}
34
+ * onAccept={(content) => sendElicitationReply({ action: 'accept', content })}
35
+ * onCancel={() => sendElicitationReply({ action: 'cancel' })}
36
+ * />
37
+ * ), mountPoint)
38
+ * })
39
+ * ```
40
+ */
41
+ import { Component } from 'solid-js';
42
+ import type { ElicitationEvent } from '../types/chat-bus';
43
+ export interface ElicitationFormProps {
44
+ /** MCP `elicitation/create` request payload to render. */
45
+ event: ElicitationEvent;
46
+ /**
47
+ * Called when user submits a valid response. `content` is keyed by the
48
+ * elicitation `requestedSchema.properties` names — ready to send back as
49
+ * the `accept` outcome of an `elicitation/create` reply.
50
+ */
51
+ onAccept: (content: Record<string, unknown>) => void;
52
+ /** Called when user dismisses (X icon, confirm-cancel button). */
53
+ onCancel?: () => void;
54
+ /**
55
+ * Optional explicit decline action. When provided, takes precedence over
56
+ * `onCancel` on dismiss. Pair with `dismissLabel="Decline"` to surface as
57
+ * a decline action in the UI.
58
+ */
59
+ onDecline?: () => void;
60
+ /** Label on the dismiss button (default: X icon). */
61
+ dismissLabel?: string;
62
+ }
63
+ /**
64
+ * @experimental
65
+ * Schema-driven renderer for MCP `elicitation/create` requests.
66
+ */
67
+ export declare const ElicitationForm: Component<ElicitationFormProps>;
68
+ //# sourceMappingURL=ElicitationForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElicitationForm.d.ts","sourceRoot":"","sources":["../../src/components/ElicitationForm.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,KAAK,EAAE,gBAAgB,CAAA;IACvB;;;;OAIG;IACH,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACpD,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,oBAAoB,CAY3D,CAAA"}
@@ -0,0 +1,51 @@
1
+ import { createComponent } from "solid-js/web";
2
+ import { ChatPrompt } from "./ChatPrompt.js";
3
+ import { elicitationToPromptConfig } from "../services/chat-bus.js";
4
+ const ElicitationForm = (props) => {
5
+ const config = () => elicitationToPromptConfig(props.event);
6
+ const handleSubmit = (response) => {
7
+ var _a;
8
+ if (response.dismissed) {
9
+ (_a = props.onDecline ?? props.onCancel) == null ? void 0 : _a();
10
+ return;
11
+ }
12
+ props.onAccept(extractContent(response, props.event));
13
+ };
14
+ return createComponent(ChatPrompt, {
15
+ get config() {
16
+ return config();
17
+ },
18
+ get dismissLabel() {
19
+ return props.dismissLabel;
20
+ },
21
+ onSubmit: handleSubmit
22
+ });
23
+ };
24
+ function extractContent(response, event) {
25
+ if (typeof response.value !== "string") {
26
+ return response.value;
27
+ }
28
+ const propEntries = Object.entries(event.requestedSchema.properties);
29
+ if (propEntries.length === 1) {
30
+ const [name, schema] = propEntries[0];
31
+ return {
32
+ [name]: coerceScalar(response.value, schema)
33
+ };
34
+ }
35
+ console.warn("[MCP-UI] ElicitationForm: received string value for multi-property schema. Falling back to _value.");
36
+ return {
37
+ _value: response.value
38
+ };
39
+ }
40
+ function coerceScalar(value, schema) {
41
+ if (schema.type === "boolean") return true;
42
+ if (schema.type === "number" || schema.type === "integer") {
43
+ const n = Number(value);
44
+ return Number.isFinite(n) ? n : value;
45
+ }
46
+ return value;
47
+ }
48
+ export {
49
+ ElicitationForm
50
+ };
51
+ //# sourceMappingURL=ElicitationForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ElicitationForm.js","sources":["../../src/components/ElicitationForm.tsx"],"sourcesContent":["/**\n * ElicitationForm — schema-driven renderer for MCP `elicitation/create` requests\n *\n * @experimental\n * @since v5.3.0\n *\n * Thin wrapper over `<ChatPrompt>` + `elicitationToPromptConfig()` that\n * accepts a spec-shaped `ElicitationEvent` (MCP 2025-06-18) and exposes a\n * spec-shaped `onAccept(content)` callback whose payload is ready to send\n * back as the `accept` outcome of an `elicitation/create` reply.\n *\n * The mapping (boolean → confirm, single enum ≤4 → choice, else → form) is\n * delegated to the `elicitationToPromptConfig` helper — same rules, same\n * tests. This component owns the inverse mapping : extracting a spec-shaped\n * `Record<string, unknown>` from the `ChatPromptResponse`.\n *\n * ## Outcome semantics (per MCP spec 2025-06-18)\n *\n * | User action | Callback fired | Payload |\n * |---------------------------------------|--------------------|----------------------------------|\n * | Submit form / pick choice / confirm | `onAccept(content)`| `{ [propName]: value, ... }` |\n * | X icon / Cancel button | `onCancel()` *or* `onDecline()` if provided | none |\n *\n * mcp-ui's `<ChatPrompt>` does not natively distinguish \"decline\" (explicit\n * refusal) from \"cancel\" (passive close). To surface a decline action,\n * pass `dismissLabel=\"Decline\"` and route the callback via `onDecline`.\n *\n * @example\n * ```tsx\n * bus.events.on('onElicitation', ({ elicitation }) => {\n * render(() => (\n * <ElicitationForm\n * event={elicitation}\n * onAccept={(content) => sendElicitationReply({ action: 'accept', content })}\n * onCancel={() => sendElicitationReply({ action: 'cancel' })}\n * />\n * ), mountPoint)\n * })\n * ```\n */\n\nimport { Component } from 'solid-js'\nimport { ChatPrompt } from './ChatPrompt'\nimport { elicitationToPromptConfig } from '../services/chat-bus'\nimport type {\n ChatPromptResponse,\n ElicitationEvent,\n ElicitationPropertySchema,\n} from '../types/chat-bus'\n\nexport interface ElicitationFormProps {\n /** MCP `elicitation/create` request payload to render. */\n event: ElicitationEvent\n /**\n * Called when user submits a valid response. `content` is keyed by the\n * elicitation `requestedSchema.properties` names — ready to send back as\n * the `accept` outcome of an `elicitation/create` reply.\n */\n onAccept: (content: Record<string, unknown>) => void\n /** Called when user dismisses (X icon, confirm-cancel button). */\n onCancel?: () => void\n /**\n * Optional explicit decline action. When provided, takes precedence over\n * `onCancel` on dismiss. Pair with `dismissLabel=\"Decline\"` to surface as\n * a decline action in the UI.\n */\n onDecline?: () => void\n /** Label on the dismiss button (default: X icon). */\n dismissLabel?: string\n}\n\n/**\n * @experimental\n * Schema-driven renderer for MCP `elicitation/create` requests.\n */\nexport const ElicitationForm: Component<ElicitationFormProps> = (props) => {\n const config = () => elicitationToPromptConfig(props.event)\n\n const handleSubmit = (response: ChatPromptResponse): void => {\n if (response.dismissed) {\n ;(props.onDecline ?? props.onCancel)?.()\n return\n }\n props.onAccept(extractContent(response, props.event))\n }\n\n return <ChatPrompt config={config()} dismissLabel={props.dismissLabel} onSubmit={handleSubmit} />\n}\n\nfunction extractContent(\n response: ChatPromptResponse,\n event: ElicitationEvent\n): Record<string, unknown> {\n // Form: response.value is already a Record keyed by property names.\n if (typeof response.value !== 'string') {\n return response.value\n }\n\n const propEntries = Object.entries(event.requestedSchema.properties)\n\n // Single-property cases (boolean confirm or single enum choice).\n if (propEntries.length === 1) {\n const [name, schema] = propEntries[0]\n return { [name]: coerceScalar(response.value, schema) }\n }\n\n // Multi-property string response — shouldn't happen since the helper\n // routes multi-prop schemas to 'form'. Fall back gracefully.\n console.warn(\n '[MCP-UI] ElicitationForm: received string value for multi-property schema. Falling back to _value.'\n )\n return { _value: response.value }\n}\n\nfunction coerceScalar(value: string, schema: ElicitationPropertySchema): unknown {\n // Confirm always emits the literal 'confirmed' on accept (cancel path is\n // trapped earlier by `dismissed: true`). Map to boolean true.\n if (schema.type === 'boolean') return true\n\n if (schema.type === 'number' || schema.type === 'integer') {\n const n = Number(value)\n return Number.isFinite(n) ? n : value\n }\n\n return value\n}\n"],"names":["ElicitationForm","props","config","elicitationToPromptConfig","event","handleSubmit","response","dismissed","onDecline","onCancel","onAccept","extractContent","_$createComponent","ChatPrompt","dismissLabel","onSubmit","value","propEntries","Object","entries","requestedSchema","properties","length","name","schema","coerceScalar","console","warn","_value","type","n","Number","isFinite"],"mappings":";;;AA2EO,MAAMA,kBAAoDC,CAAAA,UAAU;AACzE,QAAMC,SAASA,MAAMC,0BAA0BF,MAAMG,KAAK;AAE1D,QAAMC,eAAeA,CAACC,aAAuC;;AAC3D,QAAIA,SAASC,WAAW;AACrB,OAACN,WAAMO,aAAaP,MAAMQ,aAAzBR;AACF;AAAA,IACF;AACAA,UAAMS,SAASC,eAAeL,UAAUL,MAAMG,KAAK,CAAC;AAAA,EACtD;AAEA,SAAAQ,gBAAQC,YAAU;AAAA,IAAA,IAACX,SAAM;AAAA,aAAEA,OAAAA;AAAAA,IAAQ;AAAA,IAAA,IAAEY,eAAY;AAAA,aAAEb,MAAMa;AAAAA,IAAY;AAAA,IAAEC,UAAUV;AAAAA,EAAAA,CAAY;AAC/F;AAEA,SAASM,eACPL,UACAF,OACyB;AAEzB,MAAI,OAAOE,SAASU,UAAU,UAAU;AACtC,WAAOV,SAASU;AAAAA,EAClB;AAEA,QAAMC,cAAcC,OAAOC,QAAQf,MAAMgB,gBAAgBC,UAAU;AAGnE,MAAIJ,YAAYK,WAAW,GAAG;AAC5B,UAAM,CAACC,MAAMC,MAAM,IAAIP,YAAY,CAAC;AACpC,WAAO;AAAA,MAAE,CAACM,IAAI,GAAGE,aAAanB,SAASU,OAAOQ,MAAM;AAAA,IAAA;AAAA,EACtD;AAIAE,UAAQC,KACN,oGACF;AACA,SAAO;AAAA,IAAEC,QAAQtB,SAASU;AAAAA,EAAAA;AAC5B;AAEA,SAASS,aAAaT,OAAeQ,QAA4C;AAG/E,MAAIA,OAAOK,SAAS,UAAW,QAAO;AAEtC,MAAIL,OAAOK,SAAS,YAAYL,OAAOK,SAAS,WAAW;AACzD,UAAMC,IAAIC,OAAOf,KAAK;AACtB,WAAOe,OAAOC,SAASF,CAAC,IAAIA,IAAId;AAAAA,EAClC;AAEA,SAAOA;AACT;"}
@@ -53,5 +53,7 @@ export { DataPreviewSection } from './DataPreviewSection';
53
53
  export type { DataPreviewSectionProps } from './DataPreviewSection';
54
54
  export { RenderContext, RenderProvider, useRenderContext } from './RenderContext';
55
55
  export type { RenderContextValue, RenderComponentFn } from './RenderContext';
56
+ export { ElicitationForm } from './ElicitationForm';
57
+ export type { ElicitationFormProps } from './ElicitationForm';
56
58
  export { UIResourceRenderer as default } from './UIResourceRenderer';
57
59
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,YAAY,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA;AAGjF,OAAO,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AgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAGnE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACjF,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAG5E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAG7D,OAAO,EAAE,kBAAkB,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAA"}
@@ -25,6 +25,7 @@ const BriefingDiff = require("./components/BriefingDiff.cjs");
25
25
  const VerifiedText = require("./components/VerifiedText.cjs");
26
26
  const DataPreviewSection = require("./components/DataPreviewSection.cjs");
27
27
  const RenderContext = require("./components/RenderContext.cjs");
28
+ const ElicitationForm = require("./components/ElicitationForm.cjs");
28
29
  exports.UIResourceRenderer = UIResourceRenderer.UIResourceRenderer;
29
30
  exports.default = UIResourceRenderer.UIResourceRenderer;
30
31
  exports.StreamingUIRenderer = StreamingUIRenderer.StreamingUIRenderer;
@@ -57,4 +58,5 @@ exports.DataPreviewSection = DataPreviewSection.DataPreviewSection;
57
58
  exports.RenderContext = RenderContext.RenderContext;
58
59
  exports.RenderProvider = RenderContext.RenderProvider;
59
60
  exports.useRenderContext = RenderContext.useRenderContext;
61
+ exports.ElicitationForm = ElicitationForm.ElicitationForm;
60
62
  //# sourceMappingURL=components.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -53,5 +53,7 @@ export { DataPreviewSection } from './DataPreviewSection';
53
53
  export type { DataPreviewSectionProps } from './DataPreviewSection';
54
54
  export { RenderContext, RenderProvider, useRenderContext } from './RenderContext';
55
55
  export type { RenderContextValue, RenderComponentFn } from './RenderContext';
56
+ export { ElicitationForm } from './ElicitationForm';
57
+ export type { ElicitationFormProps } from './ElicitationForm';
56
58
  export { UIResourceRenderer as default } from './UIResourceRenderer';
57
59
  //# sourceMappingURL=index.d.ts.map
@@ -53,5 +53,7 @@ export { DataPreviewSection } from './DataPreviewSection';
53
53
  export type { DataPreviewSectionProps } from './DataPreviewSection';
54
54
  export { RenderContext, RenderProvider, useRenderContext } from './RenderContext';
55
55
  export type { RenderContextValue, RenderComponentFn } from './RenderContext';
56
+ export { ElicitationForm } from './ElicitationForm';
57
+ export type { ElicitationFormProps } from './ElicitationForm';
56
58
  export { UIResourceRenderer as default } from './UIResourceRenderer';
57
59
  //# sourceMappingURL=index.d.ts.map
@@ -23,6 +23,7 @@ import { BriefingDiff } from "./components/BriefingDiff.js";
23
23
  import { VerifiedText } from "./components/VerifiedText.js";
24
24
  import { DataPreviewSection } from "./components/DataPreviewSection.js";
25
25
  import { RenderContext, RenderProvider, useRenderContext } from "./components/RenderContext.js";
26
+ import { ElicitationForm } from "./components/ElicitationForm.js";
26
27
  export {
27
28
  ActionGroupRenderer,
28
29
  ActionRenderer,
@@ -35,6 +36,7 @@ export {
35
36
  ChartJSRenderer,
36
37
  CodeBlockRenderer,
37
38
  DataPreviewSection,
39
+ ElicitationForm,
38
40
  FooterRenderer,
39
41
  FormFieldRenderer,
40
42
  FormRenderer,
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ const AgentHandoff = require("./components/AgentHandoff.cjs");
22
22
  const BriefingDiff = require("./components/BriefingDiff.cjs");
23
23
  const VerifiedText = require("./components/VerifiedText.cjs");
24
24
  const DataPreviewSection = require("./components/DataPreviewSection.cjs");
25
+ const ElicitationForm = require("./components/ElicitationForm.cjs");
25
26
  const DraggableGridItem = require("./components/DraggableGridItem.cjs");
26
27
  const ResizeHandle = require("./components/ResizeHandle.cjs");
27
28
  const EditableUIResourceRenderer = require("./components/EditableUIResourceRenderer.cjs");
@@ -32,6 +33,7 @@ const useChatBus = require("./hooks/useChatBus.cjs");
32
33
  const ChatPrompt = require("./components/ChatPrompt.cjs");
33
34
  const ScratchpadPanel = require("./components/ScratchpadPanel.cjs");
34
35
  const scratchpadStore = require("./stores/scratchpad-store.cjs");
36
+ const serverCapabilitiesStore = require("./stores/server-capabilities-store.cjs");
35
37
  const GhostText = require("./components/GhostText.cjs");
36
38
  const AutocompleteDropdown = require("./components/AutocompleteDropdown.cjs");
37
39
  const AutocompleteFormField = require("./components/AutocompleteFormField.cjs");
@@ -65,6 +67,7 @@ exports.AgentHandoff = AgentHandoff.AgentHandoff;
65
67
  exports.BriefingDiff = BriefingDiff.BriefingDiff;
66
68
  exports.VerifiedText = VerifiedText.VerifiedText;
67
69
  exports.DataPreviewSection = DataPreviewSection.DataPreviewSection;
70
+ exports.ElicitationForm = ElicitationForm.ElicitationForm;
68
71
  exports.DraggableGridItem = DraggableGridItem.DraggableGridItem;
69
72
  exports.ResizeHandle = ResizeHandle.ResizeHandle;
70
73
  exports.EditableUIResourceRenderer = EditableUIResourceRenderer.EditableUIResourceRenderer;
@@ -81,6 +84,11 @@ exports.ScratchpadStoreProvider = scratchpadStore.ScratchpadStoreProvider;
81
84
  exports.createScratchpadStore = scratchpadStore.createScratchpadStore;
82
85
  exports.dispatchScratchpad = scratchpadStore.dispatchScratchpad;
83
86
  exports.useScratchpadState = scratchpadStore.useScratchpadState;
87
+ exports.ServerCapabilitiesContext = serverCapabilitiesStore.ServerCapabilitiesContext;
88
+ exports.ServerCapabilitiesProvider = serverCapabilitiesStore.ServerCapabilitiesProvider;
89
+ exports.createServerCapabilitiesStore = serverCapabilitiesStore.createServerCapabilitiesStore;
90
+ exports.setServerCapabilities = serverCapabilitiesStore.setServerCapabilities;
91
+ exports.useServerCapabilities = serverCapabilitiesStore.useServerCapabilities;
84
92
  exports.GhostText = GhostText.GhostText;
85
93
  exports.GhostTextInput = GhostText.GhostTextInput;
86
94
  exports.AutocompleteDropdown = AutocompleteDropdown.AutocompleteDropdown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.cts CHANGED
@@ -37,9 +37,12 @@ export { FeedbackInline } from './components/FeedbackInline';
37
37
  export type { FeedbackInlineProps, FeedbackInlineContext } from './components/FeedbackInline';
38
38
  export { ChatBusProvider, useChatBus } from './hooks/useChatBus';
39
39
  export { ChatPrompt } from './components/ChatPrompt';
40
+ export { ElicitationForm } from './components/ElicitationForm';
40
41
  export { ScratchpadPanel } from './components/ScratchpadPanel';
41
42
  export { dispatchScratchpad, useScratchpadState, createScratchpadStore, ScratchpadStoreContext, ScratchpadStoreProvider, } from './stores/scratchpad-store';
42
43
  export type { ScratchpadStoreHandle } from './stores/scratchpad-store';
44
+ export { setServerCapabilities, useServerCapabilities, createServerCapabilitiesStore, ServerCapabilitiesContext, ServerCapabilitiesProvider, } from './stores/server-capabilities-store';
45
+ export type { ServerCapabilities, ServerInitializeInfo, ServerCapabilitiesStoreHandle, } from './stores/server-capabilities-store';
43
46
  export { VerifiedText } from './components/VerifiedText';
44
47
  export { DataPreviewSection } from './components/DataPreviewSection';
45
48
  export { AgentCard, AgentStatusBadge } from './components/AgentCard';
@@ -56,6 +59,7 @@ export type { EditableUIResourceRendererProps } from './components/EditableUIRes
56
59
  export type { ExpandableWrapperProps } from './components/ExpandableWrapper';
57
60
  export type { ComponentToolbarProps, ToolbarAction, ToolbarIcon } from './components/ComponentToolbar';
58
61
  export type { ChatPromptProps } from './components/ChatPrompt';
62
+ export type { ElicitationFormProps } from './components/ElicitationForm';
59
63
  export type { ScratchpadPanelProps } from './components/ScratchpadPanel';
60
64
  export type { VerifiedTextProps } from './components/VerifiedText';
61
65
  export type { DataPreviewSectionProps } from './components/DataPreviewSection';
package/dist/index.d.ts CHANGED
@@ -37,9 +37,12 @@ export { FeedbackInline } from './components/FeedbackInline';
37
37
  export type { FeedbackInlineProps, FeedbackInlineContext } from './components/FeedbackInline';
38
38
  export { ChatBusProvider, useChatBus } from './hooks/useChatBus';
39
39
  export { ChatPrompt } from './components/ChatPrompt';
40
+ export { ElicitationForm } from './components/ElicitationForm';
40
41
  export { ScratchpadPanel } from './components/ScratchpadPanel';
41
42
  export { dispatchScratchpad, useScratchpadState, createScratchpadStore, ScratchpadStoreContext, ScratchpadStoreProvider, } from './stores/scratchpad-store';
42
43
  export type { ScratchpadStoreHandle } from './stores/scratchpad-store';
44
+ export { setServerCapabilities, useServerCapabilities, createServerCapabilitiesStore, ServerCapabilitiesContext, ServerCapabilitiesProvider, } from './stores/server-capabilities-store';
45
+ export type { ServerCapabilities, ServerInitializeInfo, ServerCapabilitiesStoreHandle, } from './stores/server-capabilities-store';
43
46
  export { VerifiedText } from './components/VerifiedText';
44
47
  export { DataPreviewSection } from './components/DataPreviewSection';
45
48
  export { AgentCard, AgentStatusBadge } from './components/AgentCard';
@@ -56,6 +59,7 @@ export type { EditableUIResourceRendererProps } from './components/EditableUIRes
56
59
  export type { ExpandableWrapperProps } from './components/ExpandableWrapper';
57
60
  export type { ComponentToolbarProps, ToolbarAction, ToolbarIcon } from './components/ComponentToolbar';
58
61
  export type { ChatPromptProps } from './components/ChatPrompt';
62
+ export type { ElicitationFormProps } from './components/ElicitationForm';
59
63
  export type { ScratchpadPanelProps } from './components/ScratchpadPanel';
60
64
  export type { VerifiedTextProps } from './components/VerifiedText';
61
65
  export type { DataPreviewSectionProps } from './components/DataPreviewSection';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAGjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAG7F,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAA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gBAAgB,EAChB,0BAA0B,EAC1B,yBAAyB,EAEzB,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAEjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { AgentHandoff } from "./components/AgentHandoff.js";
20
20
  import { BriefingDiff } from "./components/BriefingDiff.js";
21
21
  import { VerifiedText } from "./components/VerifiedText.js";
22
22
  import { DataPreviewSection } from "./components/DataPreviewSection.js";
23
+ import { ElicitationForm } from "./components/ElicitationForm.js";
23
24
  import { DraggableGridItem } from "./components/DraggableGridItem.js";
24
25
  import { ResizeHandle } from "./components/ResizeHandle.js";
25
26
  import { EditableUIResourceRenderer } from "./components/EditableUIResourceRenderer.js";
@@ -30,6 +31,7 @@ import { ChatBusProvider, useChatBus } from "./hooks/useChatBus.js";
30
31
  import { ChatPrompt } from "./components/ChatPrompt.js";
31
32
  import { ScratchpadPanel } from "./components/ScratchpadPanel.js";
32
33
  import { ScratchpadStoreContext, ScratchpadStoreProvider, createScratchpadStore, dispatchScratchpad, useScratchpadState } from "./stores/scratchpad-store.js";
34
+ import { ServerCapabilitiesContext, ServerCapabilitiesProvider, createServerCapabilitiesStore, setServerCapabilities, useServerCapabilities } from "./stores/server-capabilities-store.js";
33
35
  import { GhostText, GhostTextInput } from "./components/GhostText.js";
34
36
  import { AutocompleteDropdown } from "./components/AutocompleteDropdown.js";
35
37
  import { AutocompleteFormField } from "./components/AutocompleteFormField.js";
@@ -70,6 +72,7 @@ export {
70
72
  DataPreviewSection,
71
73
  DraggableGridItem,
72
74
  EditableUIResourceRenderer,
75
+ ElicitationForm,
73
76
  ExpandableWrapper,
74
77
  FeedbackInline,
75
78
  GenerativeUIErrorBoundary,
@@ -82,6 +85,8 @@ export {
82
85
  ScratchpadPanel,
83
86
  ScratchpadStoreContext,
84
87
  ScratchpadStoreProvider,
88
+ ServerCapabilitiesContext,
89
+ ServerCapabilitiesProvider,
85
90
  SplitStepper,
86
91
  StreamingUIRenderer,
87
92
  TRUSTED_IFRAME_DOMAINS,
@@ -96,12 +101,14 @@ export {
96
101
  createMockChatBus,
97
102
  createRestPlugin,
98
103
  createScratchpadStore,
104
+ createServerCapabilitiesStore,
99
105
  createSupabasePlugin,
100
106
  dispatchScratchpad,
101
107
  elicitationToPromptConfig,
102
108
  evaluateCondition,
103
109
  getIframeSandbox,
104
110
  mergeScratchpadSections,
111
+ setServerCapabilities,
105
112
  useAction,
106
113
  useAutocomplete,
107
114
  useAutocompleteContext,
@@ -118,6 +125,7 @@ export {
118
125
  useModal,
119
126
  useResize,
120
127
  useScratchpadState,
128
+ useServerCapabilities,
121
129
  useStreamingUI,
122
130
  useToolAction,
123
131
  validateAgainstSource,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const web = require("solid-js/web");
4
+ const solidJs = require("solid-js");
5
+ const store = require("solid-js/store");
6
+ function createServerCapabilitiesStore() {
7
+ const [state, setState] = store.createStore({
8
+ info: null
9
+ });
10
+ return {
11
+ set: (info) => setState("info", info),
12
+ info: () => state.info,
13
+ capabilities: () => {
14
+ var _a;
15
+ return ((_a = state.info) == null ? void 0 : _a.capabilities) ?? null;
16
+ },
17
+ serverInfo: () => {
18
+ var _a;
19
+ return ((_a = state.info) == null ? void 0 : _a.serverInfo) ?? null;
20
+ },
21
+ protocolVersion: () => {
22
+ var _a;
23
+ return ((_a = state.info) == null ? void 0 : _a.protocolVersion) ?? null;
24
+ },
25
+ hasCapability: (key) => {
26
+ var _a, _b;
27
+ return Boolean((_b = (_a = state.info) == null ? void 0 : _a.capabilities) == null ? void 0 : _b[key]);
28
+ }
29
+ };
30
+ }
31
+ const defaultStore = createServerCapabilitiesStore();
32
+ function setServerCapabilities(info) {
33
+ defaultStore.set(info);
34
+ }
35
+ const ServerCapabilitiesContext = solidJs.createContext(void 0);
36
+ const ServerCapabilitiesProvider = (props) => {
37
+ const store2 = props.store ?? createServerCapabilitiesStore();
38
+ return web.createComponent(ServerCapabilitiesContext.Provider, {
39
+ value: store2,
40
+ get children() {
41
+ return props.children;
42
+ }
43
+ });
44
+ };
45
+ function useServerCapabilities() {
46
+ const scoped = solidJs.useContext(ServerCapabilitiesContext);
47
+ const handle = scoped ?? defaultStore;
48
+ return {
49
+ info: handle.info,
50
+ capabilities: handle.capabilities,
51
+ serverInfo: handle.serverInfo,
52
+ protocolVersion: handle.protocolVersion,
53
+ hasCapability: handle.hasCapability
54
+ };
55
+ }
56
+ exports.ServerCapabilitiesContext = ServerCapabilitiesContext;
57
+ exports.ServerCapabilitiesProvider = ServerCapabilitiesProvider;
58
+ exports.createServerCapabilitiesStore = createServerCapabilitiesStore;
59
+ exports.setServerCapabilities = setServerCapabilities;
60
+ exports.useServerCapabilities = useServerCapabilities;
61
+ //# sourceMappingURL=server-capabilities-store.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-capabilities-store.cjs","sources":["../../src/stores/server-capabilities-store.tsx"],"sourcesContent":["/**\n * Server Capabilities Store — reactive snapshot of the MCP `initialize`\n * response echoed by the server.\n *\n * @experimental\n * @since v5.3.0\n *\n * mcp-ui doesn't speak MCP protocol directly — the consumer's transport\n * layer (stdio child process, HTTP/SSE client, ...) parses the\n * `initialize` JSON-RPC response and pushes the relevant fields into this\n * store via `setServerCapabilities(info)`. Components then read\n * reactively via `useServerCapabilities()` to gate behavior :\n *\n * ```tsx\n * const { capabilities } = useServerCapabilities()\n * <Show when={capabilities()?.tools?.listChanged}>\n * <ToolListSubscriber />\n * </Show>\n * ```\n *\n * ## Two consumption modes (mirrors `scratchpad-store`)\n *\n * 1. **Singleton mode (default)** — `setServerCapabilities(info)` mutates\n * the module-level singleton. `useServerCapabilities()` reads from it.\n * Use for single-MCP-server consumers (the common case).\n *\n * 2. **Multi-instance mode** — wrap a subtree in\n * `<ServerCapabilitiesProvider>` to scope a separate handle. Pass\n * `store={createServerCapabilitiesStore()}` explicitly when you need to\n * drive it from a non-reactive scope (e.g. a transport adapter living\n * at the app root).\n *\n * ## Note on `elicitation`\n *\n * Per MCP spec 2025-06-18, `elicitation` is a **CLIENT** capability, not\n * a server one. Servers do not declare it. If you need to gate\n * `<ElicitationForm>` rendering on whether the connected client *itself*\n * supports elicitation — that's a separate concern (your own state, set\n * by your transport layer based on its own configuration).\n */\n\nimport { createContext, useContext, type ParentComponent, type JSX } from 'solid-js'\nimport { createStore } from 'solid-js/store'\n\n// ─── Types ────────────────────────────────────────────────────\n\n/**\n * Server capabilities object as advertised in the MCP `initialize` response.\n * Mirrors the spec 2025-06-18 `ServerCapabilities` shape with permissive\n * `experimental` for forward compatibility.\n */\nexport interface ServerCapabilities {\n experimental?: Record<string, unknown>\n logging?: Record<string, never>\n tools?: { listChanged?: boolean }\n prompts?: { listChanged?: boolean }\n resources?: { listChanged?: boolean; subscribe?: boolean }\n completions?: Record<string, never>\n}\n\n/**\n * Subset of the MCP `initialize` response relevant to the UI layer.\n * Consumers may extend this via the `experimental` field.\n */\nexport interface ServerInitializeInfo {\n protocolVersion: string\n serverInfo: { name: string; version: string; title?: string; [key: string]: unknown }\n capabilities: ServerCapabilities\n instructions?: string\n}\n\n// ─── Handle ───────────────────────────────────────────────────\n\nexport interface ServerCapabilitiesStoreHandle {\n /** Push a fresh `initialize` snapshot into the store, or clear with `null`. */\n set: (info: ServerInitializeInfo | null) => void\n /** Reactive accessor for the full info (null when no initialize received). */\n info: () => ServerInitializeInfo | null\n /** Reactive accessor for just the `capabilities` field. */\n capabilities: () => ServerCapabilities | null\n /** Reactive accessor for just the `serverInfo` field. */\n serverInfo: () => ServerInitializeInfo['serverInfo'] | null\n /** Reactive accessor for the protocol version string. */\n protocolVersion: () => string | null\n /**\n * Helper : returns true if the server advertised the named capability key\n * with a truthy value (i.e. the key is present, even as an empty object).\n */\n hasCapability: (key: keyof ServerCapabilities) => boolean\n}\n\n// ─── Factory ──────────────────────────────────────────────────\n\n/**\n * Create an isolated server-capabilities store instance.\n *\n * Use this when you need to track multiple MCP servers in parallel (rare),\n * or to drive the store from a non-reactive transport adapter. Pair with\n * `<ServerCapabilitiesProvider store={...}>` to scope a SolidJS subtree.\n *\n * @experimental\n * @since v5.3.0\n */\nexport function createServerCapabilitiesStore(): ServerCapabilitiesStoreHandle {\n const [state, setState] = createStore<{ info: ServerInitializeInfo | null }>({ info: null })\n\n return {\n set: (info) => setState('info', info),\n info: () => state.info,\n capabilities: () => state.info?.capabilities ?? null,\n serverInfo: () => state.info?.serverInfo ?? null,\n protocolVersion: () => state.info?.protocolVersion ?? null,\n hasCapability: (key) => Boolean(state.info?.capabilities?.[key]),\n }\n}\n\n// ─── Module-level singleton ───────────────────────────────────\n\nconst defaultStore: ServerCapabilitiesStoreHandle = createServerCapabilitiesStore()\n\n/**\n * Push the parsed MCP `initialize` response into the module-level singleton\n * store. Pass `null` to clear (e.g. on disconnect / server change).\n *\n * @experimental\n * @since v5.3.0\n *\n * @example\n * // In your transport adapter, after receiving the initialize response :\n * setServerCapabilities({\n * protocolVersion: response.result.protocolVersion,\n * serverInfo: response.result.serverInfo,\n * capabilities: response.result.capabilities,\n * instructions: response.result.instructions,\n * })\n */\nexport function setServerCapabilities(info: ServerInitializeInfo | null): void {\n defaultStore.set(info)\n}\n\n// ─── Context ──────────────────────────────────────────────────\n\n/**\n * Context for a scoped server-capabilities store. Populated by\n * `<ServerCapabilitiesProvider>`. Read by `useServerCapabilities()` with\n * automatic fallback to the module-level singleton when absent.\n *\n * @experimental\n * @since v5.3.0\n */\nexport const ServerCapabilitiesContext = createContext<ServerCapabilitiesStoreHandle | undefined>(\n undefined\n)\n\n/**\n * Provide a scoped `ServerCapabilitiesStoreHandle` to a SolidJS subtree.\n * Children calling `useServerCapabilities()` bind to this store instead of\n * the module singleton.\n *\n * If no `store` prop is passed, a fresh store is created for the provider's\n * lifetime. Pass `store` explicitly when you need the handle outside the\n * tree (e.g. in a transport adapter living at the app root).\n *\n * @experimental\n * @since v5.3.0\n */\nexport const ServerCapabilitiesProvider: ParentComponent<{\n store?: ServerCapabilitiesStoreHandle\n}> = (props): JSX.Element => {\n const store = props.store ?? createServerCapabilitiesStore()\n return (\n <ServerCapabilitiesContext.Provider value={store}>\n {props.children}\n </ServerCapabilitiesContext.Provider>\n )\n}\n\n// ─── Reactive hook ────────────────────────────────────────────\n\n/**\n * Hook for components — reads the server capabilities reactively.\n *\n * If called inside a `<ServerCapabilitiesProvider>`, reads the scoped\n * handle; otherwise falls back to the module singleton.\n *\n * @experimental\n * @since v5.3.0\n *\n * @example\n * const { capabilities, serverInfo, hasCapability } = useServerCapabilities()\n *\n * <Show when={capabilities()}>\n * <p>Connected to {serverInfo()?.name} v{serverInfo()?.version}</p>\n * <Show when={hasCapability('tools')}>\n * <ToolPalette />\n * </Show>\n * </Show>\n */\nexport function useServerCapabilities(): {\n info: () => ServerInitializeInfo | null\n capabilities: () => ServerCapabilities | null\n serverInfo: () => ServerInitializeInfo['serverInfo'] | null\n protocolVersion: () => string | null\n hasCapability: (key: keyof ServerCapabilities) => boolean\n} {\n const scoped = useContext(ServerCapabilitiesContext)\n const handle = scoped ?? defaultStore\n return {\n info: handle.info,\n capabilities: handle.capabilities,\n serverInfo: handle.serverInfo,\n protocolVersion: handle.protocolVersion,\n hasCapability: handle.hasCapability,\n }\n}\n"],"names":["createServerCapabilitiesStore","state","setState","createStore","info","set","capabilities","serverInfo","protocolVersion","hasCapability","key","Boolean","defaultStore","setServerCapabilities","ServerCapabilitiesContext","createContext","undefined","ServerCapabilitiesProvider","props","store","_$createComponent","Provider","value","children","useServerCapabilities","scoped","useContext","handle"],"mappings":";;;;;AAuGO,SAASA,gCAA+D;AAC7E,QAAM,CAACC,OAAOC,QAAQ,IAAIC,kBAAmD;AAAA,IAAEC,MAAM;AAAA,EAAA,CAAM;AAE3F,SAAO;AAAA,IACLC,KAAMD,CAAAA,SAASF,SAAS,QAAQE,IAAI;AAAA,IACpCA,MAAMA,MAAMH,MAAMG;AAAAA,IAClBE,cAAcA,MAAAA;;AAAML,0BAAMG,SAANH,mBAAYK,iBAAgB;AAAA;AAAA,IAChDC,YAAYA,MAAAA;;AAAMN,0BAAMG,SAANH,mBAAYM,eAAc;AAAA;AAAA,IAC5CC,iBAAiBA,MAAAA;;AAAMP,0BAAMG,SAANH,mBAAYO,oBAAmB;AAAA;AAAA,IACtDC,eAAgBC,CAAAA;;AAAQC,sBAAQV,iBAAMG,SAANH,mBAAYK,iBAAZL,mBAA2BS,IAAI;AAAA;AAAA,EAAA;AAEnE;AAIA,MAAME,eAA8CZ,8BAAAA;AAkB7C,SAASa,sBAAsBT,MAAyC;AAC7EQ,eAAaP,IAAID,IAAI;AACvB;AAYO,MAAMU,4BAA4BC,QAAAA,cACvCC,MACF;AAcO,MAAMC,6BAERA,CAACC,UAAuB;AAC3B,QAAMC,SAAQD,MAAMC,SAASnB,8BAAAA;AAC7B,SAAAoB,IAAAA,gBACGN,0BAA0BO,UAAQ;AAAA,IAACC,OAAOH;AAAAA,IAAK,IAAAI,WAAA;AAAA,aAC7CL,MAAMK;AAAAA,IAAQ;AAAA,EAAA,CAAA;AAGrB;AAuBO,SAASC,wBAMd;AACA,QAAMC,SAASC,QAAAA,WAAWZ,yBAAyB;AACnD,QAAMa,SAASF,UAAUb;AACzB,SAAO;AAAA,IACLR,MAAMuB,OAAOvB;AAAAA,IACbE,cAAcqB,OAAOrB;AAAA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