@assistant-ui/react-mcp 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/buildHeaders.d.ts +0 -1
- package/dist/auth/buildHeaders.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.d.ts +4 -3
- package/dist/auth/createOAuthProvider.d.ts.map +1 -1
- package/dist/auth/createOAuthProvider.js +2 -1
- package/dist/auth/createOAuthProvider.js.map +1 -1
- package/dist/auth/types.d.ts +2 -2
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/connector.d.ts +0 -1
- package/dist/connector.d.ts.map +1 -1
- package/dist/context/McpConnectorByIndexProvider.d.ts +0 -1
- package/dist/context/McpConnectorByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpCustomServerByIndexProvider.d.ts +0 -1
- package/dist/context/McpCustomServerByIndexProvider.d.ts.map +1 -1
- package/dist/context/McpServerByIdProvider.d.ts +0 -1
- package/dist/context/McpServerByIdProvider.d.ts.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.d.ts +4 -3
- package/dist/hooks/useMcpOAuthCallback.d.ts.map +1 -1
- package/dist/hooks/useMcpOAuthCallback.js +14 -8
- package/dist/hooks/useMcpOAuthCallback.js.map +1 -1
- package/dist/mcp-scope.d.ts +19 -6
- package/dist/mcp-scope.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormAuthFields.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormAuthSelect.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormCancel.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormCancel.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormError.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormError.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormNameField.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormNameField.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormRoot.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormSubmit.d.ts.map +1 -1
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts +0 -1
- package/dist/primitives/addForm/McpAddFormUrlField.d.ts.map +1 -1
- package/dist/primitives/addForm/context.d.ts +0 -1
- package/dist/primitives/addForm/context.d.ts.map +1 -1
- package/dist/primitives/addForm.d.ts +0 -2
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts +0 -1
- package/dist/primitives/manager/McpManagerAddCustomTrigger.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerConnectors.d.ts +0 -1
- package/dist/primitives/manager/McpManagerConnectors.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerCustomServers.d.ts +0 -1
- package/dist/primitives/manager/McpManagerCustomServers.d.ts.map +1 -1
- package/dist/primitives/manager/McpManagerRoot.d.ts +0 -1
- package/dist/primitives/manager/McpManagerRoot.d.ts.map +1 -1
- package/dist/primitives/manager.d.ts +0 -2
- package/dist/primitives/server/McpServerConnectButton.d.ts +0 -1
- package/dist/primitives/server/McpServerConnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerDisconnectButton.d.ts +0 -1
- package/dist/primitives/server/McpServerDisconnectButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerError.d.ts +0 -1
- package/dist/primitives/server/McpServerError.d.ts.map +1 -1
- package/dist/primitives/server/McpServerIcon.d.ts +4 -3
- package/dist/primitives/server/McpServerIcon.d.ts.map +1 -1
- package/dist/primitives/server/McpServerName.d.ts +0 -1
- package/dist/primitives/server/McpServerName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerOAuthLink.d.ts +4 -3
- package/dist/primitives/server/McpServerOAuthLink.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRemoveButton.d.ts +0 -1
- package/dist/primitives/server/McpServerRemoveButton.d.ts.map +1 -1
- package/dist/primitives/server/McpServerRoot.d.ts +0 -1
- package/dist/primitives/server/McpServerRoot.d.ts.map +1 -1
- package/dist/primitives/server/McpServerStatus.d.ts +0 -1
- package/dist/primitives/server/McpServerStatus.d.ts.map +1 -1
- package/dist/primitives/server/McpServerToolName.d.ts +0 -1
- package/dist/primitives/server/McpServerToolName.d.ts.map +1 -1
- package/dist/primitives/server/McpServerTools.d.ts +0 -1
- package/dist/primitives/server/McpServerTools.d.ts.map +1 -1
- package/dist/primitives/server.d.ts +0 -2
- package/dist/resources/McpManagerResource.d.ts +6 -3
- package/dist/resources/McpManagerResource.d.ts.map +1 -1
- package/dist/resources/McpManagerResource.js +122 -107
- package/dist/resources/McpManagerResource.js.map +1 -1
- package/dist/resources/McpServerResource.d.ts +1 -1
- package/dist/resources/McpServerResource.d.ts.map +1 -1
- package/dist/resources/McpServerResource.js +28 -5
- package/dist/resources/McpServerResource.js.map +1 -1
- package/dist/resources/storage/McpCustomStorage.d.ts +0 -1
- package/dist/resources/storage/McpCustomStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.d.ts +8 -3
- package/dist/resources/storage/McpLocalStorage.d.ts.map +1 -1
- package/dist/resources/storage/McpLocalStorage.js +55 -3
- package/dist/resources/storage/McpLocalStorage.js.map +1 -1
- package/dist/resources/storage/McpMemoryStorage.d.ts +0 -1
- package/dist/resources/storage/McpMemoryStorage.d.ts.map +1 -1
- package/dist/resources/storage/types.d.ts +0 -1
- package/dist/resources/storage/types.d.ts.map +1 -1
- package/dist/utils/serverId.d.ts +2 -1
- package/dist/utils/serverId.d.ts.map +1 -1
- package/dist/utils/serverId.js +8 -1
- package/dist/utils/serverId.js.map +1 -1
- package/package.json +11 -8
- package/src/hooks/useMcpOAuthCallback.test.ts +24 -0
- package/src/hooks/useMcpOAuthCallback.tsx +20 -5
- package/src/mcp-scope.ts +5 -0
- package/src/resources/McpManagerResource.test.ts +40 -0
- package/src/resources/McpManagerResource.ts +21 -2
- package/src/resources/McpServerResource.test.ts +364 -0
- package/src/resources/McpServerResource.ts +51 -3
- package/src/resources/storage/McpLocalStorage.test.ts +184 -0
- package/src/resources/storage/McpLocalStorage.ts +113 -3
- package/src/utils/serverId.ts +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHeaders.d.ts","names":[],"sources":["../../src/auth/buildHeaders.ts"],"mappings":"
|
|
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;
|
|
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;
|
|
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":"
|
|
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
|
-
|
|
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;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;CAEvD,OAAO,GAAGrB,eAAeC,iBADX,IAAIqB,YAAY,CAAC,CAACC,OAAOF,QACGnB,CAAK;AACjD;AAEA,SAAgBsB,wBAAwBC,OAA8B;CACpE,IAAI,CAACA,MAAMC,WAAW1B,YAAY,GAAG,OAAO;CAC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ASA,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,GAAGrB,eAAeC,iBAAiBC,KAAK;AACjD;AAEA,SAAgBsB,wBAAwBC,OAA8B;CACpE,IAAI,CAACA,MAAMC,WAAW1B,YAAY,GAAG,OAAO;CAC5C,MAAM2B,MAAMF,MAAMG,QAAQ,KAAK5B,CAAmB;CAClD,MAAM6B,UACJF,QAAQ,KACJF,MAAMK,MAAM9B,CAAmB,IAC/ByB,MAAMK,MAAM9B,GAAqB2B,GAAG;CAC1C,IAAI;EACF,OAAO,IAAII,YAAY,SAAS,EAAEC,OAAO,KAAK,CAAC,CAAC,CAACC,OAC/CvB,iBAAiBmB,OAAO,CAC1B;CACF,QAAQ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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;
|
|
6
|
+
codeVerifier?: string;
|
|
7
|
+
/** Bearer token (entered at add-form time). */
|
|
8
8
|
token?: string;
|
|
9
9
|
};
|
|
10
10
|
//#endregion
|
package/dist/auth/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/auth/types.ts"],"mappings":";;KAKY;EACV,SAAS;EACT,oBAAoB;EACpB;;EAEA"}
|
package/dist/connector.d.ts
CHANGED
package/dist/connector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"connector.d.ts","names":[],"sources":["../src/connector.ts"],"mappings":";;iBAGgB,gBAAgB,WAAW,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpConnectorByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpConnectorByIndexProvider.tsx"],"mappings":";;cAGa,6BAA6B,GACxC;EAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpCustomServerByIndexProvider.d.ts","names":[],"sources":["../../src/context/McpCustomServerByIndexProvider.tsx"],"mappings":";;cAGa,gCAAgC,GAC3C;EAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpServerByIdProvider.d.ts","names":[],"sources":["../../src/context/McpServerByIdProvider.tsx"],"mappings":"
|
|
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`. */
|
|
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":"
|
|
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
|
|
29
|
-
|
|
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
|
|
45
|
-
setResult(
|
|
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","
|
|
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,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,MAAMlB,OAAO;CACnB,MAAM,CAACmB,QAAQC,aAAarB,SAAoC;EAC9De,QAAQ;EACRV,UAAU;EACVW,OAAO;CACT,CAAC;CAID,MAAMM,aAAavB,OAAsB,IAAI;CAC7C,MAAMwB,UAAUxB,OAAOmB,IAAI;CAC3BK,QAAQC,UAAUN;CAElBpB,gBAAgB;EACd,MAAMa,MACJO,KAAKP,QAAQ,OAAOc,WAAW,cAAcA,OAAOC,SAASC,OAAO;EACtE,IAAI,CAAChB,KAAK;EACV,IAAIW,WAAWE,YAAYb,KAAK;EAChCW,WAAWE,UAAUb;EAErB,CAAC,YAAY;GACX,IAAIN,WAA0B;GAC9B,IAAI;IACF,MAAMuB,SAAS,IAAIC,IAAIlB,GAAG;IAC1B,MAAMmB,QAAQF,OAAOG,aAAaC,IAAI,OAAO;IAC7C,IAAIF,OAAOzB,WAAWH,wBAAwB4B,KAAK;IACnD,MAAMd,QAAQY,OAAOG,aAAaC,IAAI,OAAO;IAC7C,IAAIhB,OACF,MAAM,IAAIV,MACRsB,OAAOG,aAAaC,IAAI,mBAAmB,KAAKhB,KAClD;IAEF,IAAI,CAACc,OAAO,MAA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F,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAA,OAAvBG;CAAuB;CAAC,OACtC;AAAI"}
|
package/dist/mcp-scope.d.ts
CHANGED
|
@@ -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";
|
|
@@ -19,12 +20,14 @@ type MCPConnector = {
|
|
|
19
20
|
url: string;
|
|
20
21
|
icon?: string | undefined;
|
|
21
22
|
auth: MCPAuthConfig;
|
|
23
|
+
connectionTimeout?: number | undefined;
|
|
22
24
|
};
|
|
23
25
|
type MCPCustomServerRecord = {
|
|
24
26
|
id: string;
|
|
25
27
|
name: string;
|
|
26
28
|
url: string;
|
|
27
29
|
auth: MCPAuthConfig;
|
|
30
|
+
connectionTimeout?: number | undefined;
|
|
28
31
|
createdAt: number;
|
|
29
32
|
};
|
|
30
33
|
type MCPServerKind = "connector" | "custom";
|
|
@@ -58,8 +61,14 @@ type MCPServerMethods = {
|
|
|
58
61
|
connect: () => Promise<void>;
|
|
59
62
|
disconnect: () => Promise<void>;
|
|
60
63
|
remove: () => Promise<void>;
|
|
61
|
-
callTool: (name: string, args: unknown) => Promise<unknown>;
|
|
62
|
-
|
|
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) */
|
|
63
72
|
completeAuth: (callbackUrl: string) => Promise<void>;
|
|
64
73
|
};
|
|
65
74
|
type MCPServerQuery = {
|
|
@@ -72,11 +81,14 @@ type MCPServerQuery = {
|
|
|
72
81
|
index: number;
|
|
73
82
|
};
|
|
74
83
|
type MCPManagerMethods = {
|
|
75
|
-
getState: () => MCPManagerState;
|
|
76
|
-
|
|
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 })`. */
|
|
77
88
|
connector: (query: {
|
|
78
89
|
index: number;
|
|
79
|
-
}) => MCPServerMethods;
|
|
90
|
+
}) => MCPServerMethods;
|
|
91
|
+
/** Convenience: equivalent to `server({ kind: "custom", index })`. */
|
|
80
92
|
customServer: (query: {
|
|
81
93
|
index: number;
|
|
82
94
|
}) => MCPServerMethods;
|
|
@@ -84,6 +96,7 @@ type MCPManagerMethods = {
|
|
|
84
96
|
name: string;
|
|
85
97
|
url: string;
|
|
86
98
|
auth: MCPAuthConfig;
|
|
99
|
+
connectionTimeout?: number | undefined;
|
|
87
100
|
}) => Promise<string>;
|
|
88
101
|
removeServer: (id: string) => Promise<void>;
|
|
89
102
|
};
|
|
@@ -100,7 +113,7 @@ declare module "@assistant-ui/store" {
|
|
|
100
113
|
};
|
|
101
114
|
};
|
|
102
115
|
}
|
|
103
|
-
}
|
|
116
|
+
}
|
|
104
117
|
//#endregion
|
|
105
118
|
export { MCPAuthConfig, MCPConnectionState, MCPConnector, MCPCustomServerRecord, MCPManagerMethods, MCPManagerState, MCPServerKind, MCPServerMethods, MCPServerQuery, MCPServerState, MCPToolInfo };
|
|
106
119
|
//# sourceMappingURL=mcp-scope.d.ts.map
|
package/dist/mcp-scope.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-scope.d.ts","names":[],"sources":["../src/mcp-scope.ts"],"mappings":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpAddFormAuthFields.d.ts","names":[],"sources":["../../../src/primitives/addForm/McpAddFormAuthFields.tsx"],"mappings":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":[],"sources":["../../../src/primitives/addForm/context.tsx"],"mappings":"
|
|
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":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerConnectors.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerConnectors.tsx"],"mappings":"
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpManagerCustomServers.d.ts","names":[],"sources":["../../../src/primitives/manager/McpManagerCustomServers.tsx"],"mappings":"
|
|
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":"
|
|
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":"
|
|
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"}
|