@assistant-ui/react-mcp 0.0.16 → 0.0.18

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 (106) hide show
  1. package/dist/auth/buildHeaders.d.ts +0 -1
  2. package/dist/auth/buildHeaders.d.ts.map +1 -1
  3. package/dist/auth/createOAuthProvider.d.ts +4 -3
  4. package/dist/auth/createOAuthProvider.d.ts.map +1 -1
  5. package/dist/auth/createOAuthProvider.js +2 -1
  6. package/dist/auth/createOAuthProvider.js.map +1 -1
  7. package/dist/auth/types.d.ts +2 -2
  8. package/dist/auth/types.d.ts.map +1 -1
  9. package/dist/connector.d.ts +0 -1
  10. package/dist/connector.d.ts.map +1 -1
  11. package/dist/context/McpConnectorByIndexProvider.d.ts +0 -1
  12. package/dist/context/McpConnectorByIndexProvider.d.ts.map +1 -1
  13. package/dist/context/McpCustomServerByIndexProvider.d.ts +0 -1
  14. package/dist/context/McpCustomServerByIndexProvider.d.ts.map +1 -1
  15. package/dist/context/McpServerByIdProvider.d.ts +0 -1
  16. package/dist/context/McpServerByIdProvider.d.ts.map +1 -1
  17. package/dist/hooks/useMcpOAuthCallback.d.ts +4 -3
  18. package/dist/hooks/useMcpOAuthCallback.d.ts.map +1 -1
  19. package/dist/hooks/useMcpOAuthCallback.js +14 -8
  20. package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
  21. package/dist/mcp-scope.d.ts +19 -6
  22. package/dist/mcp-scope.d.ts.map +1 -1
  23. package/dist/primitives/addForm/McpAddFormAuthFields.d.ts +0 -1
  24. package/dist/primitives/addForm/McpAddFormAuthFields.d.ts.map +1 -1
  25. package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts +0 -1
  26. package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts.map +1 -1
  27. package/dist/primitives/addForm/McpAddFormCancel.d.ts +0 -1
  28. package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
  29. package/dist/primitives/addForm/McpAddFormError.d.ts +0 -1
  30. package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
  31. package/dist/primitives/addForm/McpAddFormNameField.d.ts +0 -1
  32. package/dist/primitives/addForm/McpAddFormNameField.d.ts.map +1 -1
  33. package/dist/primitives/addForm/McpAddFormRoot.d.ts +0 -1
  34. package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
  35. package/dist/primitives/addForm/McpAddFormSubmit.d.ts +0 -1
  36. package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
  37. package/dist/primitives/addForm/McpAddFormUrlField.d.ts +0 -1
  38. package/dist/primitives/addForm/McpAddFormUrlField.d.ts.map +1 -1
  39. package/dist/primitives/addForm/context.d.ts +0 -1
  40. package/dist/primitives/addForm/context.d.ts.map +1 -1
  41. package/dist/primitives/addForm.d.ts +0 -2
  42. package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts +0 -1
  43. package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
  44. package/dist/primitives/manager/McpManagerConnectors.d.ts +0 -1
  45. package/dist/primitives/manager/McpManagerConnectors.d.ts.map +1 -1
  46. package/dist/primitives/manager/McpManagerCustomServers.d.ts +0 -1
  47. package/dist/primitives/manager/McpManagerCustomServers.d.ts.map +1 -1
  48. package/dist/primitives/manager/McpManagerRoot.d.ts +0 -1
  49. package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
  50. package/dist/primitives/manager.d.ts +0 -2
  51. package/dist/primitives/server/McpServerConnectButton.d.ts +0 -1
  52. package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
  53. package/dist/primitives/server/McpServerDisconnectButton.d.ts +0 -1
  54. package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
  55. package/dist/primitives/server/McpServerError.d.ts +0 -1
  56. package/dist/primitives/server/McpServerError.d.ts.map +1 -1
  57. package/dist/primitives/server/McpServerIcon.d.ts +4 -3
  58. package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
  59. package/dist/primitives/server/McpServerName.d.ts +0 -1
  60. package/dist/primitives/server/McpServerName.d.ts.map +1 -1
  61. package/dist/primitives/server/McpServerOAuthLink.d.ts +4 -3
  62. package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
  63. package/dist/primitives/server/McpServerRemoveButton.d.ts +0 -1
  64. package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
  65. package/dist/primitives/server/McpServerRoot.d.ts +0 -1
  66. package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
  67. package/dist/primitives/server/McpServerStatus.d.ts +0 -1
  68. package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
  69. package/dist/primitives/server/McpServerToolName.d.ts +0 -1
  70. package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
  71. package/dist/primitives/server/McpServerTools.d.ts +0 -1
  72. package/dist/primitives/server/McpServerTools.d.ts.map +1 -1
  73. package/dist/primitives/server.d.ts +0 -2
  74. package/dist/resources/McpManagerResource.d.ts +6 -3
  75. package/dist/resources/McpManagerResource.d.ts.map +1 -1
  76. package/dist/resources/McpManagerResource.js +122 -107
  77. package/dist/resources/McpManagerResource.js.map +1 -1
  78. package/dist/resources/McpServerResource.d.ts +1 -1
  79. package/dist/resources/McpServerResource.d.ts.map +1 -1
  80. package/dist/resources/McpServerResource.js +28 -5
  81. package/dist/resources/McpServerResource.js.map +1 -1
  82. package/dist/resources/storage/McpCustomStorage.d.ts +0 -1
  83. package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
  84. package/dist/resources/storage/McpLocalStorage.d.ts +8 -3
  85. package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
  86. package/dist/resources/storage/McpLocalStorage.js +55 -3
  87. package/dist/resources/storage/McpLocalStorage.js.map +1 -1
  88. package/dist/resources/storage/McpMemoryStorage.d.ts +0 -1
  89. package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
  90. package/dist/resources/storage/types.d.ts +0 -1
  91. package/dist/resources/storage/types.d.ts.map +1 -1
  92. package/dist/utils/serverId.d.ts +2 -1
  93. package/dist/utils/serverId.d.ts.map +1 -1
  94. package/dist/utils/serverId.js +8 -1
  95. package/dist/utils/serverId.js.map +1 -1
  96. package/package.json +11 -8
  97. package/src/hooks/useMcpOAuthCallback.test.ts +24 -0
  98. package/src/hooks/useMcpOAuthCallback.tsx +20 -5
  99. package/src/mcp-scope.ts +5 -0
  100. package/src/resources/McpManagerResource.test.ts +40 -0
  101. package/src/resources/McpManagerResource.ts +21 -2
  102. package/src/resources/McpServerResource.test.ts +364 -0
  103. package/src/resources/McpServerResource.ts +51 -3
  104. package/src/resources/storage/McpLocalStorage.test.ts +184 -0
  105. package/src/resources/storage/McpLocalStorage.ts +113 -3
  106. package/src/utils/serverId.ts +12 -0
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerDisconnectButton.d.ts
5
4
  declare namespace McpServerPrimitiveDisconnectButton {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerDisconnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerDisconnectButton.tsx"],"mappings":";;;;kBAQiB,kCAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAKnD,kCAAA,kBAAkC,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"McpServerDisconnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerDisconnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,oDAAkC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerError.d.ts
5
4
  declare namespace McpServerPrimitiveError {
6
5
  type Element = ComponentRef<typeof Primitive.div>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerError.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerError.tsx"],"mappings":";;;;kBAQiB,uBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,GAAA;AAAA;AAAA,cAGnD,uBAAA,kBAAuB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,cAAA,oBAAA,cAAA,CAAA,cAAA"}
1
+ {"version":3,"file":"McpServerError.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
@@ -1,18 +1,19 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerIcon.d.ts
5
4
  declare namespace McpServerPrimitiveIcon {
6
5
  type Element = ComponentRef<typeof Primitive.img>;
7
6
  type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.img>, "src" | "alt"> & {
8
- /** Override the icon URL. Defaults to the server's icon prop. */src?: string;
7
+ /** Override the icon URL. Defaults to the server's icon prop. */
8
+ src?: string;
9
9
  alt?: string;
10
10
  };
11
11
  }
12
12
  declare const McpServerPrimitiveIcon: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLImageElement> & import("react").ImgHTMLAttributes<HTMLImageElement> & {
13
13
  asChild?: boolean;
14
14
  }, "ref">, "alt" | "src"> & {
15
- /** Override the icon URL. Defaults to the server's icon prop. */src?: string;
15
+ /** Override the icon URL. Defaults to the server's icon prop. */
16
+ src?: string;
16
17
  alt?: string;
17
18
  } & import("react").RefAttributes<HTMLImageElement>>;
18
19
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerIcon.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerIcon.tsx"],"mappings":";;;;kBAQiB,sBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,GAAA;IAHP,iEAOnC,GAAA;IACA,GAAA;EAAA;AAAA;AAAA,cAIS,sBAAA,kBAAsB,yBAAA,CAAA,IAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,gBAAA,oBAAA,iBAAA,CAAA,gBAAA;;;EAVT"}
1
+ {"version":3,"file":"McpServerIcon.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerIcon.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;IACA;;;cAIS,wCAAsB,0BAAA,KAAA,qBAAA,gBAAA,oCAAA,kBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerName.d.ts
5
4
  declare namespace McpServerPrimitiveName {
6
5
  type Element = ComponentRef<typeof Primitive.span>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerName.tsx"],"mappings":";;;;kBAQiB,sBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,IAAA;AAAA;AAAA,cAGnD,sBAAA,kBAAsB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,cAAA,CAAA,eAAA"}
1
+ {"version":3,"file":"McpServerName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
@@ -1,17 +1,18 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerOAuthLink.d.ts
5
4
  declare namespace McpServerPrimitiveOAuthLink {
6
5
  type Element = ComponentRef<typeof Primitive.a>;
7
6
  type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.a>, "href"> & {
8
- /** Optional href override; defaults to the server's authorizationUrl. */href?: string;
7
+ /** Optional href override; defaults to the server's authorizationUrl. */
8
+ href?: string;
9
9
  };
10
10
  }
11
11
  declare const McpServerPrimitiveOAuthLink: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLAnchorElement> & import("react").AnchorHTMLAttributes<HTMLAnchorElement> & {
12
12
  asChild?: boolean;
13
13
  }, "ref">, "href"> & {
14
- /** Optional href override; defaults to the server's authorizationUrl. */href?: string;
14
+ /** Optional href override; defaults to the server's authorizationUrl. */
15
+ href?: string;
15
16
  } & import("react").RefAttributes<HTMLAnchorElement>>;
16
17
  //#endregion
17
18
  export { McpServerPrimitiveOAuthLink };
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerOAuthLink.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerOAuthLink.tsx"],"mappings":";;;;kBAQiB,2BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,CAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,CAAA;IAHF,yEAOxC,IAAA;EAAA;AAAA;AAAA,cAIS,2BAAA,kBAA2B,yBAAA,CAAA,IAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA;;;EATd"}
1
+ {"version":3,"file":"McpServerOAuthLink.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerOAuthLink.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;IAI1C;;;cAIS,6CAA2B,0BAAA,KAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerRemoveButton.d.ts
5
4
  declare namespace McpServerPrimitiveRemoveButton {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerRemoveButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"mappings":";;;;kBAQiB,8BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAGnD,8BAAA,kBAA8B,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"McpServerRemoveButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRemoveButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,gDAA8B,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerRoot.d.ts
5
4
  declare namespace McpServerPrimitiveRoot {
6
5
  type Element = ComponentRef<typeof Primitive.div>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerRoot.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRoot.tsx"],"mappings":";;;;kBAQiB,sBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,GAAA;AAAA;AAAA,cAGnD,sBAAA,kBAAsB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,cAAA,oBAAA,cAAA,CAAA,cAAA"}
1
+ {"version":3,"file":"McpServerRoot.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,wCAAsB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerStatus.d.ts
5
4
  declare namespace McpServerPrimitiveStatus {
6
5
  type Element = ComponentRef<typeof Primitive.span>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerStatus.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"mappings":";;;;kBAQiB,wBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,IAAA;AAAA;AAAA,cAGnD,wBAAA,kBAAwB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,cAAA,CAAA,eAAA"}
1
+ {"version":3,"file":"McpServerStatus.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerStatus.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
@@ -1,6 +1,5 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
-
4
3
  //#region src/primitives/server/McpServerToolName.d.ts
5
4
  declare namespace McpServerPrimitiveToolName {
6
5
  type Element = ComponentRef<typeof Primitive.span>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerToolName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"mappings":";;;;kBAQiB,0BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,IAAA;AAAA;AAAA,cAGnD,0BAAA,kBAA0B,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,cAAA,CAAA,eAAA"}
1
+ {"version":3,"file":"McpServerToolName.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerToolName.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,4CAA0B,0BAAA,qBAAA,gBAAA,mCAAA,eAAA"}
@@ -1,6 +1,5 @@
1
1
  import { MCPToolInfo } from "../../mcp-scope.js";
2
2
  import { FC, ReactNode } from "react";
3
-
4
3
  //#region src/primitives/server/McpServerTools.d.ts
5
4
  declare const useMcpServerTool: () => MCPToolInfo;
6
5
  declare namespace McpServerPrimitiveTools {
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerTools.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerTools.tsx"],"mappings":";;;;cAMa,gBAAA,QAAuB,WAQnC;AAAA,kBAEgB,uBAAA;EAAA,KACH,KAAA;IACV,QAAA,EAAU,SAAA,KAAc,IAAA,EAAM,WAAA,KAAgB,SAAA;EAAA;AAAA;AAAA,cAIrC,uBAAA,EAAyB,EAAE,CAAC,uBAAA,CAAwB,KAAA"}
1
+ {"version":3,"file":"McpServerTools.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerTools.tsx"],"mappings":";;;cAMa,wBAAuB;kBAUnB;OACH;IACV,UAAU,cAAc,MAAM,gBAAgB;;;cAIrC,yBAAyB,GAAG,wBAAwB"}
@@ -9,8 +9,6 @@ import { McpServerPrimitiveRemoveButton } from "./server/McpServerRemoveButton.j
9
9
  import { McpServerPrimitiveOAuthLink } from "./server/McpServerOAuthLink.js";
10
10
  import { McpServerPrimitiveTools, useMcpServerTool } from "./server/McpServerTools.js";
11
11
  import { McpServerPrimitiveToolName } from "./server/McpServerToolName.js";
12
-
13
- //#region src/primitives/server.d.ts
14
12
  declare namespace server_d_exports {
15
13
  export { McpServerPrimitiveConnectButton as ConnectButton, McpServerPrimitiveDisconnectButton as DisconnectButton, McpServerPrimitiveError as Error, McpServerPrimitiveIcon as Icon, McpServerPrimitiveName as Name, McpServerPrimitiveOAuthLink as OAuthLink, McpServerPrimitiveRemoveButton as RemoveButton, McpServerPrimitiveRoot as Root, McpServerPrimitiveStatus as Status, McpServerPrimitiveToolName as ToolName, McpServerPrimitiveTools as Tools, useMcpServerTool };
16
14
  }
@@ -1,13 +1,16 @@
1
1
  import { MCPConnector } from "../mcp-scope.js";
2
2
  import { MCPStorageElement } from "./storage/types.js";
3
3
  import { ClientOutput } from "@assistant-ui/store";
4
-
5
4
  //#region src/resources/McpManagerResource.d.ts
6
5
  type McpManagerResourceProps = {
7
6
  connectors?: MCPConnector[] | undefined;
8
- storage?: MCPStorageElement | undefined; /** OAuth redirect target. Defaults to `${origin}/mcp/callback`. */
9
- oauthRedirectUri?: string | undefined; /** Connect on mount when usable auth exists. Default true. */
7
+ storage?: MCPStorageElement | undefined;
8
+ /** OAuth redirect target. Defaults to `${origin}/mcp/callback`. */
9
+ oauthRedirectUri?: string | undefined;
10
+ /** Connect on mount when usable auth exists. Default true. */
10
11
  autoConnect?: boolean | undefined;
12
+ /** Optional timeout in milliseconds for connect/listTools calls. Disabled by default. */
13
+ connectionTimeout?: number | undefined;
11
14
  };
12
15
  declare const McpManagerResource: import("@assistant-ui/tap").Resource<ClientOutput<"mcp">, [props: McpManagerResourceProps]>;
13
16
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerResource.d.ts","names":[],"sources":["../../src/resources/McpManagerResource.ts"],"mappings":";;;;;KAoBY,uBAAA;EACV,UAAA,GAAa,YAAA;EACb,OAAA,GAAU,iBAAiB,cAFM;EAIjC,gBAAA,uBAF2B;EAI3B,WAAA;AAAA;AAAA,cA4NW,kBAAA,8BAAkB,QAAA,CAAA,YAAA,UAAA,KAAA,EAAA,uBAAA"}
1
+ {"version":3,"file":"McpManagerResource.d.ts","names":[],"sources":["../../src/resources/McpManagerResource.ts"],"mappings":";;;;KAqBY;EACV,aAAa;EACb,UAAU;;EAEV;;EAEA;;EAEA;;cA4OW,gDAAkB,SAAA,sBAAA,OAAA"}
@@ -1,3 +1,4 @@
1
+ import { assertUniqueServerIds } from "../utils/serverId.js";
1
2
  import { McpServerResource } from "./McpServerResource.js";
2
3
  import { McpLocalStorage } from "./storage/McpLocalStorage.js";
3
4
  import { attachTransformScopes, useAssistantClientRef, useClientLookup } from "@assistant-ui/store";
@@ -12,7 +13,7 @@ function defaultRedirectUri() {
12
13
  }
13
14
  const NO_CONNECTORS = [];
14
15
  const useMcpManagerResource = (props) => {
15
- const $ = c(69);
16
+ const $ = c(72);
16
17
  const connectors = props.connectors ?? NO_CONNECTORS;
17
18
  const autoConnect = props.autoConnect ?? true;
18
19
  let t0;
@@ -22,6 +23,7 @@ const useMcpManagerResource = (props) => {
22
23
  $[1] = t0;
23
24
  } else t0 = $[1];
24
25
  const redirectUri = t0;
26
+ const connectionTimeout = props.connectionTimeout;
25
27
  let t1;
26
28
  if ($[2] !== props.storage) {
27
29
  t1 = props.storage ?? McpLocalStorage();
@@ -110,88 +112,94 @@ const useMcpManagerResource = (props) => {
110
112
  $[16] = t8;
111
113
  } else t8 = $[16];
112
114
  useEffect(t7, t8);
115
+ assertUniqueServerIds([...connectors.map(_temp2), ...customServers.map(_temp3)]);
113
116
  let t9;
114
- if ($[17] !== autoConnect || $[18] !== connectors || $[19] !== customServers || $[20] !== redirectUri || $[21] !== storage) {
117
+ if ($[17] !== autoConnect || $[18] !== connectionTimeout || $[19] !== connectors || $[20] !== customServers || $[21] !== redirectUri || $[22] !== storage) {
115
118
  let t10;
116
- if ($[23] !== autoConnect || $[24] !== redirectUri || $[25] !== storage) {
117
- t10 = (c) => withKey(c.id, McpServerResource({
118
- id: c.id,
119
+ if ($[24] !== autoConnect || $[25] !== connectionTimeout || $[26] !== redirectUri || $[27] !== storage) {
120
+ t10 = (c_0) => withKey(c_0.id, McpServerResource({
121
+ id: c_0.id,
119
122
  kind: "connector",
120
- name: c.name,
121
- url: c.url,
122
- icon: c.icon,
123
- auth: c.auth,
123
+ name: c_0.name,
124
+ url: c_0.url,
125
+ icon: c_0.icon,
126
+ auth: c_0.auth,
124
127
  storage,
125
128
  redirectUri,
126
129
  autoConnect,
127
- onRemove: _temp2
130
+ connectionTimeout: c_0.connectionTimeout ?? connectionTimeout,
131
+ onRemove: _temp4
128
132
  }));
129
- $[23] = autoConnect;
130
- $[24] = redirectUri;
131
- $[25] = storage;
132
- $[26] = t10;
133
- } else t10 = $[26];
133
+ $[24] = autoConnect;
134
+ $[25] = connectionTimeout;
135
+ $[26] = redirectUri;
136
+ $[27] = storage;
137
+ $[28] = t10;
138
+ } else t10 = $[28];
134
139
  const connectorElements = connectors.map(t10);
135
140
  let t11;
136
- if ($[27] !== autoConnect || $[28] !== redirectUri || $[29] !== storage) {
137
- t11 = (s) => withKey(s.id, McpServerResource({
138
- id: s.id,
141
+ if ($[29] !== autoConnect || $[30] !== connectionTimeout || $[31] !== redirectUri || $[32] !== storage) {
142
+ t11 = (s_0) => withKey(s_0.id, McpServerResource({
143
+ id: s_0.id,
139
144
  kind: "custom",
140
- name: s.name,
141
- url: s.url,
142
- auth: s.auth,
145
+ name: s_0.name,
146
+ url: s_0.url,
147
+ auth: s_0.auth,
143
148
  storage,
144
149
  redirectUri,
145
150
  autoConnect,
151
+ connectionTimeout: s_0.connectionTimeout ?? connectionTimeout,
146
152
  onRemove: async () => {
147
- setCustomServers((prev_0) => prev_0.filter((x) => x.id !== s.id));
153
+ setCustomServers((prev_0) => prev_0.filter((x) => x.id !== s_0.id));
148
154
  }
149
155
  }));
150
- $[27] = autoConnect;
151
- $[28] = redirectUri;
152
- $[29] = storage;
153
- $[30] = t11;
154
- } else t11 = $[30];
156
+ $[29] = autoConnect;
157
+ $[30] = connectionTimeout;
158
+ $[31] = redirectUri;
159
+ $[32] = storage;
160
+ $[33] = t11;
161
+ } else t11 = $[33];
155
162
  const customElements = customServers.map(t11);
156
163
  t9 = [...connectorElements, ...customElements];
157
164
  $[17] = autoConnect;
158
- $[18] = connectors;
159
- $[19] = customServers;
160
- $[20] = redirectUri;
161
- $[21] = storage;
162
- $[22] = t9;
163
- } else t9 = $[22];
165
+ $[18] = connectionTimeout;
166
+ $[19] = connectors;
167
+ $[20] = customServers;
168
+ $[21] = redirectUri;
169
+ $[22] = storage;
170
+ $[23] = t9;
171
+ } else t9 = $[23];
164
172
  const lookup = useClientLookup(t9);
165
173
  const all = lookup.state;
166
174
  let t10;
167
- if ($[31] !== all) {
168
- t10 = all.filter(_temp3);
169
- $[31] = all;
170
- $[32] = t10;
171
- } else t10 = $[32];
175
+ if ($[34] !== all) {
176
+ t10 = all.filter(_temp5);
177
+ $[34] = all;
178
+ $[35] = t10;
179
+ } else t10 = $[35];
172
180
  let t11;
173
- if ($[33] !== all) {
174
- t11 = all.filter(_temp4);
175
- $[33] = all;
176
- $[34] = t11;
177
- } else t11 = $[34];
181
+ if ($[36] !== all) {
182
+ t11 = all.filter(_temp6);
183
+ $[36] = all;
184
+ $[37] = t11;
185
+ } else t11 = $[37];
178
186
  let t12;
179
- if ($[35] !== all || $[36] !== isHydrated || $[37] !== t10 || $[38] !== t11) {
187
+ if ($[38] !== all || $[39] !== isHydrated || $[40] !== t10 || $[41] !== t11) {
180
188
  t12 = {
181
189
  servers: all,
182
190
  connectors: t10,
183
191
  customServers: t11,
184
192
  isHydrated
185
193
  };
186
- $[35] = all;
187
- $[36] = isHydrated;
188
- $[37] = t10;
189
- $[38] = t11;
190
- $[39] = t12;
191
- } else t12 = $[39];
194
+ $[38] = all;
195
+ $[39] = isHydrated;
196
+ $[40] = t10;
197
+ $[41] = t11;
198
+ $[42] = t12;
199
+ } else t12 = $[42];
192
200
  const state = t12;
193
201
  let out;
194
- if ($[40] !== lookup || $[41] !== state.servers) {
202
+ if ($[43] !== lookup || $[44] !== state.servers) {
195
203
  out = {};
196
204
  for (const server of state.servers) {
197
205
  if (server.connectionState !== "connected") continue;
@@ -205,62 +213,62 @@ const useMcpManagerResource = (props) => {
205
213
  };
206
214
  }
207
215
  }
208
- $[40] = lookup;
209
- $[41] = state.servers;
210
- $[42] = out;
211
- } else out = $[42];
216
+ $[43] = lookup;
217
+ $[44] = state.servers;
218
+ $[45] = out;
219
+ } else out = $[45];
212
220
  const toolkit = out;
213
221
  const clientRef = useAssistantClientRef();
214
222
  let t13;
215
223
  let t14;
216
- if ($[43] !== clientRef || $[44] !== toolkit) {
224
+ if ($[46] !== clientRef || $[47] !== toolkit) {
217
225
  t13 = () => {
218
226
  const client = clientRef.current;
219
227
  if (!client) return;
220
228
  return client.modelContext().register({ getModelContext: () => ({ tools: toolkit }) });
221
229
  };
222
230
  t14 = [toolkit, clientRef];
223
- $[43] = clientRef;
224
- $[44] = toolkit;
225
- $[45] = t13;
226
- $[46] = t14;
231
+ $[46] = clientRef;
232
+ $[47] = toolkit;
233
+ $[48] = t13;
234
+ $[49] = t14;
227
235
  } else {
228
- t13 = $[45];
229
- t14 = $[46];
236
+ t13 = $[48];
237
+ t14 = $[49];
230
238
  }
231
239
  useEffect(t13, t14);
232
240
  let t15;
233
- if ($[47] !== lookup || $[48] !== state) {
241
+ if ($[50] !== lookup || $[51] !== state) {
234
242
  t15 = (kind, index) => {
235
243
  const list = kind === "connector" ? state.connectors : state.customServers;
236
244
  const entry = list[index];
237
245
  if (!entry) throw new Error(`McpManagerResource: no ${kind} at index ${index} (length ${list.length})`);
238
246
  return lookup.get({ key: entry.id });
239
247
  };
240
- $[47] = lookup;
241
- $[48] = state;
242
- $[49] = t15;
243
- } else t15 = $[49];
248
+ $[50] = lookup;
249
+ $[51] = state;
250
+ $[52] = t15;
251
+ } else t15 = $[52];
244
252
  const serverByKind = t15;
245
253
  let t16;
246
- if ($[50] !== state) {
254
+ if ($[53] !== state) {
247
255
  t16 = () => state;
248
- $[50] = state;
249
- $[51] = t16;
250
- } else t16 = $[51];
256
+ $[53] = state;
257
+ $[54] = t16;
258
+ } else t16 = $[54];
251
259
  let t17;
252
- if ($[52] !== lookup || $[53] !== serverByKind) {
260
+ if ($[55] !== lookup || $[56] !== serverByKind) {
253
261
  t17 = (query) => {
254
262
  if ("id" in query) return lookup.get({ key: query.id });
255
263
  return serverByKind(query.kind, query.index);
256
264
  };
257
- $[52] = lookup;
258
- $[53] = serverByKind;
259
- $[54] = t17;
260
- } else t17 = $[54];
265
+ $[55] = lookup;
266
+ $[56] = serverByKind;
267
+ $[57] = t17;
268
+ } else t17 = $[57];
261
269
  let t18;
262
270
  let t19;
263
- if ($[55] !== serverByKind) {
271
+ if ($[58] !== serverByKind) {
264
272
  t18 = (t20) => {
265
273
  const { index: index_0 } = t20;
266
274
  return serverByKind("connector", index_0);
@@ -269,47 +277,48 @@ const useMcpManagerResource = (props) => {
269
277
  const { index: index_1 } = t21;
270
278
  return serverByKind("custom", index_1);
271
279
  };
272
- $[55] = serverByKind;
273
- $[56] = t18;
274
- $[57] = t19;
280
+ $[58] = serverByKind;
281
+ $[59] = t18;
282
+ $[60] = t19;
275
283
  } else {
276
- t18 = $[56];
277
- t19 = $[57];
284
+ t18 = $[59];
285
+ t19 = $[60];
278
286
  }
279
287
  let t20;
280
- if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
288
+ if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
281
289
  t20 = async (t21) => {
282
- const { name, url, auth } = t21;
290
+ const { name, url, auth, connectionTimeout: connectionTimeout_0 } = t21;
283
291
  const record = {
284
292
  id: typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `mcp-${Date.now()}-${Math.random().toString(36).slice(2)}`,
285
293
  name,
286
294
  url,
287
295
  auth,
296
+ connectionTimeout: connectionTimeout_0,
288
297
  createdAt: Date.now()
289
298
  };
290
299
  setCustomServers((prev_1) => [...prev_1, record]);
291
300
  return record.id;
292
301
  };
293
- $[58] = t20;
294
- } else t20 = $[58];
302
+ $[61] = t20;
303
+ } else t20 = $[61];
295
304
  let t21;
296
- if ($[59] !== lookup || $[60] !== state || $[61] !== storage) {
305
+ if ($[62] !== lookup || $[63] !== state || $[64] !== storage) {
297
306
  t21 = async (id) => {
298
- if (state.connectors.some((c_0) => c_0.id === id)) throw new Error(`Cannot remove connector "${id}" — connectors are app-defined and not removable. Use a custom server id instead.`);
307
+ 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.`);
299
308
  try {
300
309
  await lookup.get({ key: id }).remove();
301
310
  } catch {
302
311
  await storage.clearAuthState(id);
303
- setCustomServers((prev_2) => prev_2.filter((s_2) => s_2.id !== id));
312
+ setCustomServers((prev_2) => prev_2.filter((s_3) => s_3.id !== id));
304
313
  }
305
314
  };
306
- $[59] = lookup;
307
- $[60] = state;
308
- $[61] = storage;
309
- $[62] = t21;
310
- } else t21 = $[62];
315
+ $[62] = lookup;
316
+ $[63] = state;
317
+ $[64] = storage;
318
+ $[65] = t21;
319
+ } else t21 = $[65];
311
320
  let t22;
312
- if ($[63] !== t16 || $[64] !== t17 || $[65] !== t18 || $[66] !== t19 || $[67] !== t21) {
321
+ if ($[66] !== t16 || $[67] !== t17 || $[68] !== t18 || $[69] !== t19 || $[70] !== t21) {
313
322
  t22 = {
314
323
  getState: t16,
315
324
  server: t17,
@@ -318,13 +327,13 @@ const useMcpManagerResource = (props) => {
318
327
  addCustomServer: t20,
319
328
  removeServer: t21
320
329
  };
321
- $[63] = t16;
322
- $[64] = t17;
323
- $[65] = t18;
324
- $[66] = t19;
325
- $[67] = t21;
326
- $[68] = t22;
327
- } else t22 = $[68];
330
+ $[66] = t16;
331
+ $[67] = t17;
332
+ $[68] = t18;
333
+ $[69] = t19;
334
+ $[70] = t21;
335
+ $[71] = t22;
336
+ } else t22 = $[71];
328
337
  return t22;
329
338
  };
330
339
  const McpManagerResource = resource(useMcpManagerResource);
@@ -334,12 +343,18 @@ attachTransformScopes(useMcpManagerResource, (scopes, parent) => {
334
343
  function _temp(r) {
335
344
  return r.id;
336
345
  }
337
- async function _temp2() {}
338
- function _temp3(s_0) {
339
- return s_0.kind === "connector";
346
+ function _temp2(c) {
347
+ return c.id;
340
348
  }
341
- function _temp4(s_1) {
342
- return s_1.kind === "custom";
349
+ function _temp3(s) {
350
+ return s.id;
351
+ }
352
+ async function _temp4() {}
353
+ function _temp5(s_1) {
354
+ return s_1.kind === "connector";
355
+ }
356
+ function _temp6(s_2) {
357
+ return s_2.kind === "custom";
343
358
  }
344
359
  //#endregion
345
360
  export { McpManagerResource };