@assistant-ui/react-mcp 0.1.17 → 0.1.19

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 (170) hide show
  1. package/dist/auth/buildHeaders.d.ts +1 -2
  2. package/dist/auth/buildHeaders.d.ts.map +1 -1
  3. package/dist/auth/createOAuthProvider.d.ts +5 -6
  4. package/dist/auth/createOAuthProvider.d.ts.map +1 -1
  5. package/dist/auth/types.d.ts +1 -2
  6. package/dist/auth/types.d.ts.map +1 -1
  7. package/dist/connector.d.ts +1 -2
  8. package/dist/connector.d.ts.map +1 -1
  9. package/dist/context/McpConnectorByIndexProvider.d.ts +1 -2
  10. package/dist/context/McpConnectorByIndexProvider.d.ts.map +1 -1
  11. package/dist/context/McpCustomServerByIndexProvider.d.ts +1 -2
  12. package/dist/context/McpCustomServerByIndexProvider.d.ts.map +1 -1
  13. package/dist/context/McpServerByIdProvider.d.ts +1 -2
  14. package/dist/context/McpServerByIdProvider.d.ts.map +1 -1
  15. package/dist/hooks/useMcpOAuthCallback.d.ts +5 -6
  16. package/dist/hooks/useMcpOAuthCallback.d.ts.map +1 -1
  17. package/dist/hooks/useMcpOAuthCallback.js +4 -0
  18. package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
  19. package/dist/mcp-scope.d.ts +14 -15
  20. package/dist/mcp-scope.d.ts.map +1 -1
  21. package/dist/primitives/addForm/McpAddFormAuthFields.d.ts +4 -4
  22. package/dist/primitives/addForm/McpAddFormAuthFields.d.ts.map +1 -1
  23. package/dist/primitives/addForm/McpAddFormAuthFields.js +28 -38
  24. package/dist/primitives/addForm/McpAddFormAuthFields.js.map +1 -1
  25. package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts +2 -3
  26. package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts.map +1 -1
  27. package/dist/primitives/addForm/McpAddFormBearerTokenField.d.ts +10 -0
  28. package/dist/primitives/addForm/McpAddFormBearerTokenField.d.ts.map +1 -0
  29. package/dist/primitives/addForm/McpAddFormBearerTokenField.js +50 -0
  30. package/dist/primitives/addForm/McpAddFormBearerTokenField.js.map +1 -0
  31. package/dist/primitives/addForm/McpAddFormCancel.d.ts +2 -3
  32. package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
  33. package/dist/primitives/addForm/McpAddFormError.d.ts +2 -3
  34. package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
  35. package/dist/primitives/addForm/McpAddFormError.js +30 -10
  36. package/dist/primitives/addForm/McpAddFormError.js.map +1 -1
  37. package/dist/primitives/addForm/McpAddFormNameField.d.ts +2 -3
  38. package/dist/primitives/addForm/McpAddFormNameField.d.ts.map +1 -1
  39. package/dist/primitives/addForm/McpAddFormNameField.js +31 -18
  40. package/dist/primitives/addForm/McpAddFormNameField.js.map +1 -1
  41. package/dist/primitives/addForm/McpAddFormRoot.d.ts +2 -3
  42. package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
  43. package/dist/primitives/addForm/McpAddFormRoot.js +32 -11
  44. package/dist/primitives/addForm/McpAddFormRoot.js.map +1 -1
  45. package/dist/primitives/addForm/McpAddFormScopesField.d.ts +10 -0
  46. package/dist/primitives/addForm/McpAddFormScopesField.d.ts.map +1 -0
  47. package/dist/primitives/addForm/McpAddFormScopesField.js +38 -0
  48. package/dist/primitives/addForm/McpAddFormScopesField.js.map +1 -0
  49. package/dist/primitives/addForm/McpAddFormSubmit.d.ts +2 -3
  50. package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
  51. package/dist/primitives/addForm/McpAddFormUrlField.d.ts +2 -3
  52. package/dist/primitives/addForm/McpAddFormUrlField.d.ts.map +1 -1
  53. package/dist/primitives/addForm/McpAddFormUrlField.js +31 -18
  54. package/dist/primitives/addForm/McpAddFormUrlField.js.map +1 -1
  55. package/dist/primitives/addForm/context.d.ts +13 -6
  56. package/dist/primitives/addForm/context.d.ts.map +1 -1
  57. package/dist/primitives/addForm/context.js.map +1 -1
  58. package/dist/primitives/addForm.d.ts +4 -2
  59. package/dist/primitives/addForm.js +5 -1
  60. package/dist/primitives/addForm.js.map +1 -1
  61. package/dist/primitives/elicitation/McpElicitationPrimitiveAccept.d.ts +2 -3
  62. package/dist/primitives/elicitation/McpElicitationPrimitiveAccept.d.ts.map +1 -1
  63. package/dist/primitives/elicitation/McpElicitationPrimitiveCancel.d.ts +2 -3
  64. package/dist/primitives/elicitation/McpElicitationPrimitiveCancel.d.ts.map +1 -1
  65. package/dist/primitives/elicitation/McpElicitationPrimitiveDecline.d.ts +2 -3
  66. package/dist/primitives/elicitation/McpElicitationPrimitiveDecline.d.ts.map +1 -1
  67. package/dist/primitives/elicitation/McpElicitationPrimitiveError.d.ts +2 -3
  68. package/dist/primitives/elicitation/McpElicitationPrimitiveError.d.ts.map +1 -1
  69. package/dist/primitives/elicitation/McpElicitationPrimitiveFields.d.ts +3 -3
  70. package/dist/primitives/elicitation/McpElicitationPrimitiveFields.d.ts.map +1 -1
  71. package/dist/primitives/elicitation/McpElicitationPrimitiveItems.d.ts +3 -3
  72. package/dist/primitives/elicitation/McpElicitationPrimitiveItems.d.ts.map +1 -1
  73. package/dist/primitives/elicitation/McpElicitationPrimitiveMessage.d.ts +2 -3
  74. package/dist/primitives/elicitation/McpElicitationPrimitiveMessage.d.ts.map +1 -1
  75. package/dist/primitives/elicitation/McpElicitationPrimitiveRoot.d.ts +2 -3
  76. package/dist/primitives/elicitation/McpElicitationPrimitiveRoot.d.ts.map +1 -1
  77. package/dist/primitives/elicitation/context.d.ts +7 -8
  78. package/dist/primitives/elicitation/context.d.ts.map +1 -1
  79. package/dist/primitives/elicitation/initialElicitationDraft.d.ts +1 -2
  80. package/dist/primitives/elicitation/initialElicitationDraft.d.ts.map +1 -1
  81. package/dist/primitives/elicitation/prepareElicitationContent.d.ts +1 -2
  82. package/dist/primitives/elicitation/prepareElicitationContent.d.ts.map +1 -1
  83. package/dist/primitives/elicitation/prepareElicitationContent.js +5 -1
  84. package/dist/primitives/elicitation/prepareElicitationContent.js.map +1 -1
  85. package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts +2 -3
  86. package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
  87. package/dist/primitives/manager/McpManagerConnectors.d.ts +2 -3
  88. package/dist/primitives/manager/McpManagerConnectors.d.ts.map +1 -1
  89. package/dist/primitives/manager/McpManagerCustomServers.d.ts +2 -3
  90. package/dist/primitives/manager/McpManagerCustomServers.d.ts.map +1 -1
  91. package/dist/primitives/manager/McpManagerRoot.d.ts +2 -3
  92. package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
  93. package/dist/primitives/server/McpServerConnectButton.d.ts +2 -3
  94. package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
  95. package/dist/primitives/server/McpServerDisconnectButton.d.ts +2 -3
  96. package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
  97. package/dist/primitives/server/McpServerError.d.ts +2 -3
  98. package/dist/primitives/server/McpServerError.d.ts.map +1 -1
  99. package/dist/primitives/server/McpServerIcon.d.ts +2 -3
  100. package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
  101. package/dist/primitives/server/McpServerName.d.ts +2 -3
  102. package/dist/primitives/server/McpServerName.d.ts.map +1 -1
  103. package/dist/primitives/server/McpServerOAuthLink.d.ts +2 -3
  104. package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
  105. package/dist/primitives/server/McpServerRemoveButton.d.ts +2 -3
  106. package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
  107. package/dist/primitives/server/McpServerRoot.d.ts +2 -3
  108. package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
  109. package/dist/primitives/server/McpServerStatus.d.ts +2 -3
  110. package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
  111. package/dist/primitives/server/McpServerToolName.d.ts +2 -3
  112. package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
  113. package/dist/primitives/server/McpServerTools.d.ts +3 -4
  114. package/dist/primitives/server/McpServerTools.d.ts.map +1 -1
  115. package/dist/resources/McpManagerResource.d.ts +2 -3
  116. package/dist/resources/McpManagerResource.d.ts.map +1 -1
  117. package/dist/resources/McpManagerResource.js +358 -244
  118. package/dist/resources/McpManagerResource.js.map +1 -1
  119. package/dist/resources/McpServerRemovalFence.d.ts +6 -0
  120. package/dist/resources/McpServerRemovalFence.d.ts.map +1 -0
  121. package/dist/resources/McpServerRemovalFence.js +11 -0
  122. package/dist/resources/McpServerRemovalFence.js.map +1 -0
  123. package/dist/resources/McpServerResource.d.ts +3 -4
  124. package/dist/resources/McpServerResource.d.ts.map +1 -1
  125. package/dist/resources/McpServerResource.js +9 -5
  126. package/dist/resources/McpServerResource.js.map +1 -1
  127. package/dist/resources/storage/McpCustomStorage.d.ts +1 -2
  128. package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
  129. package/dist/resources/storage/McpLocalStorage.d.ts +4 -5
  130. package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
  131. package/dist/resources/storage/McpLocalStorage.js +2 -1
  132. package/dist/resources/storage/McpLocalStorage.js.map +1 -1
  133. package/dist/resources/storage/McpMemoryStorage.d.ts +1 -2
  134. package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
  135. package/dist/resources/storage/types.d.ts +12 -11
  136. package/dist/resources/storage/types.d.ts.map +1 -1
  137. package/dist/resources/validateElicitationContent.d.ts +1 -2
  138. package/dist/resources/validateElicitationContent.d.ts.map +1 -1
  139. package/dist/utils/createMcpId.d.ts +1 -2
  140. package/dist/utils/createMcpId.d.ts.map +1 -1
  141. package/dist/utils/invokeMcpCallback.d.ts +1 -2
  142. package/dist/utils/invokeMcpCallback.d.ts.map +1 -1
  143. package/dist/utils/serverId.d.ts +2 -3
  144. package/dist/utils/serverId.d.ts.map +1 -1
  145. package/dist/utils/serverUrl.d.ts +3 -4
  146. package/dist/utils/serverUrl.d.ts.map +1 -1
  147. package/package.json +11 -10
  148. package/src/hooks/useMcpOAuthCallback.test.ts +53 -0
  149. package/src/hooks/useMcpOAuthCallback.tsx +12 -0
  150. package/src/index.ts +2 -1
  151. package/src/primitives/addForm/McpAddFormAccessibility.test.tsx +310 -0
  152. package/src/primitives/addForm/McpAddFormAuthFields.tsx +26 -16
  153. package/src/primitives/addForm/McpAddFormBearerTokenField.tsx +46 -0
  154. package/src/primitives/addForm/McpAddFormError.tsx +17 -3
  155. package/src/primitives/addForm/McpAddFormNameField.tsx +13 -1
  156. package/src/primitives/addForm/McpAddFormRoot.test.tsx +65 -0
  157. package/src/primitives/addForm/McpAddFormRoot.tsx +51 -8
  158. package/src/primitives/addForm/McpAddFormScopesField.tsx +34 -0
  159. package/src/primitives/addForm/McpAddFormUrlField.tsx +12 -1
  160. package/src/primitives/addForm/context.tsx +10 -0
  161. package/src/primitives/addForm.ts +2 -0
  162. package/src/primitives/elicitation/prepareElicitationContent.ts +8 -6
  163. package/src/resources/McpManagerResource.test.ts +797 -9
  164. package/src/resources/McpManagerResource.ts +242 -60
  165. package/src/resources/McpServerRemovalFence.ts +21 -0
  166. package/src/resources/McpServerResource.test.ts +9 -6
  167. package/src/resources/McpServerResource.ts +11 -6
  168. package/src/resources/storage/McpLocalStorage.test.ts +2 -0
  169. package/src/resources/storage/McpLocalStorage.ts +2 -1
  170. package/src/resources/storage/types.ts +10 -8
@@ -6,7 +6,6 @@ import { MCPPersistedAuthState } from "./types.js";
6
6
  * stored at add-form time (persisted), falling back to a static token on the
7
7
  * config (used by connectors that hardcode a token, rare in practice).
8
8
  */
9
- declare function buildHeaders(auth: MCPAuthConfig, persisted: MCPPersistedAuthState | null): Record<string, string> | undefined;
9
+ export declare function buildHeaders(auth: MCPAuthConfig, persisted: MCPPersistedAuthState | null): Record<string, string> | undefined;
10
10
  //#endregion
11
- export { buildHeaders };
12
11
  //# sourceMappingURL=buildHeaders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildHeaders.d.ts","names":[],"sources":["../../src/auth/buildHeaders.ts"],"mappings":";;;;;;;;iBAQgB,aACd,MAAM,eACN,WAAW,+BACV"}
1
+ {"version":3,"file":"buildHeaders.d.ts","names":[],"sources":["../../src/auth/buildHeaders.ts"],"mappings":";;;;;;;;wBAQgB,aACd,MAAM,eACN,WAAW,+BACV"}
@@ -2,8 +2,8 @@ import { MCPAuthConfig } from "../mcp-scope.js";
2
2
  import { MCPStorage } from "../resources/storage/types.js";
3
3
  import { OAuthClientInformationFull, OAuthClientProvider, OAuthTokens } from "@modelcontextprotocol/client";
4
4
  //#region src/auth/createOAuthProvider.d.ts
5
- declare function decodeServerIdFromState(state: string): string | null;
6
- type CreateOAuthProviderOptions = {
5
+ export declare function decodeServerIdFromState(state: string): string | null;
6
+ export type CreateOAuthProviderOptions = {
7
7
  serverId: string;
8
8
  serverUrl: string;
9
9
  /** Must be `auth.type === "oauth"`. */
@@ -24,19 +24,18 @@ type OAuthCredentialState = {
24
24
  clientInformation?: OAuthClientInformationFull | undefined;
25
25
  clientInformationSource?: "registered" | undefined;
26
26
  };
27
- declare const hasUsableOAuthTokens: (state: OAuthCredentialState | null | undefined, config: OAuthConfig) => boolean;
27
+ export declare const hasUsableOAuthTokens: (state: OAuthCredentialState | null | undefined, config: OAuthConfig) => boolean;
28
28
  /**
29
29
  * Clears persisted OAuth state after the in-flight load and every queued write
30
30
  * for that server have settled, so a discarded provider cannot recreate the
31
31
  * record it was mid-save on.
32
32
  */
33
- declare const clearOAuthProviderAuthState: (storage: MCPStorage, serverId: string) => Promise<void>;
33
+ export declare const clearOAuthProviderAuthState: (storage: MCPStorage, serverId: string) => Promise<void>;
34
34
  /**
35
35
  * Builds an OAuthClientProvider for the MCP SDK, backed by MCPStorage.
36
36
  * Token refresh and DCR are handled by the SDK; this provider only mediates
37
37
  * load/save and the redirect step.
38
38
  */
39
- declare function createOAuthProvider(opts: CreateOAuthProviderOptions): OAuthClientProvider;
39
+ export declare function createOAuthProvider(opts: CreateOAuthProviderOptions): OAuthClientProvider;
40
40
  //#endregion
41
- export { CreateOAuthProviderOptions, clearOAuthProviderAuthState, createOAuthProvider, decodeServerIdFromState, hasUsableOAuthTokens };
42
41
  //# sourceMappingURL=createOAuthProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOAuthProvider.d.ts","names":[],"sources":["../../src/auth/createOAuthProvider.ts"],"mappings":";;;;iBAsCgB,wBAAwB;KAgB5B;EACV;EACA;;EAEA,QAAQ,QAAQ;IAAiB;;EACjC,SAAS;EACT;;EAEA,qBAAqB,KAAK;;KAcvB,cAAc,QAAQ;EAAiB;;KAEvC;EACH,SAAS;EACT;EACA,oBAAoB;EACpB;;cAUW,uBACX,OAAO,yCACP,QAAQ;;;;;;cAkHG,8BACX,SAAS,YACT,qBACC;;;;;;iBA2Ba,oBACd,MAAM,6BACL"}
1
+ {"version":3,"file":"createOAuthProvider.d.ts","names":[],"sources":["../../src/auth/createOAuthProvider.ts"],"mappings":";;;;wBAsCgB,wBAAwB;YAgB5B;EACV;EACA;;EAEA,QAAQ,QAAQ;IAAiB;;EACjC,SAAS;EACT;;EAEA,qBAAqB,KAAK;;KAcvB,cAAc,QAAQ;EAAiB;;KAEvC;EACH,SAAS;EACT;EACA,oBAAoB;EACpB;;qBAUW,uBACX,OAAO,yCACP,QAAQ;;;;;;qBAkHG,8BACX,SAAS,YACT,qBACC;;;;;;wBA2Ba,oBACd,MAAM,6BACL"}
@@ -1,6 +1,6 @@
1
1
  import { OAuthClientInformationFull, OAuthDiscoveryState, OAuthTokens } from "@modelcontextprotocol/client";
2
2
  //#region src/auth/types.d.ts
3
- type MCPPersistedAuthState = {
3
+ export type MCPPersistedAuthState = {
4
4
  /** MCP server URL this authentication state belongs to. Required with credentials. */
5
5
  serverUrl?: string;
6
6
  tokens?: OAuthTokens;
@@ -14,5 +14,4 @@ type MCPPersistedAuthState = {
14
14
  token?: string;
15
15
  };
16
16
  //#endregion
17
- export { MCPPersistedAuthState };
18
17
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":";;KAMY;;EAEV;EACA,SAAS;EACT;EACA,oBAAoB;EACpB;EACA;EACA;EACA,iBAAiB;;EAEjB"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":";;YAMY;;EAEV;EACA,SAAS;EACT;EACA,oBAAoB;EACpB;EACA;EACA;EACA,iBAAiB;;EAEjB"}
@@ -1,6 +1,5 @@
1
1
  import { MCPConnector } from "./mcp-scope.js";
2
2
  //#region src/connector.d.ts
3
- declare function defineConnector(connector: MCPConnector): MCPConnector;
3
+ export declare function defineConnector(connector: MCPConnector): MCPConnector;
4
4
  //#endregion
5
- export { defineConnector };
6
5
  //# sourceMappingURL=connector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":";;iBAGgB,gBAAgB,WAAW,eAAe"}
1
+ {"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":";;wBAGgB,gBAAgB,WAAW,eAAe"}
@@ -1,8 +1,7 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
2
  //#region src/context/McpConnectorByIndexProvider.d.ts
3
- declare const McpConnectorByIndexProvider: FC<PropsWithChildren<{
3
+ export declare const McpConnectorByIndexProvider: FC<PropsWithChildren<{
4
4
  index: number;
5
5
  }>>;
6
6
  //#endregion
7
- export { McpConnectorByIndexProvider };
8
7
  //# sourceMappingURL=McpConnectorByIndexProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":";;cAGa,6BAA6B,GACxC;EAAoB"}
1
+ {"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":";;qBAGa,6BAA6B,GACxC;EAAoB"}
@@ -1,8 +1,7 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
2
  //#region src/context/McpCustomServerByIndexProvider.d.ts
3
- declare const McpCustomServerByIndexProvider: FC<PropsWithChildren<{
3
+ export declare const McpCustomServerByIndexProvider: FC<PropsWithChildren<{
4
4
  index: number;
5
5
  }>>;
6
6
  //#endregion
7
- export { McpCustomServerByIndexProvider };
8
7
  //# sourceMappingURL=McpCustomServerByIndexProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":";;cAGa,gCAAgC,GAC3C;EAAoB"}
1
+ {"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":";;qBAGa,gCAAgC,GAC3C;EAAoB"}
@@ -1,8 +1,7 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
2
  //#region src/context/McpServerByIdProvider.d.ts
3
- declare const McpServerByIdProvider: FC<PropsWithChildren<{
3
+ export declare const McpServerByIdProvider: FC<PropsWithChildren<{
4
4
  id: string;
5
5
  }>>;
6
6
  //#endregion
7
- export { McpServerByIdProvider };
8
7
  //# sourceMappingURL=McpServerByIdProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerByIdProvider.d.ts","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"mappings":";;cAGa,uBAAuB,GAAG;EAAoB"}
1
+ {"version":3,"file":"McpServerByIdProvider.d.ts","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"mappings":";;qBAGa,uBAAuB,GAAG;EAAoB"}
@@ -1,21 +1,20 @@
1
1
  import { FC, ReactNode } from "react";
2
2
  //#region src/hooks/useMcpOAuthCallback.d.ts
3
- declare const createMcpOAuthCallbackError: (err: unknown, serverId: string | null) => Error;
4
- type UseMcpOAuthCallbackOptions = {
3
+ export declare const createMcpOAuthCallbackError: (err: unknown, serverId: string | null) => Error;
4
+ export type UseMcpOAuthCallbackOptions = {
5
5
  /** Defaults to `window.location.href`. */
6
6
  url?: string;
7
7
  onComplete?: (serverId: string) => void;
8
8
  onError?: (err: Error) => void;
9
9
  };
10
- type UseMcpOAuthCallbackResult = {
10
+ export type UseMcpOAuthCallbackResult = {
11
11
  status: "idle" | "running" | "done" | "error";
12
12
  serverId: string | null;
13
13
  error: Error | null;
14
14
  };
15
- declare function useMcpOAuthCallback(opts?: UseMcpOAuthCallbackOptions): UseMcpOAuthCallbackResult;
16
- declare const McpOAuthCallback: FC<UseMcpOAuthCallbackOptions & {
15
+ export declare function useMcpOAuthCallback(opts?: UseMcpOAuthCallbackOptions): UseMcpOAuthCallbackResult;
16
+ export declare const McpOAuthCallback: FC<UseMcpOAuthCallbackOptions & {
17
17
  children?: (result: UseMcpOAuthCallbackResult) => ReactNode;
18
18
  }>;
19
19
  //#endregion
20
- export { McpOAuthCallback, UseMcpOAuthCallbackOptions, UseMcpOAuthCallbackResult, createMcpOAuthCallbackError, useMcpOAuthCallback };
21
20
  //# sourceMappingURL=useMcpOAuthCallback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpOAuthCallback.d.ts","names":[],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"mappings":";;cAYa,8BACX,cACA,4BACC;KAWS;;EAEV;EACA,cAAc;EACd,WAAW,KAAK;;KAGN;EACV;EACA;EACA,OAAO;;iBAGO,oBACd,OAAM,6BACL;cAkDU,kBAAkB,GAC7B;EACE,YAAY,QAAQ,8BAA8B"}
1
+ {"version":3,"file":"useMcpOAuthCallback.d.ts","names":[],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"mappings":";;qBAYa,8BACX,cACA,4BACC;YAWS;;EAEV;EACA,cAAc;EACd,WAAW,KAAK;;YAGN;EACV;EACA;EACA,OAAO;;wBAGO,oBACd,OAAM,6BACL;qBA8DU,kBAAkB,GAC7B;EACE,YAAY,QAAQ,8BAA8B"}
@@ -27,6 +27,7 @@ function useMcpOAuthCallback(opts = {}) {
27
27
  if (!url) return;
28
28
  if (startedRef.current === url) return;
29
29
  startedRef.current = url;
30
+ const superseded = () => startedRef.current !== url;
30
31
  (async () => {
31
32
  let serverId = null;
32
33
  try {
@@ -34,18 +35,21 @@ function useMcpOAuthCallback(opts = {}) {
34
35
  if (state) serverId = decodeServerIdFromState(state);
35
36
  if (!state) throw new Error("missing \"state\" parameter");
36
37
  if (!serverId) throw new Error("state was not created by assistant-ui MCP");
38
+ if (superseded()) return;
37
39
  setResult({
38
40
  status: "running",
39
41
  serverId,
40
42
  error: null
41
43
  });
42
44
  await aui.mcp.server({ id: serverId }).completeAuth(url);
45
+ if (superseded()) return;
43
46
  setResult({
44
47
  status: "done",
45
48
  serverId,
46
49
  error: null
47
50
  });
48
51
  } catch (err) {
52
+ if (superseded()) return;
49
53
  const error = createMcpOAuthCallbackError(err, serverId);
50
54
  setResult({
51
55
  status: "error",
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useInsertionEffect","useRef","useState","useAui","decodeServerIdFromState","invokeMcpCallback","createMcpOAuthCallbackError","err","serverId","Error","message","String","cause","UseMcpOAuthCallbackOptions","url","onComplete","onError","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import {\n type FC,\n type ReactNode,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\nimport { invokeMcpCallback } from \"../utils/invokeMcpCallback\";\n\nexport const createMcpOAuthCallbackError = (\n err: unknown,\n serverId: string | null,\n): Error => {\n const message = err instanceof Error ? err.message : String(err);\n if (serverId) {\n return new Error(\n `MCP OAuth callback for server \"${serverId}\" failed: ${message}`,\n { cause: err },\n );\n }\n return new Error(`MCP OAuth callback failed: ${message}`, { cause: err });\n};\n\nexport type UseMcpOAuthCallbackOptions = {\n /** Defaults to `window.location.href`. */\n url?: string;\n onComplete?: (serverId: string) => void;\n onError?: (err: Error) => void;\n};\n\nexport type UseMcpOAuthCallbackResult = {\n status: \"idle\" | \"running\" | \"done\" | \"error\";\n serverId: string | null;\n error: Error | null;\n};\n\nexport function useMcpOAuthCallback(\n opts: UseMcpOAuthCallbackOptions = {},\n): UseMcpOAuthCallbackResult {\n const aui = useAui();\n const [result, setResult] = useState<UseMcpOAuthCallbackResult>({\n status: \"idle\",\n serverId: null,\n error: null,\n });\n // Guard against React 18 Strict Mode's mount-unmount-remount: the effect\n // body must not run completeAuth twice for the same URL, otherwise the\n // single-use OAuth code is double-redeemed and the second attempt 4xxs.\n const startedRef = useRef<string | null>(null);\n const optsRef = useRef(opts);\n useInsertionEffect(() => {\n optsRef.current = opts;\n });\n\n useEffect(() => {\n const url =\n opts.url ?? (typeof window !== \"undefined\" ? window.location.href : null);\n if (!url) return;\n if (startedRef.current === url) return;\n startedRef.current = url;\n\n void (async () => {\n let serverId: string | null = null;\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n if (state) serverId = decodeServerIdFromState(state);\n if (!state) throw new Error('missing \"state\" parameter');\n if (!serverId) {\n throw new Error(\"state was not created by assistant-ui MCP\");\n }\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp.server({ id: serverId }).completeAuth(url);\n setResult({ status: \"done\", serverId, error: null });\n } catch (err) {\n const error = createMcpOAuthCallbackError(err, serverId);\n setResult({ status: \"error\", serverId, error });\n invokeMcpCallback(\"onError\", optsRef.current.onError, error);\n return;\n }\n\n invokeMcpCallback(\"onComplete\", optsRef.current.onComplete, serverId);\n })();\n }, [aui, opts.url]);\n\n return result;\n}\n\nexport const McpOAuthCallback: FC<\n UseMcpOAuthCallbackOptions & {\n children?: (result: UseMcpOAuthCallbackResult) => ReactNode;\n }\n> = ({ children, ...opts }) => {\n const result = useMcpOAuthCallback(opts);\n if (children) return <>{children(result)}</>;\n return null;\n};\n"],"mappings":";;;;;;;AAYA,MAAaS,+BACXC,KACAC,aACU;CACV,MAAME,UAAUH,eAAeE,QAAQF,IAAIG,UAAUC,OAAOJ,GAAG;CAC/D,IAAIC,UACF,OAAO,IAAIC,MACT,kCAAkCD,SAAQ,YAAaE,WACvD,EAAEE,OAAOL,IAAI,CACf;CAEF,OAAO,IAAIE,MAAM,8BAA8BC,WAAW,EAAEE,OAAOL,IAAI,CAAC;AAC1E;AAeA,SAAgBa,oBACdC,OAAmC,CAAC,GACT;CAC3B,MAAMC,MAAMnB,OAAO;CACnB,MAAM,CAACoB,QAAQC,aAAatB,SAAoC;EAC9DgB,QAAQ;EACRV,UAAU;EACVW,OAAO;CACT,CAAC;CAID,MAAMM,aAAaxB,OAAsB,IAAI;CAC7C,MAAMyB,UAAUzB,OAAOoB,IAAI;CAC3BrB,yBAAyB;EACvB0B,QAAQC,UAAUN;CACpB,CAAC;CAEDtB,gBAAgB;EACd,MAAMe,MACJO,KAAKP,QAAQ,OAAOc,WAAW,cAAcA,OAAOC,SAASC,OAAO;EACtE,IAAI,CAAChB,KAAK;EACV,IAAIW,WAAWE,YAAYb,KAAK;EAChCW,WAAWE,UAAUb;EAErB,CAAM,YAAY;GAChB,IAAIN,WAA0B;GAC9B,IAAI;IAEF,MAAMyB,QAAQF,IADKC,IAAIlB,GACTiB,CAAM,CAACG,aAAaC,IAAI,OAAO;IAC7C,IAAIF,OAAOzB,WAAWJ,wBAAwB6B,KAAK;IACnD,IAAI,CAACA,OAAO,MAAM,IAAIxB,MAAM,6BAA2B;IACvD,IAAI,CAACD,UACH,MAAM,IAAIC,MAAM,2CAA2C;IAE7De,UAAU;KAAEN,QAAQ;KAAWV;KAAUW,OAAO;IAAK,CAAC;IACtD,MAAMG,IAAIc,IAAIC,OAAO,EAAEC,IAAI9B,SAAS,CAAC,CAAC,CAAC+B,aAAazB,GAAG;IACvDU,UAAU;KAAEN,QAAQ;KAAQV;KAAUW,OAAO;IAAK,CAAC;GACrD,SAASZ,KAAK;IACZ,MAAMY,QAAQb,4BAA4BC,KAAKC,QAAQ;IACvDgB,UAAU;KAAEN,QAAQ;KAASV;KAAUW;IAAM,CAAC;IAC9Cd,kBAAkB,WAAWqB,QAAQC,QAAQX,SAASG,KAAK;IAC3D;GACF;GAEAd,kBAAkB,cAAcqB,QAAQC,QAAQZ,YAAYP,QAAQ;EACtE,EAAA,CAAG;CACL,GAAG,CAACc,KAAKD,KAAKP,GAAG,CAAC;CAElB,OAAOS;AACT;AAEA,MAAaiB,oBAITE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAH;CAAA,IAAApB;CAAA,IAAAsB,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAD,UAAA,GAAApB,QAAAqB;EAAqBC,EAAA,KAAAD;EAAAC,EAAA,KAAAF;EAAAE,EAAA,KAAAtB;CAAA,OAAA;EAAAoB,WAAAE,EAAA;EAAAtB,OAAAsB,EAAA;CAAA;CACxB,MAAApB,SAAeH,oBAAoBC,IAAI;CACvC,IAAIoB,UAAQ;EAAA,IAAAI;EAAA,IAAAF,EAAA,OAAAF,YAAAE,EAAA,OAAApB,QAAA;GAAYsB,KAAAJ,SAASlB,MAAM;GAACoB,EAAA,KAAAF;GAAAE,EAAA,KAAApB;GAAAoB,EAAA,KAAAE;EAAA,OAAAA,KAAAF,EAAA;EAAA,IAAAG;EAAA,IAAAH,EAAA,OAAAE,IAAA;GAAnBC,KAAA,oBAAA,UAAA,EAAA,UAAGD,GAAgB,CAAA;GAAIF,EAAA,KAAAE;GAAAF,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAA,OAAvBG;CAAuB;CAAC,OACtC;AAAI"}
1
+ {"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useInsertionEffect","useRef","useState","useAui","decodeServerIdFromState","invokeMcpCallback","createMcpOAuthCallbackError","err","serverId","Error","message","String","cause","UseMcpOAuthCallbackOptions","url","onComplete","onError","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","superseded","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import {\n type FC,\n type ReactNode,\n useEffect,\n useInsertionEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\nimport { invokeMcpCallback } from \"../utils/invokeMcpCallback\";\n\nexport const createMcpOAuthCallbackError = (\n err: unknown,\n serverId: string | null,\n): Error => {\n const message = err instanceof Error ? err.message : String(err);\n if (serverId) {\n return new Error(\n `MCP OAuth callback for server \"${serverId}\" failed: ${message}`,\n { cause: err },\n );\n }\n return new Error(`MCP OAuth callback failed: ${message}`, { cause: err });\n};\n\nexport type UseMcpOAuthCallbackOptions = {\n /** Defaults to `window.location.href`. */\n url?: string;\n onComplete?: (serverId: string) => void;\n onError?: (err: Error) => void;\n};\n\nexport type UseMcpOAuthCallbackResult = {\n status: \"idle\" | \"running\" | \"done\" | \"error\";\n serverId: string | null;\n error: Error | null;\n};\n\nexport function useMcpOAuthCallback(\n opts: UseMcpOAuthCallbackOptions = {},\n): UseMcpOAuthCallbackResult {\n const aui = useAui();\n const [result, setResult] = useState<UseMcpOAuthCallbackResult>({\n status: \"idle\",\n serverId: null,\n error: null,\n });\n // Guard against React 18 Strict Mode's mount-unmount-remount: the effect\n // body must not run completeAuth twice for the same URL, otherwise the\n // single-use OAuth code is double-redeemed and the second attempt 4xxs.\n const startedRef = useRef<string | null>(null);\n const optsRef = useRef(opts);\n useInsertionEffect(() => {\n optsRef.current = opts;\n });\n\n useEffect(() => {\n const url =\n opts.url ?? (typeof window !== \"undefined\" ? window.location.href : null);\n if (!url) return;\n if (startedRef.current === url) return;\n startedRef.current = url;\n\n // A callback page can be handed a second login URL while the first\n // completeAuth is still in flight. That attempt keeps running, so it\n // publishes only while its own URL is still the one being attempted;\n // otherwise an older failure would overwrite the newer attempt's success.\n // The check is against `startedRef` rather than a teardown flag so that\n // Strict Mode's unmount-remount, which starts no new attempt, still\n // publishes the result of the one already running.\n const superseded = () => startedRef.current !== url;\n\n void (async () => {\n let serverId: string | null = null;\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n if (state) serverId = decodeServerIdFromState(state);\n if (!state) throw new Error('missing \"state\" parameter');\n if (!serverId) {\n throw new Error(\"state was not created by assistant-ui MCP\");\n }\n if (superseded()) return;\n setResult({ status: \"running\", serverId, error: null });\n await aui.mcp.server({ id: serverId }).completeAuth(url);\n if (superseded()) return;\n setResult({ status: \"done\", serverId, error: null });\n } catch (err) {\n if (superseded()) return;\n const error = createMcpOAuthCallbackError(err, serverId);\n setResult({ status: \"error\", serverId, error });\n invokeMcpCallback(\"onError\", optsRef.current.onError, error);\n return;\n }\n\n invokeMcpCallback(\"onComplete\", optsRef.current.onComplete, serverId);\n })();\n }, [aui, opts.url]);\n\n return result;\n}\n\nexport const McpOAuthCallback: FC<\n UseMcpOAuthCallbackOptions & {\n children?: (result: UseMcpOAuthCallbackResult) => ReactNode;\n }\n> = ({ children, ...opts }) => {\n const result = useMcpOAuthCallback(opts);\n if (children) return <>{children(result)}</>;\n return null;\n};\n"],"mappings":";;;;;;;AAYA,MAAaS,+BACXC,KACAC,aACU;CACV,MAAME,UAAUH,eAAeE,QAAQF,IAAIG,UAAUC,OAAOJ,GAAG;CAC/D,IAAIC,UACF,OAAO,IAAIC,MACT,kCAAkCD,SAAQ,YAAaE,WACvD,EAAEE,OAAOL,IAAI,CACf;CAEF,OAAO,IAAIE,MAAM,8BAA8BC,WAAW,EAAEE,OAAOL,IAAI,CAAC;AAC1E;AAeA,SAAgBa,oBACdC,OAAmC,CAAC,GACT;CAC3B,MAAMC,MAAMnB,OAAO;CACnB,MAAM,CAACoB,QAAQC,aAAatB,SAAoC;EAC9DgB,QAAQ;EACRV,UAAU;EACVW,OAAO;CACT,CAAC;CAID,MAAMM,aAAaxB,OAAsB,IAAI;CAC7C,MAAMyB,UAAUzB,OAAOoB,IAAI;CAC3BrB,yBAAyB;EACvB0B,QAAQC,UAAUN;CACpB,CAAC;CAEDtB,gBAAgB;EACd,MAAMe,MACJO,KAAKP,QAAQ,OAAOc,WAAW,cAAcA,OAAOC,SAASC,OAAO;EACtE,IAAI,CAAChB,KAAK;EACV,IAAIW,WAAWE,YAAYb,KAAK;EAChCW,WAAWE,UAAUb;EASrB,MAAMiB,mBAAmBN,WAAWE,YAAYb;EAEhD,CAAM,YAAY;GAChB,IAAIN,WAA0B;GAC9B,IAAI;IAEF,MAAM0B,QAAQF,IADKC,IAAInB,GACTkB,CAAM,CAACG,aAAaC,IAAI,OAAO;IAC7C,IAAIF,OAAO1B,WAAWJ,wBAAwB8B,KAAK;IACnD,IAAI,CAACA,OAAO,MAAM,IAAIzB,MAAM,6BAA2B;IACvD,IAAI,CAACD,UACH,MAAM,IAAIC,MAAM,2CAA2C;IAE7D,IAAIsB,WAAW,GAAG;IAClBP,UAAU;KAAEN,QAAQ;KAAWV;KAAUW,OAAO;IAAK,CAAC;IACtD,MAAMG,IAAIe,IAAIC,OAAO,EAAEC,IAAI/B,SAAS,CAAC,CAAC,CAACgC,aAAa1B,GAAG;IACvD,IAAIiB,WAAW,GAAG;IAClBP,UAAU;KAAEN,QAAQ;KAAQV;KAAUW,OAAO;IAAK,CAAC;GACrD,SAASZ,KAAK;IACZ,IAAIwB,WAAW,GAAG;IAClB,MAAMZ,QAAQb,4BAA4BC,KAAKC,QAAQ;IACvDgB,UAAU;KAAEN,QAAQ;KAASV;KAAUW;IAAM,CAAC;IAC9Cd,kBAAkB,WAAWqB,QAAQC,QAAQX,SAASG,KAAK;IAC3D;GACF;GAEAd,kBAAkB,cAAcqB,QAAQC,QAAQZ,YAAYP,QAAQ;EACtE,EAAA,CAAG;CACL,GAAG,CAACc,KAAKD,KAAKP,GAAG,CAAC;CAElB,OAAOS;AACT;AAEA,MAAakB,oBAITE,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAH;CAAA,IAAArB;CAAA,IAAAuB,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAD,UAAA,GAAArB,QAAAsB;EAAqBC,EAAA,KAAAD;EAAAC,EAAA,KAAAF;EAAAE,EAAA,KAAAvB;CAAA,OAAA;EAAAqB,WAAAE,EAAA;EAAAvB,OAAAuB,EAAA;CAAA;CACxB,MAAArB,SAAeH,oBAAoBC,IAAI;CACvC,IAAIqB,UAAQ;EAAA,IAAAI;EAAA,IAAAF,EAAA,OAAAF,YAAAE,EAAA,OAAArB,QAAA;GAAYuB,KAAAJ,SAASnB,MAAM;GAACqB,EAAA,KAAAF;GAAAE,EAAA,KAAArB;GAAAqB,EAAA,KAAAE;EAAA,OAAAA,KAAAF,EAAA;EAAA,IAAAG;EAAA,IAAAH,EAAA,OAAAE,IAAA;GAAnBC,KAAA,oBAAA,UAAA,EAAA,UAAGD,GAAgB,CAAA;GAAIF,EAAA,KAAAE;GAAAF,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAA,OAAvBG;CAAuB;CAAC,OACtC;AAAI"}
@@ -1,6 +1,6 @@
1
1
  import "@assistant-ui/store";
2
2
  //#region src/mcp-scope.d.ts
3
- type MCPAuthConfig = {
3
+ export type MCPAuthConfig = {
4
4
  type: "none";
5
5
  } | {
6
6
  type: "bearer";
@@ -14,10 +14,10 @@ type MCPAuthConfig = {
14
14
  clientId?: string | undefined;
15
15
  clientSecret?: string | undefined;
16
16
  };
17
- type MCPResponseCacheConfig = {
17
+ export type MCPResponseCacheConfig = {
18
18
  readonly defaultTtlMs?: number;
19
19
  };
20
- type MCPConnector = {
20
+ export type MCPConnector = {
21
21
  id: string;
22
22
  name: string;
23
23
  url: string;
@@ -27,7 +27,7 @@ type MCPConnector = {
27
27
  readonly cache?: MCPResponseCacheConfig | undefined;
28
28
  readonly elicitation?: boolean | undefined;
29
29
  };
30
- type MCPCustomServerRecord = {
30
+ export type MCPCustomServerRecord = {
31
31
  id: string;
32
32
  name: string;
33
33
  url: string;
@@ -37,14 +37,14 @@ type MCPCustomServerRecord = {
37
37
  readonly elicitation?: boolean | undefined;
38
38
  createdAt: number;
39
39
  };
40
- type MCPServerKind = "connector" | "custom";
41
- type MCPConnectionState = "disconnected" | "authRequired" | "authPending" | "connecting" | "connected" | "error";
42
- type MCPToolInfo = {
40
+ export type MCPServerKind = "connector" | "custom";
41
+ export type MCPConnectionState = "disconnected" | "authRequired" | "authPending" | "connecting" | "connected" | "error";
42
+ export type MCPToolInfo = {
43
43
  name: string;
44
44
  description?: string | undefined;
45
45
  inputSchema: unknown;
46
46
  };
47
- type MCPElicitation = {
47
+ export type MCPElicitation = {
48
48
  readonly id: string;
49
49
  readonly message: string;
50
50
  readonly requestedSchema: unknown;
@@ -53,7 +53,7 @@ type MCPElicitation = {
53
53
  readonly properties?: readonly string[] | undefined;
54
54
  } | undefined;
55
55
  };
56
- type MCPElicitationResponse = {
56
+ export type MCPElicitationResponse = {
57
57
  action: "accept";
58
58
  content: Record<string, unknown>;
59
59
  } | {
@@ -61,7 +61,7 @@ type MCPElicitationResponse = {
61
61
  } | {
62
62
  action: "cancel";
63
63
  };
64
- type MCPServerState = {
64
+ export type MCPServerState = {
65
65
  id: string;
66
66
  kind: MCPServerKind;
67
67
  name: string;
@@ -75,13 +75,13 @@ type MCPServerState = {
75
75
  authorizationUrl: string | null;
76
76
  readonly pendingElicitations: readonly MCPElicitation[];
77
77
  };
78
- type MCPManagerState = {
78
+ export type MCPManagerState = {
79
79
  servers: MCPServerState[];
80
80
  connectors: MCPServerState[];
81
81
  customServers: MCPServerState[];
82
82
  isHydrated: boolean;
83
83
  };
84
- type MCPServerMethods = {
84
+ export type MCPServerMethods = {
85
85
  getState: () => MCPServerState;
86
86
  connect: () => Promise<void>;
87
87
  disconnect: () => Promise<void>;
@@ -100,7 +100,7 @@ type MCPServerMethods = {
100
100
  message: string;
101
101
  }[] | undefined;
102
102
  };
103
- type MCPServerQuery = {
103
+ export type MCPServerQuery = {
104
104
  id: string;
105
105
  } | {
106
106
  kind: "connector";
@@ -109,7 +109,7 @@ type MCPServerQuery = {
109
109
  kind: "custom";
110
110
  index: number;
111
111
  };
112
- type MCPManagerMethods = {
112
+ export type MCPManagerMethods = {
113
113
  getState: () => MCPManagerState;
114
114
  /** Look up a server by id, or by index within its kind. */
115
115
  server: (query: MCPServerQuery) => MCPServerMethods;
@@ -146,5 +146,4 @@ declare module "@assistant-ui/store" {
146
146
  }
147
147
  }
148
148
  //#endregion
149
- export { MCPAuthConfig, MCPConnectionState, MCPConnector, MCPCustomServerRecord, MCPElicitation, MCPElicitationResponse, MCPManagerMethods, MCPManagerState, MCPResponseCacheConfig, MCPServerKind, MCPServerMethods, MCPServerQuery, MCPServerState, MCPToolInfo };
150
149
  //# sourceMappingURL=mcp-scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-scope.d.ts","names":[],"sources":["../src/mcp-scope.ts"],"mappings":";;KAEY;EACN;;EACA;EAAgB;;EAEhB;EACA;EACA;EACA;EACA;EACA;EACA;;KAGM;WACD;;KAGC;EACV;EACA;EACA;EACA;EACA,MAAM;EACN;WACS,QAAQ;WACR;;KAGC;EACV;EACA;EACA;EACA,MAAM;EACN;WACS,QAAQ;WACR;EACT;;KAGU;KAEA;KAQA;EACV;EACA;EACA;;KAGU;WACD;WACA;WACA;WACA;aAEM;aACA;;;KAKL;EACN;EAAkB,SAAS;;EAC3B;;EACA;;KAEM;EACV;EACA,MAAM;EACN;EACA;EACA;EACA,iBAAiB;EACjB;IAAa;;EACb,OAAO;EACP;WACS,8BAA8B;;KAG7B;EACV,SAAS;EACT,YAAY;EACZ,eAAe;EACf;;KAGU;EACV,gBAAgB;EAChB,eAAe;EACf,kBAAkB;EAClB,cAAc;EACd,WAAW,cAAc,kBAAkB;;EAE3C,gBAAgB;IAAW;QAAkC;;EAE7D,eAAe,gBAAgB;;EAE/B,eAAe,wBAAwB;EACvC,kBACE,YACA,UAAU;IACE;IAAkB;;;KAGtB;EACN;;EACA;EAAmB;;EACnB;EAAgB;;KAEV;EACV,gBAAgB;;EAEhB,SAAS,OAAO,mBAAmB;;EAEnC,YAAY;IAAS;QAAoB;;EAEzC,eAAe;IAAS;QAAoB;EAC5C,kBAAkB;IAChB;IACA;IACA,MAAM;IACN;aACS,QAAQ;aACR;QACL;EACN,eAAe,eAAe;;;YAIpB;IACR;MACE,SAAS;;IAEX;MACE,SAAS;MACT;QAAQ;QAAe,OAAO"}
1
+ {"version":3,"file":"mcp-scope.d.ts","names":[],"sources":["../src/mcp-scope.ts"],"mappings":";;YAEY;EACN;;EACA;EAAgB;;EAEhB;EACA;EACA;EACA;EACA;EACA;EACA;;YAGM;WACD;;YAGC;EACV;EACA;EACA;EACA;EACA,MAAM;EACN;WACS,QAAQ;WACR;;YAGC;EACV;EACA;EACA;EACA,MAAM;EACN;WACS,QAAQ;WACR;EACT;;YAGU;YAEA;YAQA;EACV;EACA;EACA;;YAGU;WACD;WACA;WACA;WACA;aAEM;aACA;;;YAKL;EACN;EAAkB,SAAS;;EAC3B;;EACA;;YAEM;EACV;EACA,MAAM;EACN;EACA;EACA;EACA,iBAAiB;EACjB;IAAa;;EACb,OAAO;EACP;WACS,8BAA8B;;YAG7B;EACV,SAAS;EACT,YAAY;EACZ,eAAe;EACf;;YAGU;EACV,gBAAgB;EAChB,eAAe;EACf,kBAAkB;EAClB,cAAc;EACd,WAAW,cAAc,kBAAkB;;EAE3C,gBAAgB;IAAW;QAAkC;;EAE7D,eAAe,gBAAgB;;EAE/B,eAAe,wBAAwB;EACvC,kBACE,YACA,UAAU;IACE;IAAkB;;;YAGtB;EACN;;EACA;EAAmB;;EACnB;EAAgB;;YAEV;EACV,gBAAgB;;EAEhB,SAAS,OAAO,mBAAmB;;EAEnC,YAAY;IAAS;QAAoB;;EAEzC,eAAe;IAAS;QAAoB;EAC5C,kBAAkB;IAChB;IACA;IACA,MAAM;IACN;aACS,QAAQ;aACR;QACL;EACN,eAAe,eAAe;;;YAIpB;IACR;MACE,SAAS;;IAEX;MACE,SAAS;MACT;QAAQ;QAAe,OAAO"}
@@ -1,18 +1,18 @@
1
1
  import { AddFormAuthType } from "./context.js";
2
2
  import { FC } from "react";
3
3
  //#region src/primitives/addForm/McpAddFormAuthFields.d.ts
4
- declare namespace McpAddFormPrimitiveAuthFields {
4
+ export declare namespace McpAddFormPrimitiveAuthFields {
5
5
  type Props = {
6
6
  /**
7
7
  * Optional render override. Receives the current auth type so apps can render
8
- * fully custom inputs. Defaults to a minimal built-in for bearer / oauth.
8
+ * fully custom inputs, bound to the form through `BearerTokenField` and
9
+ * `ScopesField`. Defaults to a minimal built-in for bearer / oauth.
9
10
  */
10
11
  children?: FC<{
11
12
  authType: AddFormAuthType;
12
13
  }>;
13
14
  };
14
15
  }
15
- declare const McpAddFormPrimitiveAuthFields: FC<McpAddFormPrimitiveAuthFields.Props>;
16
+ export declare const McpAddFormPrimitiveAuthFields: FC<McpAddFormPrimitiveAuthFields.Props>;
16
17
  //#endregion
17
- export { McpAddFormPrimitiveAuthFields };
18
18
  //# sourceMappingURL=McpAddFormAuthFields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthFields.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"mappings":";;;kBAGiB;OACH;;;;;IAKV,WAAW;MAAK,UAAU;;;;cAIjB,+BAA+B,GAC1C,8BAA8B"}
1
+ {"version":3,"file":"McpAddFormAuthFields.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"mappings":";;;yBAKiB;OACH;;;;;;IAMV,WAAW;MAAK,UAAU;;;;qBAIjB,+BAA+B,GAC1C,8BAA8B"}
@@ -1,11 +1,13 @@
1
1
  import { useAddForm } from "./context.js";
2
+ import { McpAddFormPrimitiveBearerTokenField } from "./McpAddFormBearerTokenField.js";
3
+ import { McpAddFormPrimitiveScopesField } from "./McpAddFormScopesField.js";
2
4
  import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
- import { jsx } from "react/jsx-runtime";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
4
6
  //#region src/primitives/addForm/McpAddFormAuthFields.tsx
5
7
  const McpAddFormPrimitiveAuthFields = (t0) => {
6
- const $ = c(13);
8
+ const $ = c(7);
7
9
  const { children } = t0;
8
- const { state, setField } = useAddForm();
10
+ const { state, ids } = useAddForm();
9
11
  if (children) {
10
12
  const Render = children;
11
13
  let t1;
@@ -19,47 +21,35 @@ const McpAddFormPrimitiveAuthFields = (t0) => {
19
21
  }
20
22
  if (state.authType === "bearer") {
21
23
  let t1;
22
- if ($[3] !== setField) {
23
- t1 = (e) => setField("bearerToken", e.target.value);
24
- $[3] = setField;
24
+ if ($[3] !== ids.bearerToken) {
25
+ t1 = /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
26
+ htmlFor: ids.bearerToken,
27
+ "data-mcp-auth-field-label": "bearer-token",
28
+ children: "Bearer token"
29
+ }), /* @__PURE__ */ jsx(McpAddFormPrimitiveBearerTokenField, {
30
+ id: ids.bearerToken,
31
+ "data-mcp-auth-field": "bearer-token"
32
+ })] });
33
+ $[3] = ids.bearerToken;
25
34
  $[4] = t1;
26
35
  } else t1 = $[4];
27
- let t2;
28
- if ($[5] !== state.bearerToken || $[6] !== t1) {
29
- t2 = /* @__PURE__ */ jsx("input", {
30
- type: "password",
31
- placeholder: "Bearer token",
32
- value: state.bearerToken,
33
- onChange: t1,
34
- "data-mcp-auth-field": "bearer-token"
35
- });
36
- $[5] = state.bearerToken;
37
- $[6] = t1;
38
- $[7] = t2;
39
- } else t2 = $[7];
40
- return t2;
36
+ return t1;
41
37
  }
42
38
  if (state.authType === "oauth") {
43
39
  let t1;
44
- if ($[8] !== setField) {
45
- t1 = (e_0) => setField("scopes", e_0.target.value);
46
- $[8] = setField;
47
- $[9] = t1;
48
- } else t1 = $[9];
49
- let t2;
50
- if ($[10] !== state.scopes || $[11] !== t1) {
51
- t2 = /* @__PURE__ */ jsx("input", {
52
- type: "text",
53
- placeholder: "Scopes (space-separated, optional)",
54
- value: state.scopes,
55
- onChange: t1,
40
+ if ($[5] !== ids.scopes) {
41
+ t1 = /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
42
+ htmlFor: ids.scopes,
43
+ "data-mcp-auth-field-label": "oauth-scopes",
44
+ children: "OAuth scopes"
45
+ }), /* @__PURE__ */ jsx(McpAddFormPrimitiveScopesField, {
46
+ id: ids.scopes,
56
47
  "data-mcp-auth-field": "oauth-scopes"
57
- });
58
- $[10] = state.scopes;
59
- $[11] = t1;
60
- $[12] = t2;
61
- } else t2 = $[12];
62
- return t2;
48
+ })] });
49
+ $[5] = ids.scopes;
50
+ $[6] = t1;
51
+ } else t1 = $[6];
52
+ return t1;
63
53
  }
64
54
  return null;
65
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthFields.js","names":["FC","AddFormAuthType","useAddForm","McpAddFormPrimitiveAuthFields","Props","children","authType","t0","$","_c","state","setField","Render","t1","e","target","value","t2","bearerToken","e_0","scopes","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { type AddFormAuthType, useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveAuthFields {\n export type Props = {\n /**\n * Optional render override. Receives the current auth type so apps can render\n * fully custom inputs. Defaults to a minimal built-in for bearer / oauth.\n */\n children?: FC<{ authType: AddFormAuthType }>;\n };\n}\n\nexport const McpAddFormPrimitiveAuthFields: FC<\n McpAddFormPrimitiveAuthFields.Props\n> = ({ children }) => {\n const { state, setField } = useAddForm();\n\n if (children) {\n const Render = children;\n return <Render authType={state.authType} />;\n }\n\n if (state.authType === \"bearer\") {\n return (\n <input\n type=\"password\"\n placeholder=\"Bearer token\"\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n data-mcp-auth-field=\"bearer-token\"\n />\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <input\n type=\"text\"\n placeholder=\"Scopes (space-separated, optional)\"\n value={state.scopes}\n onChange={(e) => setField(\"scopes\", e.target.value)}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;;AAaA,MAAaG,iCAETI,OAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAC,MAAA,EAAAJ,aAAAE;CACH,MAAA,EAAAG,OAAAC,aAA4BT,WAAW;CAEvC,IAAIG,UAAQ;EACV,MAAAO,SAAeP;EAAS,IAAAQ;EAAA,IAAAL,EAAA,OAAAI,UAAAJ,EAAA,OAAAE,MAAAJ,UAAA;GACjBO,KAAA,oBAAC,QAAD,EAAkB,UAAAH,MAAKJ,SAAS,CAAA;GAAIE,EAAA,KAAAI;GAAAJ,EAAA,KAAAE,MAAAJ;GAAAE,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAApCK;CAAoC;CAG7C,IAAIH,MAAKJ,aAAc,UAAQ;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,UAAA;GAMfE,MAAAC,MAAOH,SAAS,eAAeG,EAACC,OAAOC,KAAM;GAACR,EAAA,KAAAG;GAAAH,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,IAAAS;EAAA,IAAAT,EAAA,OAAAE,MAAAQ,eAAAV,EAAA,OAAAK,IAAA;GAJ1DI,KAAA,oBAAA,SAAA;IACO,MAAA;IACO,aAAA;IACL,OAAAP,MAAKQ;IACF,UAAAL;IACU,uBAAA;GAAc,CAAA;GAClCL,EAAA,KAAAE,MAAAQ;GAAAV,EAAA,KAAAK;GAAAL,EAAA,KAAAS;EAAA,OAAAA,KAAAT,EAAA;EAAA,OANFS;CAME;CAIN,IAAIP,MAAKJ,aAAc,SAAO;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,UAAA;GAMdE,MAAAM,QAAOR,SAAS,UAAUG,IAACC,OAAOC,KAAM;GAACR,EAAA,KAAAG;GAAAH,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,IAAAS;EAAA,IAAAT,EAAA,QAAAE,MAAAU,UAAAZ,EAAA,QAAAK,IAAA;GAJrDI,KAAA,oBAAA,SAAA;IACO,MAAA;IACO,aAAA;IACL,OAAAP,MAAKU;IACF,UAAAP;IACU,uBAAA;GAAc,CAAA;GAClCL,EAAA,MAAAE,MAAAU;GAAAZ,EAAA,MAAAK;GAAAL,EAAA,MAAAS;EAAA,OAAAA,KAAAT,EAAA;EAAA,OANFS;CAME;CAEL,OAEM;AAAI;AAGbd,8BAA8BkB,cAAc"}
1
+ {"version":3,"file":"McpAddFormAuthFields.js","names":["FC","McpAddFormPrimitiveBearerTokenField","McpAddFormPrimitiveScopesField","AddFormAuthType","useAddForm","McpAddFormPrimitiveAuthFields","Props","children","authType","t0","$","_c","state","ids","Render","t1","bearerToken","scopes","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { McpAddFormPrimitiveBearerTokenField } from \"./McpAddFormBearerTokenField\";\nimport { McpAddFormPrimitiveScopesField } from \"./McpAddFormScopesField\";\nimport { type AddFormAuthType, useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveAuthFields {\n export type Props = {\n /**\n * Optional render override. Receives the current auth type so apps can render\n * fully custom inputs, bound to the form through `BearerTokenField` and\n * `ScopesField`. Defaults to a minimal built-in for bearer / oauth.\n */\n children?: FC<{ authType: AddFormAuthType }>;\n };\n}\n\nexport const McpAddFormPrimitiveAuthFields: FC<\n McpAddFormPrimitiveAuthFields.Props\n> = ({ children }) => {\n const { state, ids } = useAddForm();\n\n if (children) {\n const Render = children;\n return <Render authType={state.authType} />;\n }\n\n if (state.authType === \"bearer\") {\n return (\n <div>\n <label\n htmlFor={ids.bearerToken}\n data-mcp-auth-field-label=\"bearer-token\"\n >\n Bearer token\n </label>\n <McpAddFormPrimitiveBearerTokenField\n id={ids.bearerToken}\n data-mcp-auth-field=\"bearer-token\"\n />\n </div>\n );\n }\n\n if (state.authType === \"oauth\") {\n return (\n <div>\n <label htmlFor={ids.scopes} data-mcp-auth-field-label=\"oauth-scopes\">\n OAuth scopes\n </label>\n <McpAddFormPrimitiveScopesField\n id={ids.scopes}\n data-mcp-auth-field=\"oauth-scopes\"\n />\n </div>\n );\n }\n\n return null;\n};\n\nMcpAddFormPrimitiveAuthFields.displayName = \"McpAddFormPrimitive.AuthFields\";\n"],"mappings":";;;;;;AAgBA,MAAaK,iCAETI,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAC,MAAA,EAAAJ,aAAAE;CACH,MAAA,EAAAG,OAAAC,QAAuBT,WAAW;CAElC,IAAIG,UAAQ;EACV,MAAAO,SAAeP;EAAS,IAAAQ;EAAA,IAAAL,EAAA,OAAAI,UAAAJ,EAAA,OAAAE,MAAAJ,UAAA;GACjBO,KAAA,oBAAC,QAAD,EAAkB,UAAAH,MAAKJ,SAAS,CAAA;GAAIE,EAAA,KAAAI;GAAAJ,EAAA,KAAAE,MAAAJ;GAAAE,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAApCK;CAAoC;CAG7C,IAAIH,MAAKJ,aAAc,UAAQ;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAG,aAAA;GAE3BD,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IACW,SAAAF,IAAGG;IACc,6BAAA;IAC3B,UAAA;GAEO,CAAA,GACR,oBAAC,qCAAD;IACM,IAAAH,IAAGG;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAN,EAAA,KAAAG,IAAAG;GAAAN,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OAXNK;CAWM;CAIV,IAAIH,MAAKJ,aAAc,SAAO;EAAA,IAAAO;EAAA,IAAAL,EAAA,OAAAG,IAAAI,QAAA;GAE1BF,KAAA,qBAAA,OAAA,EAAA,UAAA,CACE,oBAAA,SAAA;IAAgB,SAAAF,IAAGI;IAAmC,6BAAA;IAAe,UAAA;GAE7D,CAAA,GACR,oBAAC,gCAAD;IACM,IAAAJ,IAAGI;IACa,uBAAA;GAAc,CAAA,CAEhC,EAAA,CAAA;GAAAP,EAAA,KAAAG,IAAAI;GAAAP,EAAA,KAAAK;EAAA,OAAAA,KAAAL,EAAA;EAAA,OARNK;CAQM;CAET,OAEM;AAAI;AAGbV,8BAA8Ba,cAAc"}
@@ -1,11 +1,10 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
3
  //#region src/primitives/addForm/McpAddFormAuthSelect.d.ts
4
- declare namespace McpAddFormPrimitiveAuthSelect {
4
+ export declare namespace McpAddFormPrimitiveAuthSelect {
5
5
  type Element = ComponentRef<typeof Primitive.select>;
6
6
  type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.select>, "value" | "onChange">;
7
7
  }
8
- declare const McpAddFormPrimitiveAuthSelect: import("react").ForwardRefExoticComponent<McpAddFormPrimitiveAuthSelect.Props & import("react").RefAttributes<HTMLSelectElement>>;
8
+ export declare const McpAddFormPrimitiveAuthSelect: import("react").ForwardRefExoticComponent<McpAddFormPrimitiveAuthSelect.Props & import("react").RefAttributes<HTMLSelectElement>>;
9
9
  //#endregion
10
- export { McpAddFormPrimitiveAuthSelect };
11
10
  //# sourceMappingURL=McpAddFormAuthSelect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthSelect.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"mappings":";;;kBAoBiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;cAKjC,+CAA6B,0BAAA,8BAAA,wBAAA,cAAA"}
1
+ {"version":3,"file":"McpAddFormAuthSelect.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"mappings":";;;yBAoBiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;qBAKjC,+CAA6B,0BAAA,8BAAA,wBAAA,cAAA"}
@@ -0,0 +1,10 @@
1
+ import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
+ import { Primitive } from "@radix-ui/react-primitive";
3
+ //#region src/primitives/addForm/McpAddFormBearerTokenField.d.ts
4
+ export declare namespace McpAddFormPrimitiveBearerTokenField {
5
+ type Element = ComponentRef<typeof Primitive.input>;
6
+ type Props = Omit<ComponentPropsWithoutRef<typeof Primitive.input>, "value" | "onChange" | "type">;
7
+ }
8
+ export declare const McpAddFormPrimitiveBearerTokenField: import("react").ForwardRefExoticComponent<McpAddFormPrimitiveBearerTokenField.Props & import("react").RefAttributes<HTMLInputElement>>;
9
+ //#endregion
10
+ //# sourceMappingURL=McpAddFormBearerTokenField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpAddFormBearerTokenField.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormBearerTokenField.tsx"],"mappings":";;;yBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;qBAKjC,qDAAmC,0BAAA,oCAAA,wBAAA,cAAA"}
@@ -0,0 +1,50 @@
1
+ import { useAddForm } from "./context.js";
2
+ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
3
+ import { forwardRef } from "@assistant-ui/tap/react-shim";
4
+ import { Primitive } from "@radix-ui/react-primitive";
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/primitives/addForm/McpAddFormBearerTokenField.tsx
7
+ const McpAddFormPrimitiveBearerTokenField = forwardRef((props, ref) => {
8
+ const $ = c(13);
9
+ const { state, ids, setField } = useAddForm();
10
+ const t0 = props["aria-invalid"] ?? (state.errorField === "bearerToken" ? true : void 0);
11
+ let t1;
12
+ if ($[0] !== ids || $[1] !== props || $[2] !== state.errorField) {
13
+ t1 = [props["aria-describedby"], state.errorField === "bearerToken" ? ids.error : null].filter(Boolean).join(" ") || void 0;
14
+ $[0] = ids;
15
+ $[1] = props;
16
+ $[2] = state.errorField;
17
+ $[3] = t1;
18
+ } else t1 = $[3];
19
+ let t2;
20
+ if ($[4] !== setField) {
21
+ t2 = (e) => setField("bearerToken", e.target.value);
22
+ $[4] = setField;
23
+ $[5] = t2;
24
+ } else t2 = $[5];
25
+ let t3;
26
+ if ($[6] !== props || $[7] !== ref || $[8] !== state.bearerToken || $[9] !== t0 || $[10] !== t1 || $[11] !== t2) {
27
+ t3 = /* @__PURE__ */ jsx(Primitive.input, {
28
+ type: "password",
29
+ ...props,
30
+ "aria-invalid": t0,
31
+ "aria-describedby": t1,
32
+ ref,
33
+ value: state.bearerToken,
34
+ onChange: t2
35
+ });
36
+ $[6] = props;
37
+ $[7] = ref;
38
+ $[8] = state.bearerToken;
39
+ $[9] = t0;
40
+ $[10] = t1;
41
+ $[11] = t2;
42
+ $[12] = t3;
43
+ } else t3 = $[12];
44
+ return t3;
45
+ });
46
+ McpAddFormPrimitiveBearerTokenField.displayName = "McpAddFormPrimitive.BearerTokenField";
47
+ //#endregion
48
+ export { McpAddFormPrimitiveBearerTokenField };
49
+
50
+ //# sourceMappingURL=McpAddFormBearerTokenField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"McpAddFormBearerTokenField.js","names":["ComponentPropsWithoutRef","ComponentRef","forwardRef","Primitive","useAddForm","McpAddFormPrimitiveBearerTokenField","Element","input","Props","Omit","props","ref","$","_c","state","ids","setField","t0","errorField","undefined","t1","error","filter","Boolean","join","t2","e","target","value","t3","bearerToken","displayName"],"sources":["../../../src/primitives/addForm/McpAddFormBearerTokenField.tsx"],"sourcesContent":["import {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n forwardRef,\n} from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useAddForm } from \"./context\";\n\nexport namespace McpAddFormPrimitiveBearerTokenField {\n export type Element = ComponentRef<typeof Primitive.input>;\n export type Props = Omit<\n ComponentPropsWithoutRef<typeof Primitive.input>,\n \"value\" | \"onChange\" | \"type\"\n >;\n}\n\nexport const McpAddFormPrimitiveBearerTokenField = forwardRef<\n McpAddFormPrimitiveBearerTokenField.Element,\n McpAddFormPrimitiveBearerTokenField.Props\n>((props, ref) => {\n const { state, ids, setField } = useAddForm();\n return (\n <Primitive.input\n type=\"password\"\n {...props}\n aria-invalid={\n props[\"aria-invalid\"] ??\n (state.errorField === \"bearerToken\" ? true : undefined)\n }\n aria-describedby={\n [\n props[\"aria-describedby\"],\n state.errorField === \"bearerToken\" ? ids.error : null,\n ]\n .filter(Boolean)\n .join(\" \") || undefined\n }\n ref={ref}\n value={state.bearerToken}\n onChange={(e) => setField(\"bearerToken\", e.target.value)}\n />\n );\n});\n\nMcpAddFormPrimitiveBearerTokenField.displayName =\n \"McpAddFormPrimitive.BearerTokenField\";\n"],"mappings":";;;;;;AAgBA,MAAaK,sCAAsCH,YAGjDQ,OAAAC,QAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CACA,MAAA,EAAAC,OAAAC,KAAAC,aAAiCZ,WAAW;CAMtC,MAAAa,KAAAP,MAAM,oBACLI,MAAKI,eAAgB,gBAArB,OAAAC,KAAAA;CAAsD,IAAAC;CAAA,IAAAR,EAAA,OAAAG,OAAAH,EAAA,OAAAF,SAAAE,EAAA,OAAAE,MAAAI,YAAA;EAGvDE,KAAA,CACEV,MAAM,qBACNI,MAAKI,eAAgB,gBAAgBH,IAAGM,QAAxC,IAAqD,CACtD,CAAAC,OACSC,OAAO,CAAC,CAAAC,KACV,GAAgB,KALxBL,KAAAA;EAKyBP,EAAA,KAAAG;EAAAH,EAAA,KAAAF;EAAAE,EAAA,KAAAE,MAAAI;EAAAN,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAI,UAAA;EAIjBS,MAAAC,MAAOV,SAAS,eAAeU,EAACC,OAAOC,KAAM;EAAChB,EAAA,KAAAI;EAAAJ,EAAA,KAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAiB;CAAA,IAAAjB,EAAA,OAAAF,SAAAE,EAAA,OAAAD,OAAAC,EAAA,OAAAE,MAAAgB,eAAAlB,EAAA,OAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,IAAA;EAjB1DI,KAAA,oBAAA,UAAA,OAAA;GACO,MAAA;GAAU,GACXnB;GAEF,gBAAAO;GAIA,oBAAAG;GAOGT;GACE,OAAAG,MAAKgB;GACF,UAAAL;EAA8C,CAAA;EACxDb,EAAA,KAAAF;EAAAE,EAAA,KAAAD;EAAAC,EAAA,KAAAE,MAAAgB;EAAAlB,EAAA,KAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAiB;CAAA,OAAAA,KAAAjB,EAAA;CAAA,OAlBFiB;AAkBE,CAEL;AAEDxB,oCAAoC0B,cAClC"}
@@ -1,13 +1,12 @@
1
1
  import { ComponentPropsWithoutRef, ComponentRef } from "react";
2
2
  import { Primitive } from "@radix-ui/react-primitive";
3
3
  //#region src/primitives/addForm/McpAddFormCancel.d.ts
4
- declare namespace McpAddFormPrimitiveCancel {
4
+ export declare namespace McpAddFormPrimitiveCancel {
5
5
  type Element = ComponentRef<typeof Primitive.button>;
6
6
  type Props = ComponentPropsWithoutRef<typeof Primitive.button>;
7
7
  }
8
- declare const McpAddFormPrimitiveCancel: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
+ export declare const McpAddFormPrimitiveCancel: import("react").ForwardRefExoticComponent<Omit<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
9
9
  asChild?: boolean;
10
10
  }, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
11
11
  //#endregion
12
- export { McpAddFormPrimitiveCancel };
13
12
  //# sourceMappingURL=McpAddFormCancel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormCancel.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAiBpC,cAAA"}
1
+ {"version":3,"file":"McpAddFormCancel.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"mappings":";;;yBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;qBAGnD,2CAAyB,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA;;4BAiBpC,cAAA"}