@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.
- package/dist/auth/buildHeaders.d.ts +0 -1
- package/dist/auth/buildHeaders.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.d.ts +4 -3
- package/dist/auth/createOAuthProvider.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.js +2 -1
- package/dist/auth/createOAuthProvider.js.map +1 -1
- package/dist/auth/types.d.ts +2 -2
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/connector.d.ts +0 -1
- package/dist/connector.d.ts.map +1 -1
- package/dist/context/McpConnectorByIndexProvider.d.ts +0 -1
- package/dist/context/McpConnectorByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpCustomServerByIndexProvider.d.ts +0 -1
- package/dist/context/McpCustomServerByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpServerByIdProvider.d.ts +0 -1
- package/dist/context/McpServerByIdProvider.d.ts.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.d.ts +4 -3
- package/dist/hooks/useMcpOAuthCallback.d.ts.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.js +14 -8
- package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
- package/dist/mcp-scope.d.ts +19 -6
- package/dist/mcp-scope.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormCancel.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormError.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormNameField.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormNameField.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts.map +1 -1
- package/dist/primitives/addForm/context.d.ts +0 -1
- package/dist/primitives/addForm/context.d.ts.map +1 -1
- package/dist/primitives/addForm.d.ts +0 -2
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts +0 -1
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerConnectors.d.ts +0 -1
- package/dist/primitives/manager/McpManagerConnectors.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerCustomServers.d.ts +0 -1
- package/dist/primitives/manager/McpManagerCustomServers.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerRoot.d.ts +0 -1
- package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
- package/dist/primitives/manager.d.ts +0 -2
- package/dist/primitives/server/McpServerConnectButton.d.ts +0 -1
- package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerDisconnectButton.d.ts +0 -1
- package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerError.d.ts +0 -1
- package/dist/primitives/server/McpServerError.d.ts.map +1 -1
- package/dist/primitives/server/McpServerIcon.d.ts +4 -3
- package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
- package/dist/primitives/server/McpServerName.d.ts +0 -1
- package/dist/primitives/server/McpServerName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerOAuthLink.d.ts +4 -3
- package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRemoveButton.d.ts +0 -1
- package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRoot.d.ts +0 -1
- package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
- package/dist/primitives/server/McpServerStatus.d.ts +0 -1
- package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
- package/dist/primitives/server/McpServerToolName.d.ts +0 -1
- package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerTools.d.ts +0 -1
- package/dist/primitives/server/McpServerTools.d.ts.map +1 -1
- package/dist/primitives/server.d.ts +0 -2
- package/dist/resources/McpManagerResource.d.ts +6 -3
- package/dist/resources/McpManagerResource.d.ts.map +1 -1
- package/dist/resources/McpManagerResource.js +122 -107
- package/dist/resources/McpManagerResource.js.map +1 -1
- package/dist/resources/McpServerResource.d.ts +1 -1
- package/dist/resources/McpServerResource.d.ts.map +1 -1
- package/dist/resources/McpServerResource.js +28 -5
- package/dist/resources/McpServerResource.js.map +1 -1
- package/dist/resources/storage/McpCustomStorage.d.ts +0 -1
- package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.d.ts +8 -3
- package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.js +55 -3
- package/dist/resources/storage/McpLocalStorage.js.map +1 -1
- package/dist/resources/storage/McpMemoryStorage.d.ts +0 -1
- package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
- package/dist/resources/storage/types.d.ts +0 -1
- package/dist/resources/storage/types.d.ts.map +1 -1
- package/dist/utils/serverId.d.ts +2 -1
- package/dist/utils/serverId.d.ts.map +1 -1
- package/dist/utils/serverId.js +8 -1
- package/dist/utils/serverId.js.map +1 -1
- package/package.json +11 -8
- package/src/hooks/useMcpOAuthCallback.test.ts +24 -0
- package/src/hooks/useMcpOAuthCallback.tsx +20 -5
- package/src/mcp-scope.ts +5 -0
- package/src/resources/McpManagerResource.test.ts +40 -0
- package/src/resources/McpManagerResource.ts +21 -2
- package/src/resources/McpServerResource.test.ts +364 -0
- package/src/resources/McpServerResource.ts +51 -3
- package/src/resources/storage/McpLocalStorage.test.ts +184 -0
- package/src/resources/storage/McpLocalStorage.ts +113 -3
- 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":"
|
|
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":"
|
|
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. */
|
|
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. */
|
|
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":"
|
|
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":"
|
|
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. */
|
|
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. */
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerTools.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerTools.tsx"],"mappings":"
|
|
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;
|
|
9
|
-
|
|
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":"
|
|
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(
|
|
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] !==
|
|
117
|
+
if ($[17] !== autoConnect || $[18] !== connectionTimeout || $[19] !== connectors || $[20] !== customServers || $[21] !== redirectUri || $[22] !== storage) {
|
|
115
118
|
let t10;
|
|
116
|
-
if ($[
|
|
117
|
-
t10 = (
|
|
118
|
-
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:
|
|
121
|
-
url:
|
|
122
|
-
icon:
|
|
123
|
-
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
|
-
|
|
130
|
+
connectionTimeout: c_0.connectionTimeout ?? connectionTimeout,
|
|
131
|
+
onRemove: _temp4
|
|
128
132
|
}));
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
|
|
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 ($[
|
|
137
|
-
t11 = (
|
|
138
|
-
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:
|
|
141
|
-
url:
|
|
142
|
-
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 !==
|
|
153
|
+
setCustomServers((prev_0) => prev_0.filter((x) => x.id !== s_0.id));
|
|
148
154
|
}
|
|
149
155
|
}));
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
153
|
-
$[
|
|
154
|
-
|
|
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] =
|
|
159
|
-
$[19] =
|
|
160
|
-
$[20] =
|
|
161
|
-
$[21] =
|
|
162
|
-
$[22] =
|
|
163
|
-
|
|
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 ($[
|
|
168
|
-
t10 = all.filter(
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
} else t10 = $[
|
|
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 ($[
|
|
174
|
-
t11 = all.filter(
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
} else t11 = $[
|
|
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 ($[
|
|
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
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
} else t12 = $[
|
|
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 ($[
|
|
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
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
} else out = $[
|
|
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 ($[
|
|
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
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
231
|
+
$[46] = clientRef;
|
|
232
|
+
$[47] = toolkit;
|
|
233
|
+
$[48] = t13;
|
|
234
|
+
$[49] = t14;
|
|
227
235
|
} else {
|
|
228
|
-
t13 = $[
|
|
229
|
-
t14 = $[
|
|
236
|
+
t13 = $[48];
|
|
237
|
+
t14 = $[49];
|
|
230
238
|
}
|
|
231
239
|
useEffect(t13, t14);
|
|
232
240
|
let t15;
|
|
233
|
-
if ($[
|
|
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
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
} else t15 = $[
|
|
248
|
+
$[50] = lookup;
|
|
249
|
+
$[51] = state;
|
|
250
|
+
$[52] = t15;
|
|
251
|
+
} else t15 = $[52];
|
|
244
252
|
const serverByKind = t15;
|
|
245
253
|
let t16;
|
|
246
|
-
if ($[
|
|
254
|
+
if ($[53] !== state) {
|
|
247
255
|
t16 = () => state;
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
} else t16 = $[
|
|
256
|
+
$[53] = state;
|
|
257
|
+
$[54] = t16;
|
|
258
|
+
} else t16 = $[54];
|
|
251
259
|
let t17;
|
|
252
|
-
if ($[
|
|
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
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
} else t17 = $[
|
|
265
|
+
$[55] = lookup;
|
|
266
|
+
$[56] = serverByKind;
|
|
267
|
+
$[57] = t17;
|
|
268
|
+
} else t17 = $[57];
|
|
261
269
|
let t18;
|
|
262
270
|
let t19;
|
|
263
|
-
if ($[
|
|
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
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
280
|
+
$[58] = serverByKind;
|
|
281
|
+
$[59] = t18;
|
|
282
|
+
$[60] = t19;
|
|
275
283
|
} else {
|
|
276
|
-
t18 = $[
|
|
277
|
-
t19 = $[
|
|
284
|
+
t18 = $[59];
|
|
285
|
+
t19 = $[60];
|
|
278
286
|
}
|
|
279
287
|
let t20;
|
|
280
|
-
if ($[
|
|
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
|
-
$[
|
|
294
|
-
} else t20 = $[
|
|
302
|
+
$[61] = t20;
|
|
303
|
+
} else t20 = $[61];
|
|
295
304
|
let t21;
|
|
296
|
-
if ($[
|
|
305
|
+
if ($[62] !== lookup || $[63] !== state || $[64] !== storage) {
|
|
297
306
|
t21 = async (id) => {
|
|
298
|
-
if (state.connectors.some((
|
|
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((
|
|
312
|
+
setCustomServers((prev_2) => prev_2.filter((s_3) => s_3.id !== id));
|
|
304
313
|
}
|
|
305
314
|
};
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
} else t21 = $[
|
|
315
|
+
$[62] = lookup;
|
|
316
|
+
$[63] = state;
|
|
317
|
+
$[64] = storage;
|
|
318
|
+
$[65] = t21;
|
|
319
|
+
} else t21 = $[65];
|
|
311
320
|
let t22;
|
|
312
|
-
if ($[
|
|
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
|
-
$[
|
|
322
|
-
$[
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
} else t22 = $[
|
|
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
|
-
|
|
338
|
-
|
|
339
|
-
return s_0.kind === "connector";
|
|
346
|
+
function _temp2(c) {
|
|
347
|
+
return c.id;
|
|
340
348
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
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 };
|