@assistant-ui/react-mcp 0.0.17 → 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 (98) 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 +16 -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 -4
  75. package/dist/resources/McpManagerResource.d.ts.map +1 -1
  76. package/dist/resources/McpServerResource.d.ts +0 -1
  77. package/dist/resources/McpServerResource.d.ts.map +1 -1
  78. package/dist/resources/McpServerResource.js +10 -3
  79. package/dist/resources/McpServerResource.js.map +1 -1
  80. package/dist/resources/storage/McpCustomStorage.d.ts +0 -1
  81. package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
  82. package/dist/resources/storage/McpLocalStorage.d.ts +8 -3
  83. package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
  84. package/dist/resources/storage/McpLocalStorage.js +55 -3
  85. package/dist/resources/storage/McpLocalStorage.js.map +1 -1
  86. package/dist/resources/storage/McpMemoryStorage.d.ts +0 -1
  87. package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
  88. package/dist/resources/storage/types.d.ts +0 -1
  89. package/dist/resources/storage/types.d.ts.map +1 -1
  90. package/dist/utils/serverId.d.ts.map +1 -1
  91. package/package.json +8 -8
  92. package/src/hooks/useMcpOAuthCallback.test.ts +24 -0
  93. package/src/hooks/useMcpOAuthCallback.tsx +20 -5
  94. package/src/mcp-scope.ts +2 -0
  95. package/src/resources/McpServerResource.test.ts +152 -9
  96. package/src/resources/McpServerResource.ts +10 -1
  97. package/src/resources/storage/McpLocalStorage.test.ts +184 -0
  98. package/src/resources/storage/McpLocalStorage.ts +113 -3
@@ -1,6 +1,5 @@
1
1
  import { MCPAuthConfig } from "../mcp-scope.js";
2
2
  import { MCPPersistedAuthState } from "./types.js";
3
-
4
3
  //#region src/auth/buildHeaders.d.ts
5
4
  /**
6
5
  * Build request headers for the bearer/none flows. For bearer, prefer a token
@@ -1 +1 @@
1
- {"version":3,"file":"buildHeaders.d.ts","names":[],"sources":["../../src/auth/buildHeaders.ts"],"mappings":";;;;;;AAQA;;;iBAAgB,YAAA,CACd,IAAA,EAAM,aAAA,EACN,SAAA,EAAW,qBAAA,UACV,MAAA"}
1
+ {"version":3,"file":"buildHeaders.d.ts","names":[],"sources":["../../src/auth/buildHeaders.ts"],"mappings":";;;;;;;;iBAQgB,aACd,MAAM,eACN,WAAW,+BACV"}
@@ -1,16 +1,17 @@
1
1
  import { MCPAuthConfig } from "../mcp-scope.js";
2
2
  import { MCPStorage } from "../resources/storage/types.js";
3
3
  import { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
4
-
5
4
  //#region src/auth/createOAuthProvider.d.ts
6
5
  declare function decodeServerIdFromState(state: string): string | null;
7
6
  type CreateOAuthProviderOptions = {
8
- serverId: string; /** Must be `auth.type === "oauth"`. */
7
+ serverId: string;
8
+ /** Must be `auth.type === "oauth"`. */
9
9
  config: Extract<MCPAuthConfig, {
10
10
  type: "oauth";
11
11
  }>;
12
12
  storage: MCPStorage;
13
- redirectUri: string; /** Called by the SDK to start the authorization redirect. */
13
+ redirectUri: string;
14
+ /** Called by the SDK to start the authorization redirect. */
14
15
  onAuthorizationUrl: (url: URL) => void;
15
16
  };
16
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"createOAuthProvider.d.ts","names":[],"sources":["../../src/auth/createOAuthProvider.ts"],"mappings":";;;;;iBAgCgB,uBAAA,CAAwB,KAAa;AAAA,KAgBzC,0BAAA;EACV,QAAA,UAjBqC;EAmBrC,MAAA,EAAQ,OAAA,CAAQ,aAAA;IAAiB,IAAA;EAAA;EACjC,OAAA,EAAS,UAAA;EACT,WAAA;EAEA,kBAAA,GAAqB,GAAA,EAAK,GAAA;AAAA;;;;;;iBAQZ,mBAAA,CACd,IAAA,EAAM,0BAAA,GACL,mBAAmB"}
1
+ {"version":3,"file":"createOAuthProvider.d.ts","names":[],"sources":["../../src/auth/createOAuthProvider.ts"],"mappings":";;;;iBAgCgB,wBAAwB;KAgB5B;EACV;;EAEA,QAAQ,QAAQ;IAAiB;;EACjC,SAAS;EACT;;EAEA,qBAAqB,KAAK;;;;;;;iBAQZ,oBACd,MAAM,6BACL"}
@@ -13,7 +13,8 @@ function base64UrlToBytes(b64url) {
13
13
  return out;
14
14
  }
15
15
  function encodeServerIdInState(serverId) {
16
- return `${STATE_PREFIX}${bytesToBase64Url(new TextEncoder().encode(serverId))}`;
16
+ const bytes = new TextEncoder().encode(serverId);
17
+ return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;
17
18
  }
18
19
  function decodeServerIdFromState(state) {
19
20
  if (!state.startsWith(STATE_PREFIX)) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"createOAuthProvider.js","names":["OAuthClientProvider","OAuthClientInformationFull","OAuthClientMetadata","OAuthTokens","MCPStorage","MCPAuthConfig","STATE_PREFIX","bytesToBase64Url","bytes","Uint8Array","s","b","String","fromCharCode","btoa","replace","base64UrlToBytes","b64url","padded","repeat","length","bin","atob","out","i","charCodeAt","encodeServerIdInState","serverId","TextEncoder","encode","decodeServerIdFromState","state","startsWith","dot","indexOf","encoded","slice","TextDecoder","fatal","decode","CreateOAuthProviderOptions","config","Extract","type","storage","redirectUri","onAuthorizationUrl","url","URL","createOAuthProvider","opts","Cache","tokens","clientInformation","codeVerifier","cached","loadCache","Promise","persisted","loadAuthState","initial","clientId","ci","client_id","redirect_uris","clientSecret","client_secret","persist","c","next","Parameters","saveAuthState","clientMetadata","client_name","grant_types","response_types","token_endpoint_auth_method","scope","scopes","join","redirectUrl","nonce","crypto","randomUUID","Date","now","Math","random","saveClientInformation","info","saveTokens","redirectToAuthorization","saveCodeVerifier","Error","invalidateCredentials"],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens,\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\n\nconst STATE_PREFIX = \"aui-mcp:\";\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let s = \"\";\n for (const b of bytes) s += String.fromCharCode(b);\n return btoa(s).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nfunction base64UrlToBytes(b64url: string): Uint8Array {\n const padded =\n b64url.replace(/-/g, \"+\").replace(/_/g, \"/\") +\n \"=\".repeat((4 - (b64url.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n\nfunction encodeServerIdInState(serverId: string): string {\n const bytes = new TextEncoder().encode(serverId);\n return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;\n}\n\nexport function decodeServerIdFromState(state: string): string | null {\n if (!state.startsWith(STATE_PREFIX)) return null;\n const dot = state.indexOf(\".\", STATE_PREFIX.length);\n const encoded =\n dot === -1\n ? state.slice(STATE_PREFIX.length)\n : state.slice(STATE_PREFIX.length, dot);\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(\n base64UrlToBytes(encoded),\n );\n } catch {\n return null;\n }\n}\n\nexport type CreateOAuthProviderOptions = {\n serverId: string;\n /** Must be `auth.type === \"oauth\"`. */\n config: Extract<MCPAuthConfig, { type: \"oauth\" }>;\n storage: MCPStorage;\n redirectUri: string;\n /** Called by the SDK to start the authorization redirect. */\n onAuthorizationUrl: (url: URL) => void;\n};\n\n/**\n * Builds an OAuthClientProvider for the MCP SDK, backed by MCPStorage.\n * Token refresh and DCR are handled by the SDK; this provider only mediates\n * load/save and the redirect step.\n */\nexport function createOAuthProvider(\n opts: CreateOAuthProviderOptions,\n): OAuthClientProvider {\n const { serverId, config, storage, redirectUri, onAuthorizationUrl } = opts;\n\n type Cache = {\n tokens?: OAuthTokens | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n codeVerifier?: string | undefined;\n };\n let cached: Cache | null = null;\n\n const loadCache = async (): Promise<Cache> => {\n if (cached) return cached;\n const persisted = await storage.loadAuthState(serverId);\n const initial: Cache = {};\n if (persisted?.tokens) initial.tokens = persisted.tokens;\n if (config.clientId) {\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n initial.clientInformation = ci;\n } else if (persisted?.clientInformation) {\n initial.clientInformation = persisted.clientInformation;\n }\n if (persisted?.codeVerifier) initial.codeVerifier = persisted.codeVerifier;\n cached = initial;\n return cached;\n };\n\n const persist = async () => {\n const c = cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (c.tokens) next.tokens = c.tokens;\n if (c.clientInformation) next.clientInformation = c.clientInformation;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n await storage.saveAuthState(serverId, next);\n };\n\n const clientMetadata: OAuthClientMetadata = {\n client_name: \"assistant-ui\",\n redirect_uris: [redirectUri],\n grant_types: [\"authorization_code\", \"refresh_token\"],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\",\n scope: config.scopes?.join(\" \"),\n };\n\n return {\n get redirectUrl() {\n return redirectUri;\n },\n get clientMetadata() {\n return clientMetadata;\n },\n state() {\n // Embed the server id so the callback handler can route it back to the\n // right MCPServerResource without app-level wiring.\n const nonce =\n typeof crypto !== \"undefined\" && \"randomUUID\" in crypto\n ? crypto.randomUUID()\n : `${Date.now()}.${Math.random()}`;\n return `${encodeServerIdInState(serverId)}.${nonce}`;\n },\n async clientInformation() {\n const c = await loadCache();\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\n await persist();\n },\n async redirectToAuthorization(url) {\n onAuthorizationUrl(url);\n },\n async saveCodeVerifier(codeVerifier) {\n const c = await loadCache();\n c.codeVerifier = codeVerifier;\n await persist();\n },\n async codeVerifier() {\n const c = await loadCache();\n if (!c.codeVerifier) {\n throw new Error(\"No code verifier saved for this OAuth flow\");\n }\n return c.codeVerifier;\n },\n async invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") delete c.tokens;\n if (scope === \"all\" || scope === \"client\") delete c.clientInformation;\n if (scope === \"all\" || scope === \"verifier\") delete c.codeVerifier;\n await persist();\n },\n };\n}\n"],"mappings":";AASA,MAAMM,eAAe;AAErB,SAASC,iBAAiBC,OAA2B;CACnD,IAAIE,IAAI;CACR,KAAK,MAAMC,KAAKH,OAAOE,KAAKE,OAAOC,aAAaF,CAAC;CACjD,OAAOG,KAAKJ,CAAC,CAAC,CAACK,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,EAAE;AAC1E;AAEA,SAASC,iBAAiBC,QAA4B;CACpD,MAAMC,SACJD,OAAOF,QAAQ,MAAM,GAAG,CAAC,CAACA,QAAQ,MAAM,GAAG,IAC3C,IAAII,QAAQ,IAAKF,OAAOG,SAAS,KAAM,CAAC;C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,MAAMwB,wBAAwB5C,KAAK;GACjCD,mBAAmBC,GAAG;EACxB;EACA,MAAM6C,iBAAiBtC,cAAc;GACnC,MAAMc,IAAI,MAAMZ,UAAU;GAC1BY,EAAEd,eAAeA;GACjB,MAAMa,QAAQ;EAChB;EACA,MAAMb,eAAe;GACnB,MAAMc,IAAI,MAAMZ,UAAU;GAC1B,IAAI,CAACY,EAAEd,cACL,MAAM,IAAIuC,MAAM,4CAA4C;GAE9D,OAAOzB,EAAEd;EACX;EACA,MAAMwC,sBAAsBjB,OAAO;GACjC,MAAMT,IAAI,MAAMZ,UAAU;GAC1B,IAAIqB,UAAU,SAASA,UAAU,UAAU,OAAOT,EAAEhB;GACpD,IAAIyB,UAAU,SAASA,UAAU,UAAU,OAAOT,EAAEf;GACpD,IAAIwB,UAAU,SAASA,UAAU,YAAY,OAAOT,EAAEd;GACtD,MAAMa,QAAQ;EAChB;CACF;AACF"}
1
+ {"version":3,"file":"createOAuthProvider.js","names":["OAuthClientProvider","OAuthClientInformationFull","OAuthClientMetadata","OAuthTokens","MCPStorage","MCPAuthConfig","STATE_PREFIX","bytesToBase64Url","bytes","Uint8Array","s","b","String","fromCharCode","btoa","replace","base64UrlToBytes","b64url","padded","repeat","length","bin","atob","out","i","charCodeAt","encodeServerIdInState","serverId","TextEncoder","encode","decodeServerIdFromState","state","startsWith","dot","indexOf","encoded","slice","TextDecoder","fatal","decode","CreateOAuthProviderOptions","config","Extract","type","storage","redirectUri","onAuthorizationUrl","url","URL","createOAuthProvider","opts","Cache","tokens","clientInformation","codeVerifier","cached","loadCache","Promise","persisted","loadAuthState","initial","clientId","ci","client_id","redirect_uris","clientSecret","client_secret","persist","c","next","Parameters","saveAuthState","clientMetadata","client_name","grant_types","response_types","token_endpoint_auth_method","scope","scopes","join","redirectUrl","nonce","crypto","randomUUID","Date","now","Math","random","saveClientInformation","info","saveTokens","redirectToAuthorization","saveCodeVerifier","Error","invalidateCredentials"],"sources":["../../src/auth/createOAuthProvider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens,\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport type { MCPStorage } from \"../resources/storage/types\";\nimport type { MCPAuthConfig } from \"../mcp-scope\";\n\nconst STATE_PREFIX = \"aui-mcp:\";\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let s = \"\";\n for (const b of bytes) s += String.fromCharCode(b);\n return btoa(s).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n}\n\nfunction base64UrlToBytes(b64url: string): Uint8Array {\n const padded =\n b64url.replace(/-/g, \"+\").replace(/_/g, \"/\") +\n \"=\".repeat((4 - (b64url.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n\nfunction encodeServerIdInState(serverId: string): string {\n const bytes = new TextEncoder().encode(serverId);\n return `${STATE_PREFIX}${bytesToBase64Url(bytes)}`;\n}\n\nexport function decodeServerIdFromState(state: string): string | null {\n if (!state.startsWith(STATE_PREFIX)) return null;\n const dot = state.indexOf(\".\", STATE_PREFIX.length);\n const encoded =\n dot === -1\n ? state.slice(STATE_PREFIX.length)\n : state.slice(STATE_PREFIX.length, dot);\n try {\n return new TextDecoder(\"utf-8\", { fatal: true }).decode(\n base64UrlToBytes(encoded),\n );\n } catch {\n return null;\n }\n}\n\nexport type CreateOAuthProviderOptions = {\n serverId: string;\n /** Must be `auth.type === \"oauth\"`. */\n config: Extract<MCPAuthConfig, { type: \"oauth\" }>;\n storage: MCPStorage;\n redirectUri: string;\n /** Called by the SDK to start the authorization redirect. */\n onAuthorizationUrl: (url: URL) => void;\n};\n\n/**\n * Builds an OAuthClientProvider for the MCP SDK, backed by MCPStorage.\n * Token refresh and DCR are handled by the SDK; this provider only mediates\n * load/save and the redirect step.\n */\nexport function createOAuthProvider(\n opts: CreateOAuthProviderOptions,\n): OAuthClientProvider {\n const { serverId, config, storage, redirectUri, onAuthorizationUrl } = opts;\n\n type Cache = {\n tokens?: OAuthTokens | undefined;\n clientInformation?: OAuthClientInformationFull | undefined;\n codeVerifier?: string | undefined;\n };\n let cached: Cache | null = null;\n\n const loadCache = async (): Promise<Cache> => {\n if (cached) return cached;\n const persisted = await storage.loadAuthState(serverId);\n const initial: Cache = {};\n if (persisted?.tokens) initial.tokens = persisted.tokens;\n if (config.clientId) {\n const ci: OAuthClientInformationFull = {\n client_id: config.clientId,\n redirect_uris: [redirectUri],\n };\n if (config.clientSecret) ci.client_secret = config.clientSecret;\n initial.clientInformation = ci;\n } else if (persisted?.clientInformation) {\n initial.clientInformation = persisted.clientInformation;\n }\n if (persisted?.codeVerifier) initial.codeVerifier = persisted.codeVerifier;\n cached = initial;\n return cached;\n };\n\n const persist = async () => {\n const c = cached;\n if (!c) return;\n const next: Parameters<typeof storage.saveAuthState>[1] = {};\n if (c.tokens) next.tokens = c.tokens;\n if (c.clientInformation) next.clientInformation = c.clientInformation;\n if (c.codeVerifier) next.codeVerifier = c.codeVerifier;\n await storage.saveAuthState(serverId, next);\n };\n\n const clientMetadata: OAuthClientMetadata = {\n client_name: \"assistant-ui\",\n redirect_uris: [redirectUri],\n grant_types: [\"authorization_code\", \"refresh_token\"],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\",\n scope: config.scopes?.join(\" \"),\n };\n\n return {\n get redirectUrl() {\n return redirectUri;\n },\n get clientMetadata() {\n return clientMetadata;\n },\n state() {\n // Embed the server id so the callback handler can route it back to the\n // right MCPServerResource without app-level wiring.\n const nonce =\n typeof crypto !== \"undefined\" && \"randomUUID\" in crypto\n ? crypto.randomUUID()\n : `${Date.now()}.${Math.random()}`;\n return `${encodeServerIdInState(serverId)}.${nonce}`;\n },\n async clientInformation() {\n const c = await loadCache();\n return c.clientInformation;\n },\n async saveClientInformation(info) {\n const c = await loadCache();\n c.clientInformation = info as OAuthClientInformationFull;\n await persist();\n },\n async tokens() {\n const c = await loadCache();\n return c.tokens;\n },\n async saveTokens(tokens) {\n const c = await loadCache();\n c.tokens = tokens;\n await persist();\n },\n async redirectToAuthorization(url) {\n onAuthorizationUrl(url);\n },\n async saveCodeVerifier(codeVerifier) {\n const c = await loadCache();\n c.codeVerifier = codeVerifier;\n await persist();\n },\n async codeVerifier() {\n const c = await loadCache();\n if (!c.codeVerifier) {\n throw new Error(\"No code verifier saved for this OAuth flow\");\n }\n return c.codeVerifier;\n },\n async invalidateCredentials(scope) {\n const c = await loadCache();\n if (scope === \"all\" || scope === \"tokens\") delete c.tokens;\n if (scope === \"all\" || scope === \"client\") delete c.clientInformation;\n if (scope === \"all\" || scope === \"verifier\") delete c.codeVerifier;\n await persist();\n },\n };\n}\n"],"mappings":";AASA,MAAMM,eAAe;AAErB,SAASC,iBAAiBC,OAA2B;CACnD,IAAIE,IAAI;CACR,KAAK,MAAMC,KAAKH,OAAOE,KAAKE,OAAOC,aAAaF,CAAC;CACjD,OAAOG,KAAKJ,CAAC,CAAC,CAACK,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,GAAG,CAAC,CAACA,QAAQ,OAAO,EAAE;AAC1E;AAEA,SAASC,iBAAiBC,QAA4B;CACpD,MAAMC,SACJD,OAAOF,QAAQ,MAAM,GAAG,CAAC,CAACA,QAAQ,MAAM,GAAG,IAC3C,IAAII,QAAQ,IAAKF,OAAOG,SAAS,KAAM,CAAC;CAC1C,MAAMC,MAAMC,KAAKJ,MAAM;CACvB,MAAMK,MAAM,IAAId,WAAWY,IAAID,MAAM;CACrC,KAAK,IAAII,IAAI,GAAGA,IAAIH,IAAID,QAAQI,KAAKD,IAAIC,KAAKH,IAAII,WAAWD,CAAC;CAC9D,OAAOD;AACT;AAEA,SAASG,sBAAsBC,UAA0B;CACvD,MAAMnB,QAAQ,IAAIoB,YAAY,CAAC,CAACC,OAAOF,QAAQ;CAC/C,OAAO,GAAGr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4C;GAE9D,OAAOzB,EAAEd;EACX;EACA,MAAMwC,sBAAsBjB,OAAO;GACjC,MAAMT,IAAI,MAAMZ,UAAU;GAC1B,IAAIqB,UAAU,SAASA,UAAU,UAAU,OAAOT,EAAEhB;GACpD,IAAIyB,UAAU,SAASA,UAAU,UAAU,OAAOT,EAAEf;GACpD,IAAIwB,UAAU,SAASA,UAAU,YAAY,OAAOT,EAAEd;GACtD,MAAMa,QAAQ;EAChB;CACF;AACF"}
@@ -1,10 +1,10 @@
1
1
  import { OAuthClientInformationFull, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
2
-
3
2
  //#region src/auth/types.d.ts
4
3
  type MCPPersistedAuthState = {
5
4
  tokens?: OAuthTokens;
6
5
  clientInformation?: OAuthClientInformationFull;
7
- codeVerifier?: string; /** Bearer token (entered at add-form time). */
6
+ codeVerifier?: string;
7
+ /** Bearer token (entered at add-form time). */
8
8
  token?: string;
9
9
  };
10
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":";;;KAKY,qBAAA;EACV,MAAA,GAAS,WAAA;EACT,iBAAA,GAAoB,0BAA0B;EAC9C,YAAA;EAEA,KAAA;AAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":";;KAKY;EACV,SAAS;EACT,oBAAoB;EACpB;;EAEA"}
@@ -1,5 +1,4 @@
1
1
  import { MCPConnector } from "./mcp-scope.js";
2
-
3
2
  //#region src/connector.d.ts
4
3
  declare function defineConnector(connector: MCPConnector): MCPConnector;
5
4
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":";;;iBAGgB,eAAA,CAAgB,SAAA,EAAW,YAAA,GAAe,YAAY"}
1
+ {"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":";;iBAGgB,gBAAgB,WAAW,eAAe"}
@@ -1,5 +1,4 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
-
3
2
  //#region src/context/McpConnectorByIndexProvider.d.ts
4
3
  declare const McpConnectorByIndexProvider: FC<PropsWithChildren<{
5
4
  index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":";;;cAGa,2BAAA,EAA6B,EAAE,CAC1C,iBAAA;EAAoB,KAAA;AAAA"}
1
+ {"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":";;cAGa,6BAA6B,GACxC;EAAoB"}
@@ -1,5 +1,4 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
-
3
2
  //#region src/context/McpCustomServerByIndexProvider.d.ts
4
3
  declare const McpCustomServerByIndexProvider: FC<PropsWithChildren<{
5
4
  index: number;
@@ -1 +1 @@
1
- {"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":";;;cAGa,8BAAA,EAAgC,EAAE,CAC7C,iBAAA;EAAoB,KAAA;AAAA"}
1
+ {"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":";;cAGa,gCAAgC,GAC3C;EAAoB"}
@@ -1,5 +1,4 @@
1
1
  import { FC, PropsWithChildren } from "react";
2
-
3
2
  //#region src/context/McpServerByIdProvider.d.ts
4
3
  declare const McpServerByIdProvider: FC<PropsWithChildren<{
5
4
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerByIdProvider.d.ts","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"mappings":";;;cAGa,qBAAA,EAAuB,EAAE,CAAC,iBAAA;EAAoB,EAAA;AAAA"}
1
+ {"version":3,"file":"McpServerByIdProvider.d.ts","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"mappings":";;cAGa,uBAAuB,GAAG;EAAoB"}
@@ -1,8 +1,9 @@
1
1
  import { FC, ReactNode } from "react";
2
-
3
2
  //#region src/hooks/useMcpOAuthCallback.d.ts
3
+ declare const createMcpOAuthCallbackError: (err: unknown, serverId: string | null) => Error;
4
4
  type UseMcpOAuthCallbackOptions = {
5
- /** Defaults to `window.location.href`. */url?: string;
5
+ /** Defaults to `window.location.href`. */
6
+ url?: string;
6
7
  onComplete?: (serverId: string) => void;
7
8
  onError?: (err: Error) => void;
8
9
  };
@@ -16,5 +17,5 @@ declare const McpOAuthCallback: FC<UseMcpOAuthCallbackOptions & {
16
17
  children?: (result: UseMcpOAuthCallbackResult) => ReactNode;
17
18
  }>;
18
19
  //#endregion
19
- export { McpOAuthCallback, UseMcpOAuthCallbackOptions, UseMcpOAuthCallbackResult, useMcpOAuthCallback };
20
+ export { McpOAuthCallback, UseMcpOAuthCallbackOptions, UseMcpOAuthCallbackResult, createMcpOAuthCallbackError, useMcpOAuthCallback };
20
21
  //# sourceMappingURL=useMcpOAuthCallback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpOAuthCallback.d.ts","names":[],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"mappings":";;;KAIY,0BAAA;4CAEV,GAAA;EACA,UAAA,IAAc,QAAA;EACd,OAAA,IAAW,GAAA,EAAK,KAAK;AAAA;AAAA,KAGX,yBAAA;EACV,MAAA;EACA,QAAA;EACA,KAAA,EAAO,KAAK;AAAA;AAAA,iBAGE,mBAAA,CACd,IAAA,GAAM,0BAAA,GACL,yBAAyB;AAAA,cAmDf,gBAAA,EAAkB,EAAA,CAC7B,0BAAA;EACE,QAAA,IAAY,MAAA,EAAQ,yBAAA,KAA8B,SAAA;AAAA"}
1
+ {"version":3,"file":"useMcpOAuthCallback.d.ts","names":[],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"mappings":";;cAIa,8BACX,cACA,4BACC;KAWS;;EAEV;EACA,cAAc;EACd,WAAW,KAAK;;KAGN;EACV;EACA;EACA,OAAO;;iBAGO,oBACd,OAAM,6BACL;cAoDU,kBAAkB,GAC7B;EACE,YAAY,QAAQ,8BAA8B"}
@@ -4,6 +4,11 @@ import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
4
4
  import { useEffect, useRef, useState } from "@assistant-ui/tap/react-shim";
5
5
  import { Fragment, jsx } from "react/jsx-runtime";
6
6
  //#region src/hooks/useMcpOAuthCallback.tsx
7
+ const createMcpOAuthCallbackError = (err, serverId) => {
8
+ const message = err instanceof Error ? err.message : String(err);
9
+ if (serverId) return new Error(`MCP OAuth callback for server "${serverId}" failed: ${message}`, { cause: err });
10
+ return new Error(`MCP OAuth callback failed: ${message}`, { cause: err });
11
+ };
7
12
  function useMcpOAuthCallback(opts = {}) {
8
13
  const aui = useAui();
9
14
  const [result, setResult] = useState({
@@ -20,14 +25,15 @@ function useMcpOAuthCallback(opts = {}) {
20
25
  if (startedRef.current === url) return;
21
26
  startedRef.current = url;
22
27
  (async () => {
28
+ let serverId = null;
23
29
  try {
24
30
  const parsed = new URL(url);
25
31
  const state = parsed.searchParams.get("state");
32
+ if (state) serverId = decodeServerIdFromState(state);
26
33
  const error = parsed.searchParams.get("error");
27
34
  if (error) throw new Error(parsed.searchParams.get("error_description") ?? error);
28
- if (!state) throw new Error("missing state parameter in callback URL");
29
- const serverId = decodeServerIdFromState(state);
30
- if (!serverId) throw new Error("callback state does not match an MCP server");
35
+ if (!state) throw new Error("missing \"state\" parameter");
36
+ if (!serverId) throw new Error("state was not created by assistant-ui MCP");
31
37
  setResult({
32
38
  status: "running",
33
39
  serverId,
@@ -41,12 +47,12 @@ function useMcpOAuthCallback(opts = {}) {
41
47
  });
42
48
  optsRef.current.onComplete?.(serverId);
43
49
  } catch (err) {
44
- const e = err instanceof Error ? err : new Error(String(err));
45
- setResult((prev) => ({
46
- ...prev,
50
+ const e = createMcpOAuthCallbackError(err, serverId);
51
+ setResult({
47
52
  status: "error",
53
+ serverId,
48
54
  error: e
49
- }));
55
+ });
50
56
  optsRef.current.onError?.(e);
51
57
  }
52
58
  })();
@@ -86,6 +92,6 @@ const McpOAuthCallback = (t0) => {
86
92
  return null;
87
93
  };
88
94
  //#endregion
89
- export { McpOAuthCallback, useMcpOAuthCallback };
95
+ export { McpOAuthCallback, createMcpOAuthCallbackError, useMcpOAuthCallback };
90
96
 
91
97
  //# sourceMappingURL=useMcpOAuthCallback.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMcpOAuthCallback.js","names":["FC","ReactNode","useEffect","useRef","useState","useAui","decodeServerIdFromState","UseMcpOAuthCallbackOptions","url","onComplete","serverId","onError","err","Error","UseMcpOAuthCallbackResult","status","error","useMcpOAuthCallback","opts","aui","result","setResult","startedRef","optsRef","current","window","location","href","parsed","URL","state","searchParams","get","mcp","server","id","completeAuth","e","String","prev","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\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 optsRef.current = opts;\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 (async () => {\n try {\n const parsed = new URL(url);\n const state = parsed.searchParams.get(\"state\");\n const error = parsed.searchParams.get(\"error\");\n if (error) {\n throw new Error(\n parsed.searchParams.get(\"error_description\") ?? error,\n );\n }\n if (!state) throw new Error(\"missing state parameter in callback URL\");\n const serverId = decodeServerIdFromState(state);\n if (!serverId) {\n throw new Error(\"callback state does not match an MCP server\");\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 optsRef.current.onComplete?.(serverId);\n } catch (err) {\n const e = err instanceof Error ? err : new Error(String(err));\n setResult((prev) => ({ ...prev, status: \"error\", error: e }));\n optsRef.current.onError?.(e);\n }\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":";;;;;;AAiBA,SAAgBiB,oBACdC,OAAmC,CAAC,GACT;CAC3B,MAAMC,MAAMd,OAAO;CACnB,MAAM,CAACe,QAAQC,aAAajB,SAAoC;EAC9DW,QAAQ;EACRL,UAAU;EACVM,OAAO;CACT,CAAC;CAID,MAAMM,aAAanB,OAAsB,IAAI;CAC7C,MAAMoB,UAAUpB,OAAOe,IAAI;CAC3BK,QAAQC,UAAUN;CAElBhB,gBAAgB;EACd,MAAMM,MACJU,KAAKV,QAAQ,OAAOiB,WAAW,cAAcA,OAAOC,SAASC,OAAO;EACtE,IAAI,CAACnB,KAAK;EACV,IAAIc,WAAWE,YAAYhB,KAAK;EAChCc,WAAWE,UAAUhB;EAErB,CAAC,YAAY;GACX,IAAI;IACF,MAAMoB,SAAS,IAAIC,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IuB,UAAQ;EAAA,IAAAI;EAAA,IAAAF,EAAA,OAAAF,YAAAE,EAAA,OAAAvB,QAAA;GAAYyB,KAAAJ,SAASrB,MAAM;GAACuB,EAAA,KAAAF;GAAAE,EAAA,KAAAvB;GAAAuB,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","useRef","useState","useAui","decodeServerIdFromState","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","e","McpOAuthCallback","children","t0","$","_c","t1","t2"],"sources":["../../src/hooks/useMcpOAuthCallback.tsx"],"sourcesContent":["import { type FC, type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { useAui } from \"@assistant-ui/store\";\nimport { decodeServerIdFromState } from \"../auth/createOAuthProvider\";\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 optsRef.current = opts;\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 (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 const error = parsed.searchParams.get(\"error\");\n if (error) {\n throw new Error(\n parsed.searchParams.get(\"error_description\") ?? error,\n );\n }\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 optsRef.current.onComplete?.(serverId);\n } catch (err) {\n const e = createMcpOAuthCallbackError(err, serverId);\n setResult({ status: \"error\", serverId, error: e });\n optsRef.current.onError?.(e);\n }\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":";;;;;;AAIA,MAAaO,+BACXC,KACAC,aACU;CACV,MAAME,UAAUH,eAAeE,QAAQF,IAAIG,UAAUC,OAAOJ,GAAG;CAC/D,IAAIC,UACF,OAAO,IAAIC,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Q;GACvC,SAASD,KAAK;IACZ,MAAMiC,IAAIlC,4BAA4BC,KAAKC,QAAQ;IACnDgB,UAAU;KAAEN,QAAQ;KAASV;KAAUW,OAAOqB;IAAE,CAAC;IACjDd,QAAQC,QAAQX,UAAUwB,CAAC;GAC7B;EACF,EAAA,CAAG;CACL,GAAG,CAAClB,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,aAAArB,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,3 +1,4 @@
1
+ import "@assistant-ui/store";
1
2
  //#region src/mcp-scope.d.ts
2
3
  type MCPAuthConfig = {
3
4
  type: "none";
@@ -60,8 +61,14 @@ type MCPServerMethods = {
60
61
  connect: () => Promise<void>;
61
62
  disconnect: () => Promise<void>;
62
63
  remove: () => Promise<void>;
63
- callTool: (name: string, args: unknown) => Promise<unknown>; /** Read a resource by URI. Returns the raw MCP `ReadResourceResult`. */
64
- readResource: (uri: string) => Promise<unknown>; /** OAuth only: pass full callback URL (e.g. window.location.href) */
64
+ callTool: (name: string, args: unknown) => Promise<unknown>;
65
+ /** List resources exposed by the server. Returns the raw MCP `ListResourcesResult`. */
66
+ listResources: (params?: {
67
+ cursor?: string | undefined;
68
+ }) => Promise<unknown>;
69
+ /** Read a resource by URI. Returns the raw MCP `ReadResourceResult`. */
70
+ readResource: (uri: string) => Promise<unknown>;
71
+ /** OAuth only: pass full callback URL (e.g. window.location.href) */
65
72
  completeAuth: (callbackUrl: string) => Promise<void>;
66
73
  };
67
74
  type MCPServerQuery = {
@@ -74,11 +81,14 @@ type MCPServerQuery = {
74
81
  index: number;
75
82
  };
76
83
  type MCPManagerMethods = {
77
- getState: () => MCPManagerState; /** Look up a server by id, or by index within its kind. */
78
- server: (query: MCPServerQuery) => MCPServerMethods; /** Convenience: equivalent to `server({ kind: "connector", index })`. */
84
+ getState: () => MCPManagerState;
85
+ /** Look up a server by id, or by index within its kind. */
86
+ server: (query: MCPServerQuery) => MCPServerMethods;
87
+ /** Convenience: equivalent to `server({ kind: "connector", index })`. */
79
88
  connector: (query: {
80
89
  index: number;
81
- }) => MCPServerMethods; /** Convenience: equivalent to `server({ kind: "custom", index })`. */
90
+ }) => MCPServerMethods;
91
+ /** Convenience: equivalent to `server({ kind: "custom", index })`. */
82
92
  customServer: (query: {
83
93
  index: number;
84
94
  }) => MCPServerMethods;
@@ -103,7 +113,7 @@ declare module "@assistant-ui/store" {
103
113
  };
104
114
  };
105
115
  }
106
- } //# sourceMappingURL=mcp-scope.d.ts.map
116
+ }
107
117
  //#endregion
108
118
  export { MCPAuthConfig, MCPConnectionState, MCPConnector, MCPCustomServerRecord, MCPManagerMethods, MCPManagerState, MCPServerKind, MCPServerMethods, MCPServerQuery, MCPServerState, MCPToolInfo };
109
119
  //# sourceMappingURL=mcp-scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-scope.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BAAA,EAhCtB;EAkCb,SAAA,GAAY,KAAA;IAAS,KAAA;EAAA,MAAoB,gBAAA,EAhCzB;EAkChB,YAAA,GAAe,KAAA;IAAS,KAAA;EAAA,MAAoB,gBAAA;EAC5C,eAAA,GAAkB,KAAA;IAChB,IAAA;IACA,GAAA;IACA,IAAA,EAAM,aAAA;IACN,iBAAA;EAAA,MACI,OAAA;EACN,YAAA,GAAe,EAAA,aAAe,OAAA;AAAA;AAAA;EAAA,UAIpB,aAAA;IACR,GAAA;MACE,OAAA,EAAS,iBAAA;IAAA;IAEX,SAAA;MACE,OAAA,EAAS,gBAAA;MACT,IAAA;QAAQ,MAAA;QAAe,KAAA,EAAO,cAAA;MAAA;IAAA;EAAA;AAAA"}
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;EACV;EACA;EACA;EACA;EACA,MAAM;EACN;;KAGU;EACV;EACA;EACA;EACA,MAAM;EACN;EACA;;KAGU;KAEA;KAQA;EACV;EACA;EACA;;KAGU;EACV;EACA,MAAM;EACN;EACA;EACA;EACA,iBAAiB;EACjB;IAAa;;EACb,OAAO;EACP;;KAGU;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;;KAG7B;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;QACI;EACN,eAAe,eAAe;;;YAIpB;IACR;MACE,SAAS;;IAEX;MACE,SAAS;MACT;QAAQ;QAAe,OAAO"}
@@ -1,6 +1,5 @@
1
1
  import { AddFormAuthType } from "./context.js";
2
2
  import { FC } from "react";
3
-
4
3
  //#region src/primitives/addForm/McpAddFormAuthFields.d.ts
5
4
  declare namespace McpAddFormPrimitiveAuthFields {
6
5
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthFields.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"mappings":";;;;kBAGiB,6BAAA;EAAA,KACH,KAAA;IADG;;;;IAMb,QAAA,GAAW,EAAE;MAAG,QAAA,EAAU,eAAA;IAAA;EAAA;AAAA;AAAA,cAIjB,6BAAA,EAA+B,EAAE,CAC5C,6BAAA,CAA8B,KAAA"}
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,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/addForm/McpAddFormAuthSelect.d.ts
5
4
  declare namespace McpAddFormPrimitiveAuthSelect {
6
5
  type Element = ComponentRef<typeof Primitive.select>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormAuthSelect.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthSelect.tsx"],"mappings":";;;;kBAoBiB,6BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAKjC,6BAAA,kBAA6B,yBAAA,CAAA,6BAAA,CAAA,KAAA,mBAAA,aAAA,CAAA,iBAAA"}
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,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/addForm/McpAddFormCancel.d.ts
5
4
  declare namespace McpAddFormPrimitiveCancel {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormCancel.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormCancel.tsx"],"mappings":";;;;kBAQiB,yBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAGnD,yBAAA,kBAAyB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
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"}
@@ -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/addForm/McpAddFormError.d.ts
5
4
  declare namespace McpAddFormPrimitiveError {
6
5
  type Element = ComponentRef<typeof Primitive.div>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormError.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"mappings":";;;;kBAQiB,wBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,GAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,GAAA;AAAA;AAAA,cAGnD,wBAAA,kBAAwB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,cAAA,oBAAA,cAAA,CAAA,cAAA"}
1
+ {"version":3,"file":"McpAddFormError.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormError.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,0CAAwB,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/addForm/McpAddFormNameField.d.ts
5
4
  declare namespace McpAddFormPrimitiveNameField {
6
5
  type Element = ComponentRef<typeof Primitive.input>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormNameField.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormNameField.tsx"],"mappings":";;;;kBAQiB,4BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,KAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,KAAA;AAAA;AAAA,cAKjC,4BAAA,kBAA4B,yBAAA,CAAA,4BAAA,CAAA,KAAA,mBAAA,aAAA,CAAA,gBAAA"}
1
+ {"version":3,"file":"McpAddFormNameField.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormNameField.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;cAKjC,8CAA4B,0BAAA,6BAAA,wBAAA,cAAA"}
@@ -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/addForm/McpAddFormRoot.d.ts
5
4
  declare namespace McpAddFormPrimitiveRoot {
6
5
  type Element = ComponentRef<typeof Primitive.form>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormRoot.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"mappings":";;;;kBAuCiB,uBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,IAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,IAAA;IAG1C,WAAA,IAAe,EAAA;IACf,QAAA;EAAA;AAAA;AAAA,cAIS,uBAAA,kBAAuB,yBAAA,CAAA,IAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,eAAA,oBAAA,kBAAA,CAAA,eAAA;;;iBALjB,EAAA"}
1
+ {"version":3,"file":"McpAddFormRoot.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormRoot.tsx"],"mappings":";;;kBAuCiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;IAG1C,eAAe;IACf;;;cAIS,yCAAuB,0BAAA,KAAA,qBAAA,gBAAA,mCAAA,mBAAA;;;iBALjB"}
@@ -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/addForm/McpAddFormSubmit.d.ts
5
4
  declare namespace McpAddFormPrimitiveSubmit {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormSubmit.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"mappings":";;;;kBAQiB,yBAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAGnD,yBAAA,kBAAyB,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"McpAddFormSubmit.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormSubmit.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,2CAAyB,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/addForm/McpAddFormUrlField.d.ts
5
4
  declare namespace McpAddFormPrimitiveUrlField {
6
5
  type Element = ComponentRef<typeof Primitive.input>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpAddFormUrlField.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormUrlField.tsx"],"mappings":";;;;kBAQiB,2BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,KAAA;EAAA,KACxC,KAAA,GAAQ,IAAA,CAClB,wBAAA,QAAgC,SAAA,CAAU,KAAA;AAAA;AAAA,cAKjC,2BAAA,kBAA2B,yBAAA,CAAA,2BAAA,CAAA,KAAA,mBAAA,aAAA,CAAA,gBAAA"}
1
+ {"version":3,"file":"McpAddFormUrlField.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormUrlField.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,KAClB,gCAAgC,UAAU;;cAKjC,6CAA2B,0BAAA,4BAAA,wBAAA,cAAA"}
@@ -1,5 +1,4 @@
1
1
  import { MCPAuthConfig } from "../../mcp-scope.js";
2
-
3
2
  //#region src/primitives/addForm/context.d.ts
4
3
  type AddFormAuthType = MCPAuthConfig["type"];
5
4
  type AddFormState = {
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/primitives/addForm/context.tsx"],"mappings":";;;KAGY,eAAA,GAAkB,aAAa;AAAA,KAE/B,YAAA;EACV,IAAA;EACA,GAAA;EACA,QAAA,EAAU,eAAe;EACzB,WAAA;EACA,MAAA;EACA,UAAA;EACA,KAAA;AAAA;AAAA,KAGU,mBAAA;EACV,KAAA,EAAO,YAAA;EACP,QAAA,mBAA2B,YAAA,EACzB,GAAA,EAAK,CAAA,EACL,KAAA,EAAO,YAAA,CAAa,CAAA;EAEtB,KAAA;EACA,MAAA,QAAc,OAAA;EACd,MAAA;AAAA;AAAA,cAGW,cAAA,kBAAc,OAAA,CAAA,mBAAA;AAAA,cAEd,UAAA,QAAiB,mBAQ7B"}
1
+ {"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/primitives/addForm/context.tsx"],"mappings":";;KAGY,kBAAkB;KAElB;EACV;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;;KAGU;EACV,OAAO;EACP,WAAW,gBAAgB,cACzB,KAAK,GACL,OAAO,aAAa;EAEtB;EACA,cAAc;EACd;;cAGW,gCAAc,QAAA;cAEd,kBAAiB"}
@@ -6,8 +6,6 @@ import { McpAddFormPrimitiveAuthFields } from "./addForm/McpAddFormAuthFields.js
6
6
  import { McpAddFormPrimitiveSubmit } from "./addForm/McpAddFormSubmit.js";
7
7
  import { McpAddFormPrimitiveCancel } from "./addForm/McpAddFormCancel.js";
8
8
  import { McpAddFormPrimitiveError } from "./addForm/McpAddFormError.js";
9
-
10
- //#region src/primitives/addForm.d.ts
11
9
  declare namespace addForm_d_exports {
12
10
  export { McpAddFormPrimitiveAuthFields as AuthFields, McpAddFormPrimitiveAuthSelect as AuthSelect, McpAddFormPrimitiveCancel as Cancel, McpAddFormPrimitiveError as Error, McpAddFormPrimitiveNameField as NameField, McpAddFormPrimitiveRoot as Root, McpAddFormPrimitiveSubmit as Submit, McpAddFormPrimitiveUrlField as UrlField };
13
11
  }
@@ -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/manager/McpManagerAddCustomTrigger.d.ts
5
4
  declare namespace McpManagerPrimitiveAddCustomTrigger {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerAddCustomTrigger.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerAddCustomTrigger.tsx"],"mappings":";;;;kBAOiB,mCAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAGnD,mCAAA,kBAAmC,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"McpManagerAddCustomTrigger.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerAddCustomTrigger.tsx"],"mappings":";;;kBAOiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,qDAAmC,0BAAA,qBAAA,gBAAA,qCAAA,qBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { MCPServerState } from "../../mcp-scope.js";
2
2
  import { FC, ReactNode } from "react";
3
-
4
3
  //#region src/primitives/manager/McpManagerConnectors.d.ts
5
4
  declare namespace McpManagerPrimitiveConnectors {
6
5
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerConnectors.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"mappings":";;;;kBASiB,6BAAA;EAAA,KACH,KAAA;IADG;;;;;IAOb,QAAA,GAAW,KAAA;MAAS,MAAA,EAAQ,cAAA;IAAA,MAAqB,SAAS;EAAA;AAAA;;AAAA;AAqD9D;;;;;;;;AAAkF;;;;;cAArE,6BAAA,EAA+B,EAAE,CAAC,6BAAA,CAA8B,KAAA"}
1
+ {"version":3,"file":"McpManagerConnectors.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"mappings":";;;kBASiB;OACH;;;;;;IAMV,WAAW;MAAS,QAAQ;UAAqB;;;;;;;;;;;;;;;;;;cAqDxC,+BAA+B,GAAG,8BAA8B"}
@@ -1,6 +1,5 @@
1
1
  import { MCPServerState } from "../../mcp-scope.js";
2
2
  import { FC, ReactNode } from "react";
3
-
4
3
  //#region src/primitives/manager/McpManagerCustomServers.d.ts
5
4
  declare namespace McpManagerPrimitiveCustomServers {
6
5
  type Props = {
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerCustomServers.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"mappings":";;;;kBAOiB,gCAAA;EAAA,KACH,KAAA;IADG;;;;;IAOb,QAAA,GAAW,KAAA;MAAS,MAAA,EAAQ,cAAA;IAAA,MAAqB,SAAS;EAAA;AAAA;;AAAA;AAkD9D;;;;;;;;AAAwF;;;;;cAA3E,gCAAA,EAAkC,EAAE,CAAC,gCAAA,CAAiC,KAAA"}
1
+ {"version":3,"file":"McpManagerCustomServers.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"mappings":";;;kBAOiB;OACH;;;;;;IAMV,WAAW;MAAS,QAAQ;UAAqB;;;;;;;;;;;;;;;;;;cAkDxC,kCAAkC,GAAG,iCAAiC"}
@@ -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/manager/McpManagerRoot.d.ts
5
4
  declare namespace McpManagerPrimitiveRoot {
6
5
  type Element = ComponentRef<typeof Primitive.div>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpManagerRoot.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.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":"McpManagerRoot.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerRoot.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAGnD,yCAAuB,0BAAA,qBAAA,gBAAA,kCAAA,eAAA"}
@@ -2,8 +2,6 @@ import { McpManagerPrimitiveRoot } from "./manager/McpManagerRoot.js";
2
2
  import { McpManagerPrimitiveConnectors } from "./manager/McpManagerConnectors.js";
3
3
  import { McpManagerPrimitiveCustomServers } from "./manager/McpManagerCustomServers.js";
4
4
  import { McpManagerPrimitiveAddCustomTrigger } from "./manager/McpManagerAddCustomTrigger.js";
5
-
6
- //#region src/primitives/manager.d.ts
7
5
  declare namespace manager_d_exports {
8
6
  export { McpManagerPrimitiveAddCustomTrigger as AddCustomTrigger, McpManagerPrimitiveConnectors as Connectors, McpManagerPrimitiveCustomServers as CustomServers, McpManagerPrimitiveRoot as Root };
9
7
  }
@@ -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/McpServerConnectButton.d.ts
5
4
  declare namespace McpServerPrimitiveConnectButton {
6
5
  type Element = ComponentRef<typeof Primitive.button>;
@@ -1 +1 @@
1
- {"version":3,"file":"McpServerConnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"mappings":";;;;kBAQiB,+BAAA;EAAA,KACH,OAAA,GAAU,YAAA,QAAoB,SAAA,CAAU,MAAA;EAAA,KACxC,KAAA,GAAQ,wBAAA,QAAgC,SAAA,CAAU,MAAA;AAAA;AAAA,cAKnD,+BAAA,kBAA+B,yBAAA,CAAA,IAAA,iBAAA,eAAA,CAAA,iBAAA,oBAAA,oBAAA,CAAA,iBAAA"}
1
+ {"version":3,"file":"McpServerConnectButton.d.ts","names":[],"sources":["../../../src/primitives/server/McpServerConnectButton.tsx"],"mappings":";;;kBAQiB;OACH,UAAU,oBAAoB,UAAU;OACxC,QAAQ,gCAAgC,UAAU;;cAKnD,iDAA+B,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/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"}