@assistant-ui/react-mcp 0.1.2 → 0.1.4

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.
@@ -1,41 +1,38 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
1
+ import { AuiConfig, AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/context/McpConnectorByIndexProvider.tsx
5
5
  const McpConnectorByIndexProvider = (t0) => {
6
- const $ = c(7);
6
+ const $ = c(6);
7
7
  const { index, children } = t0;
8
+ const aui = useAui();
8
9
  let t1;
9
10
  if ($[0] !== index) {
10
- t1 = Derived({
11
+ t1 = AuiConfig({ mcpServer: Derived({
11
12
  source: "mcp",
12
13
  query: {
13
14
  kind: "connector",
14
15
  index
15
16
  },
16
17
  get: (parent) => parent.mcp.connector({ index })
17
- });
18
+ }) });
18
19
  $[0] = index;
19
20
  $[1] = t1;
20
21
  } else t1 = $[1];
22
+ const config = t1;
21
23
  let t2;
22
- if ($[2] !== t1) {
23
- t2 = { mcpServer: t1 };
24
- $[2] = t1;
25
- $[3] = t2;
26
- } else t2 = $[3];
27
- const aui = useAui(t2);
28
- let t3;
29
- if ($[4] !== aui || $[5] !== children) {
30
- t3 = /* @__PURE__ */ jsx(AuiProvider, {
31
- value: aui,
24
+ if ($[2] !== aui || $[3] !== children || $[4] !== config) {
25
+ t2 = /* @__PURE__ */ jsx(AuiProvider, {
26
+ extends: aui,
27
+ config,
32
28
  children
33
29
  });
34
- $[4] = aui;
35
- $[5] = children;
36
- $[6] = t3;
37
- } else t3 = $[6];
38
- return t3;
30
+ $[2] = aui;
31
+ $[3] = children;
32
+ $[4] = config;
33
+ $[5] = t2;
34
+ } else t2 = $[5];
35
+ return t2;
39
36
  };
40
37
  //#endregion
41
38
  export { McpConnectorByIndexProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpConnectorByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpConnectorByIndexProvider","index","t0","$","_c","children","t1","source","query","kind","get","parent","mcp","connector","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp.connector({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,+BAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CAAmB,IAAAI;CAAA,IAAAH,EAAA,OAAAF,OAAA;EAETK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAWR;GAAQ;GAACS,MAC9BC,WAAYA,OAAMC,IAAIC,UAAW,EAAAZ,MAAQ,CAAC;EACjD,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAG,IAAA;EALeQ,KAAA,EAAAC,WACNT,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAND,MAAAa,MAAYnB,OAAOiB,EAMlB;CAAE,IAAAG;CAAA,IAAAd,EAAA,OAAAa,OAAAb,EAAA,OAAAE,UAAA;EAEIY,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMX;EAAd,CAAA;EAAqCF,EAAA,KAAAa;EAAAb,EAAA,KAAAE;EAAAF,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAAjDc;AAAiD"}
1
+ {"version":3,"file":"McpConnectorByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpConnectorByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","connector","config","t2"],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpConnectorByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"connector\", index },\n get: (parent) => parent.mcp.connector({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,+BAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAWV;GAAQ;GAACW,MAC9BC,WAAYA,OAAMC,IAAIC,UAAW,EAAAd,MAAQ,CAAC;EACjD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
@@ -1,41 +1,38 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
1
+ import { AuiConfig, AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/context/McpCustomServerByIndexProvider.tsx
5
5
  const McpCustomServerByIndexProvider = (t0) => {
6
- const $ = c(7);
6
+ const $ = c(6);
7
7
  const { index, children } = t0;
8
+ const aui = useAui();
8
9
  let t1;
9
10
  if ($[0] !== index) {
10
- t1 = Derived({
11
+ t1 = AuiConfig({ mcpServer: Derived({
11
12
  source: "mcp",
12
13
  query: {
13
14
  kind: "custom",
14
15
  index
15
16
  },
16
17
  get: (parent) => parent.mcp.customServer({ index })
17
- });
18
+ }) });
18
19
  $[0] = index;
19
20
  $[1] = t1;
20
21
  } else t1 = $[1];
22
+ const config = t1;
21
23
  let t2;
22
- if ($[2] !== t1) {
23
- t2 = { mcpServer: t1 };
24
- $[2] = t1;
25
- $[3] = t2;
26
- } else t2 = $[3];
27
- const aui = useAui(t2);
28
- let t3;
29
- if ($[4] !== aui || $[5] !== children) {
30
- t3 = /* @__PURE__ */ jsx(AuiProvider, {
31
- value: aui,
24
+ if ($[2] !== aui || $[3] !== children || $[4] !== config) {
25
+ t2 = /* @__PURE__ */ jsx(AuiProvider, {
26
+ extends: aui,
27
+ config,
32
28
  children
33
29
  });
34
- $[4] = aui;
35
- $[5] = children;
36
- $[6] = t3;
37
- } else t3 = $[6];
38
- return t3;
30
+ $[2] = aui;
31
+ $[3] = children;
32
+ $[4] = config;
33
+ $[5] = t2;
34
+ } else t2 = $[5];
35
+ return t2;
39
36
  };
40
37
  //#endregion
41
38
  export { McpCustomServerByIndexProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpCustomServerByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpCustomServerByIndexProvider","index","t0","$","_c","children","t1","source","query","kind","get","parent","mcp","customServer","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp.customServer({ index }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,kCAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CAAmB,IAAAI;CAAA,IAAAH,EAAA,OAAAF,OAAA;EAETK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAQR;GAAQ;GAACS,MAC3BC,WAAYA,OAAMC,IAAIC,aAAc,EAAAZ,MAAQ,CAAC;EACpD,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAG,IAAA;EALeQ,KAAA,EAAAC,WACNT,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAND,MAAAa,MAAYnB,OAAOiB,EAMlB;CAAE,IAAAG;CAAA,IAAAd,EAAA,OAAAa,OAAAb,EAAA,OAAAE,UAAA;EAEIY,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMX;EAAd,CAAA;EAAqCF,EAAA,KAAAa;EAAAb,EAAA,KAAAE;EAAAF,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAAjDc;AAAiD"}
1
+ {"version":3,"file":"McpCustomServerByIndexProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpCustomServerByIndexProvider","index","t0","$","_c","children","aui","t1","mcpServer","source","query","kind","get","parent","mcp","customServer","config","t2"],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpCustomServerByIndexProvider: FC<\n PropsWithChildren<{ index: number }>\n> = ({ index, children }) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { kind: \"custom\", index },\n get: (parent) => parent.mcp.customServer({ index }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,kCAETE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,OAAAI,aAAAH;CACH,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,OAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN;IAAAC,MAAQ;IAAQV;GAAQ;GAACW,MAC3BC,WAAYA,OAAMC,IAAIC,aAAc,EAAAd,MAAQ,CAAC;EACpD,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAa,SAAeT;CAMZ,IAAAU;CAAA,IAAAd,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAa,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBX,SAAAA;GAAaU;GAChCX;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAa;EAAAb,EAAA,KAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAFdc;AAEc"}
@@ -1,38 +1,35 @@
1
- import { AuiProvider, Derived, useAui } from "@assistant-ui/store";
1
+ import { AuiConfig, AuiProvider, Derived, useAui } from "@assistant-ui/store";
2
2
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/context/McpServerByIdProvider.tsx
5
5
  const McpServerByIdProvider = (t0) => {
6
- const $ = c(7);
6
+ const $ = c(6);
7
7
  const { id, children } = t0;
8
+ const aui = useAui();
8
9
  let t1;
9
10
  if ($[0] !== id) {
10
- t1 = Derived({
11
+ t1 = AuiConfig({ mcpServer: Derived({
11
12
  source: "mcp",
12
13
  query: { id },
13
14
  get: (parent) => parent.mcp.server({ id })
14
- });
15
+ }) });
15
16
  $[0] = id;
16
17
  $[1] = t1;
17
18
  } else t1 = $[1];
19
+ const config = t1;
18
20
  let t2;
19
- if ($[2] !== t1) {
20
- t2 = { mcpServer: t1 };
21
- $[2] = t1;
22
- $[3] = t2;
23
- } else t2 = $[3];
24
- const aui = useAui(t2);
25
- let t3;
26
- if ($[4] !== aui || $[5] !== children) {
27
- t3 = /* @__PURE__ */ jsx(AuiProvider, {
28
- value: aui,
21
+ if ($[2] !== aui || $[3] !== children || $[4] !== config) {
22
+ t2 = /* @__PURE__ */ jsx(AuiProvider, {
23
+ extends: aui,
24
+ config,
29
25
  children
30
26
  });
31
- $[4] = aui;
32
- $[5] = children;
33
- $[6] = t3;
34
- } else t3 = $[6];
35
- return t3;
27
+ $[2] = aui;
28
+ $[3] = children;
29
+ $[4] = config;
30
+ $[5] = t2;
31
+ } else t2 = $[5];
32
+ return t2;
36
33
  };
37
34
  //#endregion
38
35
  export { McpServerByIdProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerByIdProvider.js","names":["FC","PropsWithChildren","useAui","AuiProvider","Derived","McpServerByIdProvider","id","t0","$","_c","children","t1","source","query","get","parent","mcp","server","t2","mcpServer","aui","t3"],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp.server({ id }),\n }),\n });\n\n return <AuiProvider value={aui}>{children}</AuiProvider>;\n};\n"],"mappings":";;;;AAGA,MAAaK,yBAA+DE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,IAAAI,aAAAH;CAG5E,IAAAI;CAAA,IAAAH,EAAA,OAAAF,IAAA;EAEcK,KAAAP,QAAQ;GAAAQ,QACT;GAAKC,OACN,EAAAP,GAAK;GAACQ,MACRC,WAAYA,OAAMC,IAAIC,OAAQ,EAAAX,GAAK,CAAC;EAC3C,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAG,IAAA;EALeO,KAAA,EAAAC,WACNR,GAKb;EAACH,EAAA,KAAAG;EAAAH,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAND,MAAAY,MAAYlB,OAAOgB,EAMlB;CAAE,IAAAG;CAAA,IAAAb,EAAA,OAAAY,OAAAZ,EAAA,OAAAE,UAAA;EAEIW,KAAA,oBAAC,aAAD;GAAoBD,OAAAA;GAAMV;EAAd,CAAA;EAAqCF,EAAA,KAAAY;EAAAZ,EAAA,KAAAE;EAAAF,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAAjDa;AAAiD"}
1
+ {"version":3,"file":"McpServerByIdProvider.js","names":["FC","PropsWithChildren","useAui","AuiConfig","AuiProvider","Derived","McpServerByIdProvider","id","t0","$","_c","children","aui","t1","mcpServer","source","query","get","parent","mcp","server","config","t2"],"sources":["../../src/context/McpServerByIdProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { useAui, AuiConfig, AuiProvider, Derived } from \"@assistant-ui/store\";\n\nexport const McpServerByIdProvider: FC<PropsWithChildren<{ id: string }>> = ({\n id,\n children,\n}) => {\n const aui = useAui();\n const config = AuiConfig({\n mcpServer: Derived({\n source: \"mcp\",\n query: { id },\n get: (parent) => parent.mcp.server({ id }),\n }),\n });\n return (\n <AuiProvider extends={aui} config={config}>\n {children}\n </AuiProvider>\n );\n};\n"],"mappings":";;;;AAGA,MAAaM,yBAA+DE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAH,IAAAI,aAAAH;CAI3E,MAAAI,MAAYV,OAAO;CAAE,IAAAW;CAAA,IAAAJ,EAAA,OAAAF,IAAA;EACNM,KAAAV,UAAU,EAAAW,WACZT,QAAQ;GAAAU,QACT;GAAKC,OACN,EAAAT,GAAK;GAACU,MACRC,WAAYA,OAAMC,IAAIC,OAAQ,EAAAb,GAAK,CAAC;EAC3C,CAAC,EACH,CAAC;EAACE,EAAA,KAAAF;EAAAE,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CANF,MAAAY,SAAeR;CAMZ,IAAAS;CAAA,IAAAb,EAAA,OAAAG,OAAAH,EAAA,OAAAE,YAAAF,EAAA,OAAAY,QAAA;EAEDC,KAAA,oBAAC,aAAD;GAAsBV,SAAAA;GAAaS;GAChCV;EADS,CAAA;EAEEF,EAAA,KAAAG;EAAAH,EAAA,KAAAE;EAAAF,EAAA,KAAAY;EAAAZ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAFda;AAEc"}
@@ -14,7 +14,7 @@ const McpServerPrimitiveRemoveButton = forwardRef((props, ref) => {
14
14
  t0 = (e) => {
15
15
  props.onClick?.(e);
16
16
  if (e.defaultPrevented) return;
17
- aui.mcpServer.remove();
17
+ aui.mcpServer.remove().catch(_temp2);
18
18
  };
19
19
  $[0] = aui;
20
20
  $[1] = props;
@@ -39,6 +39,7 @@ McpServerPrimitiveRemoveButton.displayName = "McpServerPrimitive.RemoveButton";
39
39
  function _temp(s) {
40
40
  return s.mcpServer.kind;
41
41
  }
42
+ function _temp2() {}
42
43
  //#endregion
43
44
  export { McpServerPrimitiveRemoveButton };
44
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerRemoveButton.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useAuiState","McpServerPrimitiveRemoveButton","Element","button","Props","props","ref","$","_c","kind","_temp","aui","t0","e","onClick","defaultPrevented","mcpServer","remove","t1","displayName","s"],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveRemoveButton {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpServerPrimitiveRemoveButton = forwardRef<\n McpServerPrimitiveRemoveButton.Element,\n McpServerPrimitiveRemoveButton.Props\n>((props, ref) => {\n const kind = useAuiState((s) => s.mcpServer.kind);\n const aui = useAui();\n if (kind !== \"custom\") return null;\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(e) => {\n props.onClick?.(e);\n if (e.defaultPrevented) return;\n void aui.mcpServer.remove();\n }}\n />\n );\n});\n\nMcpServerPrimitiveRemoveButton.displayName = \"McpServerPrimitive.RemoveButton\";\n"],"mappings":";;;;;;AAaA,MAAaM,iCAAiCJ,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,YAAYU,KAAuB;CAChD,MAAAC,MAAYZ,OAAO;CACnB,IAAIU,SAAS,UAAQ,OAAS;CAAK,IAAAG;CAAA,IAAAL,EAAA,OAAAI,OAAAJ,EAAA,OAAAF,OAAA;EAMtBO,MAAAC,MAAA;GACPR,MAAKS,UAAWD,CAAC;GACjB,IAAIA,EAACE,kBAAiB;GACjBJ,IAAGK,UAAUC,OAAQ;EAAC;EAC5BV,EAAA,KAAAI;EAAAJ,EAAA,KAAAF;EAAAE,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAK,IAAA;EARHM,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMb;GACC,MAAA;GACAC;GACI,SAAAM;EAIR,CAAA;EACDL,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAK;EAAAL,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OATFW;AASE,CAEL;AAEDjB,+BAA+BkB,cAAc;AAlB3C,SAAAT,MAAAU,GAAA;CAAA,OACgCA,EAACJ,UAAUP;AAAK"}
1
+ {"version":3,"file":"McpServerRemoveButton.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAui","useAuiState","McpServerPrimitiveRemoveButton","Element","button","Props","props","ref","$","_c","kind","_temp","aui","t0","e","onClick","defaultPrevented","mcpServer","remove","catch","_temp2","t1","displayName","s"],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAui, useAuiState } from \"@assistant-ui/store\";\n\nexport namespace McpServerPrimitiveRemoveButton {\n export type Element = ComponentRef<typeof Primitive.button>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.button>;\n}\n\nexport const McpServerPrimitiveRemoveButton = forwardRef<\n McpServerPrimitiveRemoveButton.Element,\n McpServerPrimitiveRemoveButton.Props\n>((props, ref) => {\n const kind = useAuiState((s) => s.mcpServer.kind);\n const aui = useAui();\n if (kind !== \"custom\") return null;\n return (\n <Primitive.button\n {...props}\n type=\"button\"\n ref={ref}\n onClick={(e) => {\n props.onClick?.(e);\n if (e.defaultPrevented) return;\n void aui.mcpServer.remove().catch(() => undefined);\n }}\n />\n );\n});\n\nMcpServerPrimitiveRemoveButton.displayName = \"McpServerPrimitive.RemoveButton\";\n"],"mappings":";;;;;;AAaA,MAAaM,iCAAiCJ,YAG5CQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CACA,MAAAC,OAAaT,YAAYU,KAAuB;CAChD,MAAAC,MAAYZ,OAAO;CACnB,IAAIU,SAAS,UAAQ,OAAS;CAAK,IAAAG;CAAA,IAAAL,EAAA,OAAAI,OAAAJ,EAAA,OAAAF,OAAA;EAMtBO,MAAAC,MAAA;GACPR,MAAKS,UAAWD,CAAC;GACjB,IAAIA,EAACE,kBAAiB;GACjBJ,IAAGK,UAAUC,OAAQ,CAAC,CAAAC,MAAOC,MAAe;EAAC;EACnDZ,EAAA,KAAAI;EAAAJ,EAAA,KAAAF;EAAAE,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAK,IAAA;EARHQ,KAAA,oBAAA,UAAA,QAAA;GAAA,GACMf;GACC,MAAA;GACAC;GACI,SAAAM;EAIR,CAAA;EACDL,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAK;EAAAL,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OATFa;AASE,CAEL;AAEDnB,+BAA+BoB,cAAc;AAlB3C,SAAAX,MAAAY,GAAA;CAAA,OACgCA,EAACN,UAAUP;AAAK;AADhD,SAAAU,SAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerResource.d.ts","names":[],"sources":["../../src/resources/McpManagerResource.ts"],"mappings":";;;;KAqBY;EACV,aAAa;EACb,UAAU;;EAEV;;EAEA;;EAEA;;cA8QW,gDAAkB,SAAA,sBAAA,OAAA"}
1
+ {"version":3,"file":"McpManagerResource.d.ts","names":[],"sources":["../../src/resources/McpManagerResource.ts"],"mappings":";;;;KAqBY;EACV,aAAa;EACb,UAAU;;EAEV;;EAEA;;EAEA;;cAwRW,gDAAkB,SAAA,sBAAA,OAAA"}
@@ -15,6 +15,13 @@ const NO_CONNECTORS = [];
15
15
  const reportCustomStorageFailure = (operation, error) => {
16
16
  console.error(`[assistant-ui/react-mcp] failed to ${operation} custom servers:`, error);
17
17
  };
18
+ const persistCustomServers = async (storage, records) => {
19
+ try {
20
+ await storage.saveCustomServers(records);
21
+ } catch (error) {
22
+ reportCustomStorageFailure("save", error);
23
+ }
24
+ };
18
25
  const useMcpManagerResource = (props) => {
19
26
  const $ = c(72);
20
27
  const connectors = props.connectors ?? NO_CONNECTORS;
@@ -42,9 +49,31 @@ const useMcpManagerResource = (props) => {
42
49
  const [customServers, setCustomServers] = useState(t2);
43
50
  const [isHydrated, setIsHydrated] = useState(false);
44
51
  const hydratedRef = useRef(false);
52
+ const storageRef = useRef(storage);
45
53
  let t3;
46
- if ($[5] !== storage) {
47
- t3 = async (signal) => {
54
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
55
+ t3 = Promise.resolve();
56
+ $[5] = t3;
57
+ } else t3 = $[5];
58
+ const persistenceQueueRef = useRef(t3);
59
+ let t4;
60
+ let t5;
61
+ if ($[6] !== storage) {
62
+ t4 = () => {
63
+ storageRef.current = storage;
64
+ };
65
+ t5 = [storage];
66
+ $[6] = storage;
67
+ $[7] = t4;
68
+ $[8] = t5;
69
+ } else {
70
+ t4 = $[7];
71
+ t5 = $[8];
72
+ }
73
+ useEffect(t4, t5);
74
+ let t6;
75
+ if ($[9] !== storage) {
76
+ t6 = async (signal) => {
48
77
  const markHydrated = () => {
49
78
  if (!signal.cancelled) {
50
79
  hydratedRef.current = true;
@@ -54,8 +83,8 @@ const useMcpManagerResource = (props) => {
54
83
  let records;
55
84
  try {
56
85
  records = await storage.loadCustomServers();
57
- } catch (t4) {
58
- const error = t4;
86
+ } catch (t7) {
87
+ const error = t7;
59
88
  if (!signal.cancelled) reportCustomStorageFailure("load", error);
60
89
  markHydrated();
61
90
  return;
@@ -68,64 +97,51 @@ const useMcpManagerResource = (props) => {
68
97
  });
69
98
  markHydrated();
70
99
  };
71
- $[5] = storage;
72
- $[6] = t3;
73
- } else t3 = $[6];
74
- const hydrate = useEffectEvent(t3);
75
- let t4;
76
- if ($[7] !== hydrate) {
77
- t4 = () => {
100
+ $[9] = storage;
101
+ $[10] = t6;
102
+ } else t6 = $[10];
103
+ const hydrate = useEffectEvent(t6);
104
+ let t7;
105
+ if ($[11] !== hydrate) {
106
+ t7 = () => {
78
107
  const signal_0 = { cancelled: false };
79
108
  hydrate(signal_0);
80
109
  return () => {
81
110
  signal_0.cancelled = true;
82
111
  };
83
112
  };
84
- $[7] = hydrate;
85
- $[8] = t4;
86
- } else t4 = $[8];
87
- let t5;
88
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
89
- t5 = [];
90
- $[9] = t5;
91
- } else t5 = $[9];
92
- useEffect(t4, t5);
93
- let t6;
94
- if ($[10] !== storage) {
95
- t6 = async (records_0) => {
96
- if (!hydratedRef.current) return;
97
- try {
98
- await storage.saveCustomServers(records_0);
99
- } catch (t7) {
100
- reportCustomStorageFailure("save", t7);
101
- }
102
- };
103
- $[10] = storage;
104
- $[11] = t6;
105
- } else t6 = $[11];
106
- const persistCustomServers = useEffectEvent(t6);
107
- let t7;
108
- if ($[12] !== customServers || $[13] !== persistCustomServers) {
109
- t7 = () => {
110
- persistCustomServers(customServers);
111
- };
112
- $[12] = customServers;
113
- $[13] = persistCustomServers;
114
- $[14] = t7;
115
- } else t7 = $[14];
113
+ $[11] = hydrate;
114
+ $[12] = t7;
115
+ } else t7 = $[12];
116
116
  let t8;
117
- if ($[15] !== customServers) {
118
- t8 = [customServers];
119
- $[15] = customServers;
120
- $[16] = t8;
121
- } else t8 = $[16];
117
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
118
+ t8 = [];
119
+ $[13] = t8;
120
+ } else t8 = $[13];
122
121
  useEffect(t7, t8);
123
- assertUniqueServerIds([...connectors.map(_temp2), ...customServers.map(_temp3)]);
122
+ let t10;
124
123
  let t9;
124
+ if ($[14] !== customServers) {
125
+ t9 = () => {
126
+ if (!hydratedRef.current) return;
127
+ const targetStorage = storageRef.current;
128
+ persistenceQueueRef.current = persistenceQueueRef.current.then(() => persistCustomServers(targetStorage, customServers));
129
+ };
130
+ t10 = [customServers];
131
+ $[14] = customServers;
132
+ $[15] = t10;
133
+ $[16] = t9;
134
+ } else {
135
+ t10 = $[15];
136
+ t9 = $[16];
137
+ }
138
+ useEffect(t9, t10);
139
+ assertUniqueServerIds([...connectors.map(_temp2), ...customServers.map(_temp3)]);
140
+ let t11;
125
141
  if ($[17] !== autoConnect || $[18] !== connectionTimeout || $[19] !== connectors || $[20] !== customServers || $[21] !== redirectUri || $[22] !== storage) {
126
- let t10;
142
+ let t12;
127
143
  if ($[24] !== autoConnect || $[25] !== connectionTimeout || $[26] !== redirectUri || $[27] !== storage) {
128
- t10 = (c_0) => withKey(c_0.id, McpServerResource({
144
+ t12 = (c_0) => withKey(c_0.id, McpServerResource({
129
145
  id: c_0.id,
130
146
  kind: "connector",
131
147
  name: c_0.name,
@@ -144,12 +160,12 @@ const useMcpManagerResource = (props) => {
144
160
  $[25] = connectionTimeout;
145
161
  $[26] = redirectUri;
146
162
  $[27] = storage;
147
- $[28] = t10;
148
- } else t10 = $[28];
149
- const connectorElements = connectors.map(t10);
150
- let t11;
163
+ $[28] = t12;
164
+ } else t12 = $[28];
165
+ const connectorElements = connectors.map(t12);
166
+ let t13;
151
167
  if ($[29] !== autoConnect || $[30] !== connectionTimeout || $[31] !== redirectUri || $[32] !== storage) {
152
- t11 = (s_0) => withKey(s_0.id, McpServerResource({
168
+ t13 = (s_0) => withKey(s_0.id, McpServerResource({
153
169
  id: s_0.id,
154
170
  kind: "custom",
155
171
  name: s_0.name,
@@ -169,47 +185,47 @@ const useMcpManagerResource = (props) => {
169
185
  $[30] = connectionTimeout;
170
186
  $[31] = redirectUri;
171
187
  $[32] = storage;
172
- $[33] = t11;
173
- } else t11 = $[33];
174
- const customElements = customServers.map(t11);
175
- t9 = [...connectorElements, ...customElements];
188
+ $[33] = t13;
189
+ } else t13 = $[33];
190
+ const customElements = customServers.map(t13);
191
+ t11 = [...connectorElements, ...customElements];
176
192
  $[17] = autoConnect;
177
193
  $[18] = connectionTimeout;
178
194
  $[19] = connectors;
179
195
  $[20] = customServers;
180
196
  $[21] = redirectUri;
181
197
  $[22] = storage;
182
- $[23] = t9;
183
- } else t9 = $[23];
184
- const lookup = useClientLookup(t9);
198
+ $[23] = t11;
199
+ } else t11 = $[23];
200
+ const lookup = useClientLookup(t11);
185
201
  const all = lookup.state;
186
- let t10;
202
+ let t12;
187
203
  if ($[34] !== all) {
188
- t10 = all.filter(_temp5);
204
+ t12 = all.filter(_temp5);
189
205
  $[34] = all;
190
- $[35] = t10;
191
- } else t10 = $[35];
192
- let t11;
206
+ $[35] = t12;
207
+ } else t12 = $[35];
208
+ let t13;
193
209
  if ($[36] !== all) {
194
- t11 = all.filter(_temp6);
210
+ t13 = all.filter(_temp6);
195
211
  $[36] = all;
196
- $[37] = t11;
197
- } else t11 = $[37];
198
- let t12;
199
- if ($[38] !== all || $[39] !== isHydrated || $[40] !== t10 || $[41] !== t11) {
200
- t12 = {
212
+ $[37] = t13;
213
+ } else t13 = $[37];
214
+ let t14;
215
+ if ($[38] !== all || $[39] !== isHydrated || $[40] !== t12 || $[41] !== t13) {
216
+ t14 = {
201
217
  servers: all,
202
- connectors: t10,
203
- customServers: t11,
218
+ connectors: t12,
219
+ customServers: t13,
204
220
  isHydrated
205
221
  };
206
222
  $[38] = all;
207
223
  $[39] = isHydrated;
208
- $[40] = t10;
209
- $[41] = t11;
210
- $[42] = t12;
211
- } else t12 = $[42];
212
- const state = t12;
224
+ $[40] = t12;
225
+ $[41] = t13;
226
+ $[42] = t14;
227
+ } else t14 = $[42];
228
+ const state = t14;
213
229
  let out;
214
230
  if ($[43] !== lookup || $[44] !== state.servers) {
215
231
  out = {};
@@ -231,27 +247,27 @@ const useMcpManagerResource = (props) => {
231
247
  } else out = $[45];
232
248
  const toolkit = out;
233
249
  const clientRef = useAssistantClientRef();
234
- let t13;
235
- let t14;
250
+ let t15;
251
+ let t16;
236
252
  if ($[46] !== clientRef || $[47] !== toolkit) {
237
- t13 = () => {
253
+ t15 = () => {
238
254
  const client = clientRef.current;
239
255
  if (!client) return;
240
256
  return client.modelContext.register({ getModelContext: () => ({ tools: toolkit }) });
241
257
  };
242
- t14 = [toolkit, clientRef];
258
+ t16 = [toolkit, clientRef];
243
259
  $[46] = clientRef;
244
260
  $[47] = toolkit;
245
- $[48] = t13;
246
- $[49] = t14;
261
+ $[48] = t15;
262
+ $[49] = t16;
247
263
  } else {
248
- t13 = $[48];
249
- t14 = $[49];
264
+ t15 = $[48];
265
+ t16 = $[49];
250
266
  }
251
- useEffect(t13, t14);
252
- let t15;
267
+ useEffect(t15, t16);
268
+ let t17;
253
269
  if ($[50] !== lookup || $[51] !== state) {
254
- t15 = (kind, index) => {
270
+ t17 = (kind, index) => {
255
271
  const list = kind === "connector" ? state.connectors : state.customServers;
256
272
  const entry = list[index];
257
273
  if (!entry) throw new Error(`McpManagerResource: no ${kind} at index ${index} (length ${list.length})`);
@@ -259,47 +275,47 @@ const useMcpManagerResource = (props) => {
259
275
  };
260
276
  $[50] = lookup;
261
277
  $[51] = state;
262
- $[52] = t15;
263
- } else t15 = $[52];
264
- const serverByKind = t15;
265
- let t16;
278
+ $[52] = t17;
279
+ } else t17 = $[52];
280
+ const serverByKind = t17;
281
+ let t18;
266
282
  if ($[53] !== state) {
267
- t16 = () => state;
283
+ t18 = () => state;
268
284
  $[53] = state;
269
- $[54] = t16;
270
- } else t16 = $[54];
271
- let t17;
285
+ $[54] = t18;
286
+ } else t18 = $[54];
287
+ let t19;
272
288
  if ($[55] !== lookup || $[56] !== serverByKind) {
273
- t17 = (query) => {
289
+ t19 = (query) => {
274
290
  if ("id" in query) return lookup.get({ key: query.id });
275
291
  return serverByKind(query.kind, query.index);
276
292
  };
277
293
  $[55] = lookup;
278
294
  $[56] = serverByKind;
279
- $[57] = t17;
280
- } else t17 = $[57];
281
- let t18;
282
- let t19;
295
+ $[57] = t19;
296
+ } else t19 = $[57];
297
+ let t20;
298
+ let t21;
283
299
  if ($[58] !== serverByKind) {
284
- t18 = (t20) => {
285
- const { index: index_0 } = t20;
300
+ t20 = (t22) => {
301
+ const { index: index_0 } = t22;
286
302
  return serverByKind("connector", index_0);
287
303
  };
288
- t19 = (t21) => {
289
- const { index: index_1 } = t21;
304
+ t21 = (t23) => {
305
+ const { index: index_1 } = t23;
290
306
  return serverByKind("custom", index_1);
291
307
  };
292
308
  $[58] = serverByKind;
293
- $[59] = t18;
294
- $[60] = t19;
309
+ $[59] = t20;
310
+ $[60] = t21;
295
311
  } else {
296
- t18 = $[59];
297
- t19 = $[60];
312
+ t20 = $[59];
313
+ t21 = $[60];
298
314
  }
299
- let t20;
315
+ let t22;
300
316
  if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
301
- t20 = async (t21) => {
302
- const { name, url, auth, connectionTimeout: connectionTimeout_0, cache, elicitation } = t21;
317
+ t22 = async (t23) => {
318
+ const { name, url, auth, connectionTimeout: connectionTimeout_0, cache, elicitation } = t23;
303
319
  const record = {
304
320
  id: typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `mcp-${Date.now()}-${Math.random().toString(36).slice(2)}`,
305
321
  name,
@@ -313,11 +329,11 @@ const useMcpManagerResource = (props) => {
313
329
  setCustomServers((prev_1) => [...prev_1, record]);
314
330
  return record.id;
315
331
  };
316
- $[61] = t20;
317
- } else t20 = $[61];
318
- let t21;
332
+ $[61] = t22;
333
+ } else t22 = $[61];
334
+ let t23;
319
335
  if ($[62] !== lookup || $[63] !== state || $[64] !== storage) {
320
- t21 = async (id) => {
336
+ t23 = async (id) => {
321
337
  if (state.connectors.some((c_1) => c_1.id === id)) throw new Error(`Cannot remove connector "${id}" — connectors are app-defined and not removable. Use a custom server id instead.`);
322
338
  try {
323
339
  await lookup.get({ key: id }).remove();
@@ -329,26 +345,26 @@ const useMcpManagerResource = (props) => {
329
345
  $[62] = lookup;
330
346
  $[63] = state;
331
347
  $[64] = storage;
332
- $[65] = t21;
333
- } else t21 = $[65];
334
- let t22;
335
- if ($[66] !== t16 || $[67] !== t17 || $[68] !== t18 || $[69] !== t19 || $[70] !== t21) {
336
- t22 = {
337
- getState: t16,
338
- server: t17,
339
- connector: t18,
340
- customServer: t19,
341
- addCustomServer: t20,
342
- removeServer: t21
348
+ $[65] = t23;
349
+ } else t23 = $[65];
350
+ let t24;
351
+ if ($[66] !== t18 || $[67] !== t19 || $[68] !== t20 || $[69] !== t21 || $[70] !== t23) {
352
+ t24 = {
353
+ getState: t18,
354
+ server: t19,
355
+ connector: t20,
356
+ customServer: t21,
357
+ addCustomServer: t22,
358
+ removeServer: t23
343
359
  };
344
- $[66] = t16;
345
- $[67] = t17;
346
- $[68] = t18;
347
- $[69] = t19;
348
- $[70] = t21;
349
- $[71] = t22;
350
- } else t22 = $[71];
351
- return t22;
360
+ $[66] = t18;
361
+ $[67] = t19;
362
+ $[68] = t20;
363
+ $[69] = t21;
364
+ $[70] = t23;
365
+ $[71] = t24;
366
+ } else t24 = $[71];
367
+ return t24;
352
368
  };
353
369
  const McpManagerResource = resource(useMcpManagerResource);
354
370
  attachTransformScopes(useMcpManagerResource, (scopes, parent) => {