@executor-js/plugin-mcp 1.4.33 → 1.5.0
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/AddMcpSource-4LLERUW5.js +602 -0
- package/dist/AddMcpSource-4LLERUW5.js.map +1 -0
- package/dist/EditMcpSource-GKJRP75X.js +313 -0
- package/dist/EditMcpSource-GKJRP75X.js.map +1 -0
- package/dist/McpAccountsPanel-UX7MHEIG.js +132 -0
- package/dist/McpAccountsPanel-UX7MHEIG.js.map +1 -0
- package/dist/api/group.d.ts +79 -143
- package/dist/api/index.d.ts +99 -155
- package/dist/chunk-2TXHTMKM.js +1298 -0
- package/dist/chunk-2TXHTMKM.js.map +1 -0
- package/dist/chunk-6OEQZ72N.js +124 -0
- package/dist/chunk-6OEQZ72N.js.map +1 -0
- package/dist/chunk-7FJ3PUUL.js +21 -0
- package/dist/chunk-7FJ3PUUL.js.map +1 -0
- package/dist/chunk-N4EAF5CA.js +146 -0
- package/dist/chunk-N4EAF5CA.js.map +1 -0
- package/dist/client.js +9 -9
- package/dist/client.js.map +1 -1
- package/dist/core.js +36 -26
- package/dist/index.js +2 -2
- package/dist/promise.d.ts +1 -1
- package/dist/react/AddMcpSource.d.ts +1 -1
- package/dist/react/McpAccountsPanel.d.ts +6 -0
- package/dist/react/McpRemoteSourceFields.d.ts +4 -2
- package/dist/react/McpSignInButton.d.ts +2 -0
- package/dist/react/atoms.d.ts +93 -313
- package/dist/react/auth-method-config.d.ts +8 -0
- package/dist/react/client.d.ts +78 -142
- package/dist/react/index.d.ts +3 -3
- package/dist/react/source-plugin.d.ts +5 -5
- package/dist/sdk/connection.d.ts +4 -4
- package/dist/sdk/errors.d.ts +0 -19
- package/dist/sdk/index.d.ts +4 -3
- package/dist/sdk/invoke.d.ts +9 -16
- package/dist/sdk/plugin.d.ts +101 -236
- package/dist/sdk/types.d.ts +25 -130
- package/package.json +5 -4
- package/dist/AddMcpSource-PADMBVX2.js +0 -688
- package/dist/AddMcpSource-PADMBVX2.js.map +0 -1
- package/dist/EditMcpSource-L5GC2B4J.js +0 -281
- package/dist/EditMcpSource-L5GC2B4J.js.map +0 -1
- package/dist/McpSourceSummary-LE3WXFUE.js +0 -170
- package/dist/McpSourceSummary-LE3WXFUE.js.map +0 -1
- package/dist/chunk-6OYEXHU3.js +0 -156
- package/dist/chunk-6OYEXHU3.js.map +0 -1
- package/dist/chunk-FMTVLO5L.js +0 -179
- package/dist/chunk-FMTVLO5L.js.map +0 -1
- package/dist/chunk-LEGVPKYH.js +0 -2391
- package/dist/chunk-LEGVPKYH.js.map +0 -1
- package/dist/chunk-ZIRGIRGP.js +0 -115
- package/dist/chunk-ZIRGIRGP.js.map +0 -1
- package/dist/react/McpSourceSummary.d.ts +0 -5
- package/dist/sdk/binding-store.d.ts +0 -31
- package/dist/sdk/stored-source.d.ts +0 -42
- /package/dist/{sdk/connection-pool.test.d.ts → react/auth-method-config.test.d.ts} +0 -0
- /package/dist/sdk/{cross-user-isolation.test.d.ts → describe-auth-methods.test.d.ts} +0 -0
- /package/dist/sdk/{per-user-auth-isolation.test.d.ts → owner-isolation.test.d.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/AddMcpSource.tsx"],"sourcesContent":["import { useReducer, useCallback, useEffect, useRef, useState } from \"react\";\nimport { useAtomSet } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\nimport { useScope } from \"@executor-js/react/api/scope-context\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { FieldLabel } from \"@executor-js/react/components/field\";\nimport { FilterTabs } from \"@executor-js/react/components/filter-tabs\";\nimport { FloatActions } from \"@executor-js/react/components/float-actions\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { Spinner } from \"@executor-js/react/components/spinner\";\nimport { Textarea } from \"@executor-js/react/components/textarea\";\nimport {\n emptyHttpCredentials,\n httpCredentialsValid,\n HttpCredentialsEditor,\n serializeConfigureHttpCredentials,\n serializeHttpCredentials,\n serializeTemplateHttpCredentials,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n sourceDisplayNameFromUrl,\n slugifyNamespace,\n SourceIdentityFields,\n useSourceIdentity,\n} from \"@executor-js/react/plugins/source-identity\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n oauthCallbackUrl,\n oauthConnectionId,\n useOAuthPopupFlow,\n type OAuthCompletionPayload,\n} from \"@executor-js/react/plugins/oauth-sign-in\";\nimport {\n CredentialControlField,\n CredentialUsageRow,\n useCredentialTargetScope,\n} from \"@executor-js/react/plugins/credential-target-scope\";\nimport {\n defaultHeaderAuthPresets,\n type HeaderAuthPreset,\n} from \"@executor-js/react/plugins/secret-header-auth\";\n\ntype RemoteAuthMode = \"none\" | \"oauth2\";\nimport { sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { probeMcpEndpoint, addMcpSourceOptimistic } from \"./atoms\";\nimport { McpRemoteSourceFields } from \"./McpRemoteSourceFields\";\nimport { mcpPresets, type McpPreset } from \"../sdk/presets\";\nimport type { McpConfiguredValueInput, McpCredentialInput } from \"../sdk/types\";\n\nconst mcpHeaderPresets: readonly HeaderAuthPreset[] = [\n { key: \"text\", label: \"Plaintext header\", name: \"\", valueKind: \"text\" },\n ...defaultHeaderAuthPresets,\n];\n\nconst ErrorMessage = Schema.Struct({ message: Schema.String });\nconst decodeErrorMessage = Schema.decodeUnknownOption(ErrorMessage);\nconst STDIO_ENV_ESCAPE_REPLACEMENTS: Readonly<Record<string, string>> = {\n \"\\\\\": \"\\\\\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n '\"': '\"',\n};\n\nconst errorMessageFromExit = (exit: Exit.Exit<unknown, unknown>, fallback: string): string =>\n Option.match(Option.flatMap(Exit.findErrorOption(exit), decodeErrorMessage), {\n onNone: () => fallback,\n onSome: ({ message }) => message,\n });\n\n// ---------------------------------------------------------------------------\n// Preset lookup\n// ---------------------------------------------------------------------------\n\nfunction findPreset(id: string | undefined): McpPreset | undefined {\n if (!id) return undefined;\n return mcpPresets.find((p) => p.id === id);\n}\n\n// ---------------------------------------------------------------------------\n// State machine (remote flow)\n// ---------------------------------------------------------------------------\n\ntype OAuthTokens = OAuthCompletionPayload;\n\ntype ProbeResult = {\n connected: boolean;\n requiresOAuth: boolean;\n supportsDynamicRegistration: boolean;\n name: string;\n namespace: string;\n toolCount: number | null;\n serverName: string | null;\n};\n\ntype State =\n | { step: \"url\"; url: string }\n | { step: \"probing\"; url: string; probe: ProbeResult | null }\n | { step: \"probed\"; url: string; probe: ProbeResult }\n | { step: \"oauth-starting\"; url: string; probe: ProbeResult }\n | {\n step: \"oauth-waiting\";\n url: string;\n probe: ProbeResult;\n sessionId: string;\n }\n | { step: \"oauth-done\"; url: string; probe: ProbeResult; tokens: OAuthTokens }\n | {\n step: \"adding\";\n url: string;\n probe: ProbeResult;\n tokens: OAuthTokens | null;\n }\n | {\n step: \"error\";\n url: string;\n probe: ProbeResult | null;\n tokens: OAuthTokens | null;\n error: string;\n };\n\ntype Action =\n | { type: \"set-url\"; url: string }\n | { type: \"probe-start\" }\n | { type: \"probe-ok\"; probe: ProbeResult }\n | { type: \"probe-fail\"; error: string }\n | { type: \"oauth-start\" }\n | { type: \"oauth-waiting\"; sessionId: string }\n | { type: \"oauth-ok\"; tokens: OAuthTokens }\n | { type: \"oauth-fail\"; error: string }\n | { type: \"oauth-cancelled\" }\n | { type: \"oauth-reset\" }\n | { type: \"add-start\" }\n | { type: \"add-fail\"; error: string }\n | { type: \"retry\" };\n\nconst init: State = { step: \"url\", url: \"\" };\n\nfunction reducer(state: State, action: Action): State {\n return Match.value(action).pipe(\n Match.discriminator(\"type\")(\"set-url\", (a): State => ({ step: \"url\", url: a.url })),\n Match.discriminator(\"type\")(\n \"probe-start\",\n (): State => ({\n step: \"probing\",\n url: state.url,\n probe: \"probe\" in state ? state.probe : null,\n }),\n ),\n Match.discriminator(\"type\")(\n \"probe-ok\",\n (a): State => ({ step: \"probed\", url: state.url, probe: a.probe }),\n ),\n Match.discriminator(\"type\")(\n \"probe-fail\",\n (a): State => ({\n step: \"error\",\n url: state.url,\n probe: null,\n tokens: null,\n error: a.error,\n }),\n ),\n Match.discriminator(\"type\")(\"oauth-start\", (): State => {\n if (state.step !== \"probed\" && state.step !== \"error\") return state;\n return {\n step: \"oauth-starting\",\n url: state.url,\n probe: state.step === \"probed\" ? state.probe : state.probe!,\n };\n }),\n Match.discriminator(\"type\")(\"oauth-waiting\", (a): State => {\n if (state.step !== \"oauth-starting\") return state;\n return {\n step: \"oauth-waiting\",\n url: state.url,\n probe: state.probe,\n sessionId: a.sessionId,\n };\n }),\n Match.discriminator(\"type\")(\"oauth-ok\", (a): State => {\n if (state.step !== \"oauth-waiting\") return state;\n return {\n step: \"oauth-done\",\n url: state.url,\n probe: state.probe,\n tokens: a.tokens,\n };\n }),\n Match.discriminator(\"type\")(\"oauth-fail\", (a): State => {\n if (state.step !== \"oauth-starting\" && state.step !== \"oauth-waiting\") return state;\n return {\n step: \"error\",\n url: state.url,\n probe: state.probe,\n tokens: null,\n error: a.error,\n };\n }),\n Match.discriminator(\"type\")(\"oauth-cancelled\", (): State => {\n if (state.step !== \"oauth-waiting\") return state;\n return { step: \"probed\", url: state.url, probe: state.probe };\n }),\n Match.discriminator(\"type\")(\"oauth-reset\", (): State => {\n if (\"probe\" in state && state.probe) {\n return { step: \"probed\", url: state.url, probe: state.probe };\n }\n return state;\n }),\n Match.discriminator(\"type\")(\"add-start\", (): State => {\n const tokens =\n state.step === \"oauth-done\" ? state.tokens : state.step === \"probed\" ? null : null;\n const probe = \"probe\" in state ? state.probe : null;\n if (!probe) return state;\n return { step: \"adding\", url: state.url, probe, tokens };\n }),\n Match.discriminator(\"type\")(\"add-fail\", (a): State => {\n if (state.step !== \"adding\") return state;\n return {\n step: \"error\",\n url: state.url,\n probe: state.probe,\n tokens: state.tokens,\n error: a.error,\n };\n }),\n Match.discriminator(\"type\")(\"retry\", (): State => {\n if (state.step !== \"error\") return state;\n return state.probe\n ? state.tokens\n ? {\n step: \"oauth-done\",\n url: state.url,\n probe: state.probe,\n tokens: state.tokens,\n }\n : { step: \"probed\", url: state.url, probe: state.probe }\n : { step: \"url\", url: state.url };\n }),\n Match.exhaustive,\n );\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport default function AddMcpSource(props: {\n onComplete: () => void;\n onCancel: () => void;\n initialUrl?: string;\n initialPreset?: string;\n /** Whether the stdio transport is enabled on the server. */\n allowStdio?: boolean;\n}) {\n const allowStdio = props.allowStdio ?? false;\n const rawPreset = findPreset(props.initialPreset);\n // Drop stdio presets when stdio is disabled — the caller should have\n // already filtered these out, but defence-in-depth.\n const preset = rawPreset?.transport === \"stdio\" && !allowStdio ? undefined : rawPreset;\n const isStdioPreset = preset?.transport === \"stdio\";\n\n const [transport, setTransport] = useState<\"remote\" | \"stdio\">(\n isStdioPreset && allowStdio ? \"stdio\" : \"remote\",\n );\n\n // --- Stdio state ---\n const [stdioCommand, setStdioCommand] = useState(isStdioPreset ? preset.command : \"\");\n const [stdioArgs, setStdioArgs] = useState(\n isStdioPreset && preset.args ? preset.args.join(\" \") : \"\",\n );\n const [stdioEnv, setStdioEnv] = useState(\"\");\n const stdioIdentity = useSourceIdentity({\n fallbackName: isStdioPreset ? preset.name : stdioCommand,\n });\n const [stdioAdding, setStdioAdding] = useState(false);\n const [stdioError, setStdioError] = useState<string | null>(null);\n\n // --- Remote state ---\n const remoteUrl =\n !isStdioPreset && preset?.transport === undefined && preset?.url\n ? preset.url\n : (props.initialUrl ?? \"\");\n\n const [state, dispatch] = useReducer(\n reducer,\n remoteUrl ? { step: \"url\" as const, url: remoteUrl } : init,\n );\n\n const scopeId = useScope();\n const { credentialTargetScope: requestCredentialTargetScope } = useCredentialTargetScope();\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n credentialScopeOptions,\n } = useCredentialTargetScope();\n const doProbe = useAtomSet(probeMcpEndpoint, { mode: \"promiseExit\" });\n const doAdd = useAtomSet(addMcpSourceOptimistic(scopeId), {\n mode: \"promiseExit\",\n });\n const secretList = useSecretPickerSecrets();\n const oauth = useOAuthPopupFlow<OAuthCompletionPayload>({\n popupName: \"mcp-oauth\",\n popupBlockedMessage: \"OAuth popup was blocked\",\n detectPopupClosed: false,\n startErrorMessage: \"Failed to start OAuth\",\n });\n\n const [remoteAuthMode, setRemoteAuthMode] = useState<RemoteAuthMode>(\"none\");\n const [remoteCredentials, setRemoteCredentials] = useState(() => emptyHttpCredentials());\n\n const probe = \"probe\" in state ? state.probe : null;\n const tokens = \"tokens\" in state ? state.tokens : null;\n\n const remoteIdentity = useSourceIdentity({\n fallbackName:\n sourceDisplayNameFromUrl(state.url, \"MCP\") ?? probe?.serverName ?? probe?.name ?? \"\",\n });\n const isProbing = state.step === \"probing\";\n const isAdding = state.step === \"adding\";\n const isOAuthBusy =\n state.step === \"oauth-starting\" || state.step === \"oauth-waiting\" || oauth.busy;\n const canUseNone = probe?.requiresOAuth !== true || probe.supportsDynamicRegistration === false;\n const remoteCredentialsComplete = httpCredentialsValid(remoteCredentials);\n const authReady = remoteAuthMode === \"none\" ? canUseNone : tokens !== null;\n const canAdd =\n Boolean(probe) && authReady && remoteCredentialsComplete && !isAdding && !isOAuthBusy;\n // Probe failures are shown inline on the URL field; other failures\n // (OAuth start, add source) render in the bottom error block.\n const probeError = state.step === \"error\" && state.probe === null ? state.error : null;\n const otherError = state.step === \"error\" && state.probe !== null ? state.error : null;\n\n // ---- Remote actions ----\n\n const handleProbe = useCallback(async () => {\n dispatch({ type: \"probe-start\" });\n const { headers, queryParams } = serializeHttpCredentials(remoteCredentials);\n const exit = await doProbe({\n params: { scopeId },\n payload: {\n endpoint: state.url.trim(),\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n ...(Object.keys(queryParams).length > 0 ? { queryParams } : {}),\n },\n });\n if (Exit.isFailure(exit)) {\n dispatch({\n type: \"probe-fail\",\n error: errorMessageFromExit(exit, \"Failed to connect\"),\n });\n return;\n }\n setRemoteAuthMode(exit.value.requiresOAuth ? \"oauth2\" : \"none\");\n dispatch({ type: \"probe-ok\", probe: exit.value });\n }, [state.url, scopeId, doProbe, remoteCredentials]);\n\n // Keep the latest handleProbe in a ref so the debounced effect can call it\n // without depending on its identity (which changes every render).\n const handleProbeRef = useRef(handleProbe);\n handleProbeRef.current = handleProbe;\n\n // Auto-probe whenever the URL changes (debounced) while we're on the\n // remote transport and not already probing/probed.\n useEffect(() => {\n if (transport !== \"remote\") return;\n if (state.step !== \"url\") return;\n const trimmed = state.url.trim();\n if (!trimmed) return;\n const handle = setTimeout(() => {\n handleProbeRef.current();\n }, 400);\n return () => clearTimeout(handle);\n }, [transport, state.step, state.url]);\n\n const handleRemoteCredentialsChange = useCallback((next: typeof remoteCredentials) => {\n setRemoteCredentials(next);\n }, []);\n\n const handleOAuth = useCallback(async () => {\n dispatch({ type: \"oauth-start\" });\n const namespaceSlug =\n slugifyNamespace(remoteIdentity.namespace) ||\n slugifyNamespace(probe?.namespace ?? \"\") ||\n \"mcp\";\n const { headers, queryParams } = serializeHttpCredentials(remoteCredentials);\n await oauth.start({\n payload: {\n endpoint: state.url.trim(),\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n ...(Object.keys(queryParams).length > 0 ? { queryParams } : {}),\n redirectUrl: oauthCallbackUrl(),\n connectionId: oauthConnectionId({\n pluginId: \"mcp\",\n namespace: namespaceSlug,\n }),\n tokenScope: oauthCredentialTargetScope,\n strategy: { kind: \"dynamic-dcr\" },\n pluginId: \"mcp\",\n identityLabel: `${remoteIdentity.name.trim() || probe?.serverName || probe?.name || \"MCP\"} OAuth`,\n },\n onSuccess: (result) => {\n dispatch({\n type: \"oauth-ok\",\n tokens: {\n connectionId: result.connectionId,\n expiresAt: result.expiresAt,\n scope: result.scope,\n },\n });\n },\n onAuthorizationStarted: (result) =>\n dispatch({ type: \"oauth-waiting\", sessionId: result.sessionId }),\n onError: (error) => dispatch({ type: \"oauth-fail\", error }),\n });\n }, [state.url, remoteIdentity, probe, remoteCredentials, oauth, oauthCredentialTargetScope]);\n\n const handleCancelOAuth = useCallback(() => {\n oauth.cancel();\n dispatch({ type: \"oauth-cancelled\" });\n }, [oauth]);\n\n const handleAddRemote = useCallback(async () => {\n if (!probe) return;\n dispatch({ type: \"add-start\" });\n const templateCredentials = serializeTemplateHttpCredentials(remoteCredentials);\n const configureCredentials = serializeConfigureHttpCredentials(\n remoteCredentials,\n requestCredentialTargetScope,\n );\n const remoteRequestHeaders = templateCredentials.headers as Record<\n string,\n McpConfiguredValueInput\n >;\n const hasInitialCredentials =\n Object.keys(configureCredentials.headers).length > 0 ||\n Object.keys(configureCredentials.queryParams).length > 0 ||\n (remoteAuthMode === \"oauth2\" && tokens);\n const displayName = remoteIdentity.name.trim() || probe.serverName || probe.name;\n const slugNamespace = slugifyNamespace(remoteIdentity.namespace);\n const exit = await doAdd({\n params: { scopeId },\n payload: {\n transport: \"remote\" as const,\n name: displayName,\n namespace: slugNamespace || undefined,\n endpoint: state.url.trim(),\n ...(Object.keys(remoteRequestHeaders).length > 0 ? { headers: remoteRequestHeaders } : {}),\n ...(Object.keys(templateCredentials.queryParams).length > 0\n ? {\n queryParams: templateCredentials.queryParams as Record<\n string,\n McpConfiguredValueInput\n >,\n }\n : {}),\n ...(hasInitialCredentials\n ? {\n credentials: {\n scope: requestCredentialTargetScope,\n ...(Object.keys(configureCredentials.headers).length > 0\n ? {\n headers: configureCredentials.headers as Record<string, McpCredentialInput>,\n }\n : {}),\n ...(Object.keys(configureCredentials.queryParams).length > 0\n ? {\n queryParams: configureCredentials.queryParams as Record<\n string,\n McpCredentialInput\n >,\n }\n : {}),\n ...(remoteAuthMode === \"oauth2\" && tokens\n ? {\n auth: {\n oauth2: {\n connection: {\n kind: \"connection\" as const,\n connectionId: tokens.connectionId,\n },\n },\n },\n }\n : {}),\n },\n }\n : {}),\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n dispatch({\n type: \"add-fail\",\n error: errorMessageFromExit(exit, \"Failed to add source\"),\n });\n return;\n }\n props.onComplete();\n }, [\n probe,\n remoteAuthMode,\n remoteCredentials,\n remoteIdentity,\n tokens,\n state.url,\n doAdd,\n props,\n scopeId,\n requestCredentialTargetScope,\n ]);\n\n // ---- Stdio actions ----\n\n const parseStdioArgs = (raw: string): string[] => {\n if (!raw.trim()) return [];\n const args: string[] = [];\n const regex = /[^\\s\"]+|\"([^\"]*)\"/g;\n let match;\n while ((match = regex.exec(raw)) !== null) {\n args.push(match[1] ?? match[0]);\n }\n return args;\n };\n\n const parseStdioEnvValue = (raw: string): string => {\n const value = raw.trim();\n if (value.length < 2) return value;\n\n const quote = value[0];\n if ((quote !== '\"' && quote !== \"'\") || value[value.length - 1] !== quote) {\n return value;\n }\n\n const inner = value.slice(1, -1);\n if (quote === \"'\") return inner;\n\n return inner.replace(\n /\\\\([\\\\nrt\"])/g,\n (_, escaped: string) => STDIO_ENV_ESCAPE_REPLACEMENTS[escaped] ?? escaped,\n );\n };\n\n const parseStdioEnv = (raw: string): Record<string, string> | undefined => {\n if (!raw.trim()) return undefined;\n const env: Record<string, string> = {};\n for (const line of raw.split(\"\\n\")) {\n const eq = line.indexOf(\"=\");\n if (eq > 0) {\n env[line.slice(0, eq).trim()] = parseStdioEnvValue(line.slice(eq + 1));\n }\n }\n return Object.keys(env).length > 0 ? env : undefined;\n };\n\n const handleAddStdio = useCallback(async () => {\n const cmd = stdioCommand.trim();\n if (!cmd) return;\n setStdioAdding(true);\n setStdioError(null);\n const displayName = stdioIdentity.name.trim() || cmd;\n const slugNamespace = slugifyNamespace(stdioIdentity.namespace);\n const exit = await doAdd({\n params: { scopeId },\n payload: {\n transport: \"stdio\" as const,\n name: displayName,\n namespace: slugNamespace || undefined,\n command: cmd,\n args: parseStdioArgs(stdioArgs),\n env: parseStdioEnv(stdioEnv),\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setStdioError(errorMessageFromExit(exit, \"Failed to add source\"));\n setStdioAdding(false);\n return;\n }\n props.onComplete();\n }, [stdioCommand, stdioArgs, stdioEnv, stdioIdentity, doAdd, scopeId, props]);\n\n // ---- Render ----\n\n return (\n <div className=\"flex flex-1 flex-col gap-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Add MCP Source</h1>\n <p className=\"mt-1 text-[13px] text-muted-foreground\">\n Connect to an MCP server to discover and use its tools.\n </p>\n </div>\n\n {/* Transport toggle — only shown when stdio is enabled server-side */}\n {allowStdio && (\n <div className=\"flex gap-1 rounded-lg border border-border bg-muted/30 p-1\">\n <Button\n variant=\"ghost\"\n type=\"button\"\n onClick={() => setTransport(\"remote\")}\n className={`flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${\n transport === \"remote\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n }`}\n >\n Remote\n </Button>\n <Button\n variant=\"ghost\"\n type=\"button\"\n onClick={() => setTransport(\"stdio\")}\n className={`flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${\n transport === \"stdio\"\n ? \"bg-background text-foreground shadow-sm\"\n : \"text-muted-foreground hover:text-foreground\"\n }`}\n >\n Stdio\n </Button>\n </div>\n )}\n\n {transport === \"remote\" ? (\n <>\n <McpRemoteSourceFields\n url={state.url}\n onUrlChange={(url) => dispatch({ type: \"set-url\", url })}\n identity={remoteIdentity}\n preview={probe}\n probing={isProbing}\n error={probeError}\n onRetry={handleProbe}\n />\n\n <HttpCredentialsEditor\n credentials={remoteCredentials}\n onChange={handleRemoteCredentialsChange}\n existingSecrets={secretList}\n sourceName={remoteIdentity.name}\n targetScope={requestCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n bindingScopeOptions={credentialScopeOptions}\n headerPresets={mcpHeaderPresets}\n labels={{\n headers: \"Request headers\",\n queryParams: \"Query parameters\",\n }}\n />\n\n {/* Authentication */}\n {probe && (\n <section className=\"space-y-2.5\">\n <div className=\"flex items-center justify-between gap-3\">\n <FieldLabel>Authentication</FieldLabel>\n <FilterTabs<RemoteAuthMode>\n tabs={\n probe.requiresOAuth && probe.supportsDynamicRegistration\n ? [{ value: \"oauth2\", label: \"OAuth\" }]\n : [\n { value: \"none\", label: \"None\" },\n { value: \"oauth2\", label: \"OAuth\" },\n ]\n }\n value={remoteAuthMode}\n onChange={setRemoteAuthMode}\n />\n </div>\n\n {remoteAuthMode === \"oauth2\" && (\n <CredentialUsageRow\n value={oauthCredentialTargetScope}\n options={credentialScopeOptions}\n onChange={(targetScope) => {\n setOAuthCredentialTargetScope(targetScope);\n dispatch({ type: \"oauth-reset\" });\n }}\n label=\"Connection saved to\"\n help=\"Choose who can use the OAuth connection.\"\n >\n <CredentialControlField\n label=\"Connect via OAuth\"\n help=\"Start the provider OAuth flow.\"\n >\n {!tokens &&\n state.step === \"probed\" &&\n (probe.supportsDynamicRegistration ? (\n <Button\n type=\"button\"\n onClick={handleOAuth}\n variant=\"outline\"\n className=\"w-full\"\n >\n Sign in\n </Button>\n ) : (\n <div className=\"rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground\">\n This server requires OAuth, but its authorization server does not support\n dynamic client registration. Use request headers with a bearer token, or\n save the source and connect a supported OAuth connection later.\n </div>\n ))}\n\n {!tokens && state.step === \"oauth-starting\" && (\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2\">\n <Spinner className=\"size-3.5\" />\n <span className=\"text-xs text-muted-foreground\">\n Starting authorization...\n </span>\n </div>\n )}\n\n {!tokens && state.step === \"oauth-waiting\" && (\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-blue-500/30 bg-blue-500/5 px-3 py-2\">\n <Spinner className=\"size-3.5 text-blue-500\" />\n <span className=\"text-xs text-blue-600 dark:text-blue-400\">\n Waiting for authorization...\n </span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleCancelOAuth}\n className=\"ml-auto h-7 px-2 text-xs\"\n >\n Cancel\n </Button>\n </div>\n )}\n\n {tokens && (\n <div className=\"flex min-h-9 items-center gap-2 rounded-md border border-emerald-500/30 bg-emerald-500/5 px-3 py-2\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" className=\"size-3.5 text-emerald-500\">\n <path\n d=\"M3 8.5l3 3 7-7\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n <span className=\"text-xs font-medium text-emerald-600 dark:text-emerald-400\">\n Authenticated\n </span>\n </div>\n )}\n </CredentialControlField>\n </CredentialUsageRow>\n )}\n </section>\n )}\n\n {/* Error (OAuth / add source). Probe errors show inline on the field. */}\n {otherError && (\n <div className=\"space-y-2\">\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">{otherError}</p>\n </div>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => dispatch({ type: \"retry\" })}\n className=\"text-xs\"\n >\n Try again\n </Button>\n </div>\n )}\n\n <FloatActions>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => {\n oauth.cancel();\n props.onCancel();\n }}\n disabled={isAdding}\n >\n Cancel\n </Button>\n {(probe || isProbing) && (\n <Button type=\"button\" onClick={handleAddRemote} disabled={!canAdd}>\n {isAdding ? (\n <>\n <Spinner className=\"size-3.5\" /> Adding…\n </>\n ) : (\n \"Add source\"\n )}\n </Button>\n )}\n </FloatActions>\n </>\n ) : (\n <>\n {/* Stdio form */}\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntryField\n label=\"Command\"\n description=\"- The executable to run (e.g. npx, uvx, node).\"\n >\n <Input\n value={stdioCommand}\n onChange={(e) => setStdioCommand((e.target as HTMLInputElement).value)}\n placeholder=\"npx\"\n className=\"font-mono text-sm\"\n />\n </CardStackEntryField>\n\n <CardStackEntryField\n label=\"Arguments\"\n description=\"- Space-separated arguments passed to the command.\"\n >\n <Input\n value={stdioArgs}\n onChange={(e) => setStdioArgs((e.target as HTMLInputElement).value)}\n placeholder=\"-y chrome-devtools-mcp@latest\"\n className=\"font-mono text-sm\"\n />\n </CardStackEntryField>\n\n <CardStackEntryField\n label=\"Environment variables\"\n description=\"- One per line, KEY=value format.\"\n >\n <Textarea\n value={stdioEnv}\n onChange={(e) => setStdioEnv((e.target as HTMLTextAreaElement).value)}\n placeholder={\"KEY=value\\nANOTHER=value\"}\n rows={3}\n maxRows={10}\n className=\"font-mono text-sm\"\n />\n </CardStackEntryField>\n </CardStackContent>\n </CardStack>\n\n <SourceIdentityFields identity={stdioIdentity} namePlaceholder=\"My MCP Server\" />\n\n {/* Stdio error */}\n {stdioError && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">{stdioError}</p>\n </div>\n )}\n\n <FloatActions>\n <Button type=\"button\" variant=\"ghost\" onClick={props.onCancel} disabled={stdioAdding}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n onClick={handleAddStdio}\n disabled={!stdioCommand.trim() || stdioAdding}\n >\n {stdioAdding ? (\n <>\n <Spinner className=\"size-3.5\" /> Adding…\n </>\n ) : (\n \"Add source\"\n )}\n </Button>\n </FloatActions>\n </>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,aAAa,WAAW,QAAQ,gBAAgB;AACrE,SAAS,kBAAkB;AAC3B,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,YAAY;AAExB,SAAS,gBAAgB;AACzB,SAAS,cA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AAA,gBACC,OAAO;AAAA,gBACP,UAAU,CAAC,MAAM,YAAa,EAAE,OAA+B,KAAK;AAAA,gBACpE,aAAa;AAAA,gBACb,MAAM;AAAA,gBACN,SAAS;AAAA,gBACT,WAAU;AAAA;AAAA,YACZ;AAAA;AAAA,QACF;AAAA,SACF,GACF;AAAA,MAEA,oBAAC,wBAAqB,UAAU,eAAe,iBAAgB,iBAAgB;AAAA,MAG9E,cACC,oBAAC,SAAI,WAAU,sEACb,8BAAC,OAAE,WAAU,gCAAgC,sBAAW,GAC1D;AAAA,MAGF,qBAAC,gBACC;AAAA,4BAAC,UAAO,MAAK,UAAS,SAAQ,SAAQ,SAAS,MAAM,UAAU,UAAU,aAAa,oBAEtF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,UAAU,CAAC,aAAa,KAAK,KAAK;AAAA,YAEjC,wBACC,iCACE;AAAA,kCAAC,WAAQ,WAAU,YAAW;AAAA,cAAE;AAAA,eAClC,IAEA;AAAA;AAAA,QAEJ;AAAA,SACF;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["match","value"]}
|
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
McpRemoteSourceFields
|
|
3
|
-
} from "./chunk-ZIRGIRGP.js";
|
|
4
|
-
import {
|
|
5
|
-
mcpSourceAtom,
|
|
6
|
-
mcpSourceBindingsAtom
|
|
7
|
-
} from "./chunk-FMTVLO5L.js";
|
|
8
|
-
import "./chunk-6OYEXHU3.js";
|
|
9
|
-
|
|
10
|
-
// src/react/EditMcpSource.tsx
|
|
11
|
-
import { useMemo, useState } from "react";
|
|
12
|
-
import { useAtomValue, useAtomSet } from "@effect/atom-react";
|
|
13
|
-
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
14
|
-
import * as Exit from "effect/Exit";
|
|
15
|
-
import {
|
|
16
|
-
configureSource,
|
|
17
|
-
connectionsAtom,
|
|
18
|
-
setSourceCredentialBinding
|
|
19
|
-
} from "@executor-js/react/api/atoms";
|
|
20
|
-
import { useScope, useUserScope } from "@executor-js/react/api/scope-context";
|
|
21
|
-
import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys";
|
|
22
|
-
import { slugifyNamespace, useSourceIdentity } from "@executor-js/react/plugins/source-identity";
|
|
23
|
-
import { useCredentialTargetScope } from "@executor-js/react/plugins/credential-target-scope";
|
|
24
|
-
import { useSecretPickerSecrets } from "@executor-js/react/plugins/use-secret-picker-secrets";
|
|
25
|
-
import {
|
|
26
|
-
httpCredentialsFromConfiguredCredentialBindings,
|
|
27
|
-
serializeHttpCredentials
|
|
28
|
-
} from "@executor-js/react/plugins/http-credentials";
|
|
29
|
-
import {
|
|
30
|
-
useSourceCredentialBindingScopes,
|
|
31
|
-
useSourceCredentialBindingWriter
|
|
32
|
-
} from "@executor-js/react/plugins/source-credential-bindings";
|
|
33
|
-
import {
|
|
34
|
-
SourceOAuthConnectionControl,
|
|
35
|
-
sourceOAuthConnectionUiState
|
|
36
|
-
} from "@executor-js/react/plugins/source-oauth-connection";
|
|
37
|
-
import { Button } from "@executor-js/react/components/button";
|
|
38
|
-
import {
|
|
39
|
-
CardStack,
|
|
40
|
-
CardStackContent,
|
|
41
|
-
CardStackEntry,
|
|
42
|
-
CardStackEntryContent,
|
|
43
|
-
CardStackEntryDescription,
|
|
44
|
-
CardStackEntryTitle
|
|
45
|
-
} from "@executor-js/react/components/card-stack";
|
|
46
|
-
import { Badge } from "@executor-js/react/components/badge";
|
|
47
|
-
import { ScopeId } from "@executor-js/sdk/shared";
|
|
48
|
-
import {
|
|
49
|
-
SecretCredentialSlotBindings,
|
|
50
|
-
secretCredentialSlotsFromHttpConfig
|
|
51
|
-
} from "@executor-js/react/plugins/credential-slot-bindings";
|
|
52
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
53
|
-
function RemoteEditForm(props) {
|
|
54
|
-
const displayScope = useScope();
|
|
55
|
-
const userScope = useUserScope();
|
|
56
|
-
const sourceScope = ScopeId.make(props.initial.scope);
|
|
57
|
-
const {
|
|
58
|
-
credentialTargetScope: oauthCredentialTargetScope,
|
|
59
|
-
setCredentialTargetScope: setOAuthCredentialTargetScope
|
|
60
|
-
} = useCredentialTargetScope({
|
|
61
|
-
sourceScope,
|
|
62
|
-
initialTargetScope: userScope
|
|
63
|
-
});
|
|
64
|
-
const doConfigure = useAtomSet(configureSource, { mode: "promiseExit" });
|
|
65
|
-
const setConnectionBinding = useAtomSet(setSourceCredentialBinding, { mode: "promise" });
|
|
66
|
-
const secretList = useSecretPickerSecrets();
|
|
67
|
-
const connectionsResult = useAtomValue(connectionsAtom(userScope));
|
|
68
|
-
const identity = useSourceIdentity({
|
|
69
|
-
fallbackName: props.initial.name,
|
|
70
|
-
fallbackNamespace: props.initial.namespace
|
|
71
|
-
});
|
|
72
|
-
const [endpoint, setEndpoint] = useState(props.initial.config.endpoint);
|
|
73
|
-
const credentials = useMemo(
|
|
74
|
-
() => httpCredentialsFromConfiguredCredentialBindings({
|
|
75
|
-
headers: props.initial.config.headers,
|
|
76
|
-
queryParams: props.initial.config.queryParams,
|
|
77
|
-
bindings: props.bindings
|
|
78
|
-
}),
|
|
79
|
-
[props.bindings, props.initial.config.headers, props.initial.config.queryParams]
|
|
80
|
-
);
|
|
81
|
-
const [saving, setSaving] = useState(false);
|
|
82
|
-
const [error, setError] = useState(null);
|
|
83
|
-
const { busyKey, setSecretBinding, clearBinding } = useSourceCredentialBindingWriter({
|
|
84
|
-
displayScope,
|
|
85
|
-
source: { id: props.sourceId, scope: sourceScope },
|
|
86
|
-
onError: setError
|
|
87
|
-
});
|
|
88
|
-
const identityDirty = identity.name.trim() !== props.initial.name.trim();
|
|
89
|
-
const metadataDirty = identityDirty || endpoint.trim() !== props.initial.config.endpoint.trim();
|
|
90
|
-
const dirty = metadataDirty;
|
|
91
|
-
const oauth2 = props.initial.config.auth.kind === "oauth2" ? props.initial.config.auth : null;
|
|
92
|
-
const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];
|
|
93
|
-
const { credentialScopeOptions, secretBindingScopes, scopeRanks } = useSourceCredentialBindingScopes({ sourceScope });
|
|
94
|
-
const secretSlots = secretCredentialSlotsFromHttpConfig({
|
|
95
|
-
headers: props.initial.config.headers,
|
|
96
|
-
queryParams: props.initial.config.queryParams
|
|
97
|
-
});
|
|
98
|
-
const oauthConnectionState = oauth2 ? sourceOAuthConnectionUiState({
|
|
99
|
-
bindings: props.bindings,
|
|
100
|
-
connectionSlot: oauth2.connectionSlot,
|
|
101
|
-
tokenScope: oauthCredentialTargetScope,
|
|
102
|
-
scopeRanks,
|
|
103
|
-
credentialScopeOptions,
|
|
104
|
-
connections
|
|
105
|
-
}) : null;
|
|
106
|
-
const oauthRequestCredentials = serializeHttpCredentials(credentials);
|
|
107
|
-
const handleSave = async () => {
|
|
108
|
-
setSaving(true);
|
|
109
|
-
setError(null);
|
|
110
|
-
const config = {
|
|
111
|
-
name: metadataDirty ? identity.name.trim() || void 0 : void 0,
|
|
112
|
-
endpoint: metadataDirty ? endpoint.trim() || void 0 : void 0
|
|
113
|
-
};
|
|
114
|
-
const exit = await doConfigure({
|
|
115
|
-
params: { scopeId: displayScope },
|
|
116
|
-
payload: {
|
|
117
|
-
source: { id: props.sourceId, scope: sourceScope },
|
|
118
|
-
scope: sourceScope,
|
|
119
|
-
type: "mcp",
|
|
120
|
-
config
|
|
121
|
-
},
|
|
122
|
-
reactivityKeys: sourceWriteKeys
|
|
123
|
-
});
|
|
124
|
-
if (Exit.isFailure(exit)) {
|
|
125
|
-
setError("Failed to update source");
|
|
126
|
-
setSaving(false);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
setSaving(false);
|
|
130
|
-
props.onSave();
|
|
131
|
-
};
|
|
132
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
133
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
134
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
|
|
135
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Update the endpoint and headers for this MCP connection." })
|
|
136
|
-
] }),
|
|
137
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3", children: [
|
|
138
|
-
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold text-card-foreground", children: props.sourceId }) }),
|
|
139
|
-
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "remote" })
|
|
140
|
-
] }),
|
|
141
|
-
/* @__PURE__ */ jsx(
|
|
142
|
-
McpRemoteSourceFields,
|
|
143
|
-
{
|
|
144
|
-
url: endpoint,
|
|
145
|
-
onUrlChange: setEndpoint,
|
|
146
|
-
identity,
|
|
147
|
-
preview: {
|
|
148
|
-
name: props.initial.name,
|
|
149
|
-
serverName: props.initial.name,
|
|
150
|
-
connected: true,
|
|
151
|
-
toolCount: null
|
|
152
|
-
},
|
|
153
|
-
namespaceReadOnly: true
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
secretSlots.length > 0 && /* @__PURE__ */ jsx(CardStack, { children: /* @__PURE__ */ jsxs(CardStackContent, { className: "border-t-0", children: [
|
|
157
|
-
/* @__PURE__ */ jsx(CardStackEntry, { children: /* @__PURE__ */ jsxs(CardStackEntryContent, { children: [
|
|
158
|
-
/* @__PURE__ */ jsx(CardStackEntryTitle, { children: "Request credentials" }),
|
|
159
|
-
/* @__PURE__ */ jsx(CardStackEntryDescription, { children: "Headers and query parameters sent with every MCP request." })
|
|
160
|
-
] }) }),
|
|
161
|
-
/* @__PURE__ */ jsx(
|
|
162
|
-
SecretCredentialSlotBindings,
|
|
163
|
-
{
|
|
164
|
-
slots: secretSlots,
|
|
165
|
-
bindingScopes: secretBindingScopes,
|
|
166
|
-
bindingRows: props.bindings,
|
|
167
|
-
scopeRanks,
|
|
168
|
-
secrets: secretList,
|
|
169
|
-
sourceId: props.sourceId,
|
|
170
|
-
sourceName: identity.name,
|
|
171
|
-
credentialScopeOptions,
|
|
172
|
-
busyKey,
|
|
173
|
-
onSetSecretBinding: setSecretBinding,
|
|
174
|
-
onClearBinding: clearBinding
|
|
175
|
-
}
|
|
176
|
-
)
|
|
177
|
-
] }) }),
|
|
178
|
-
oauth2 && oauthConnectionState && /* @__PURE__ */ jsx(
|
|
179
|
-
SourceOAuthConnectionControl,
|
|
180
|
-
{
|
|
181
|
-
popupName: "mcp-oauth",
|
|
182
|
-
pluginId: "mcp",
|
|
183
|
-
namespace: slugifyNamespace(props.initial.namespace) || "mcp",
|
|
184
|
-
fallbackNamespace: "mcp",
|
|
185
|
-
endpoint: endpoint.trim(),
|
|
186
|
-
tokenScope: oauthCredentialTargetScope,
|
|
187
|
-
onTokenScopeChange: setOAuthCredentialTargetScope,
|
|
188
|
-
credentialScopeOptions,
|
|
189
|
-
connectionId: oauthConnectionState.connectionId,
|
|
190
|
-
sourceLabel: `${identity.name.trim() || props.initial.namespace || "MCP"} OAuth`,
|
|
191
|
-
headers: oauthRequestCredentials.headers,
|
|
192
|
-
queryParams: oauthRequestCredentials.queryParams,
|
|
193
|
-
isConnected: oauthConnectionState.isConnected,
|
|
194
|
-
buttonIsConnected: oauthConnectionState.buttonIsConnected,
|
|
195
|
-
statusLabel: oauthConnectionState.statusLabel,
|
|
196
|
-
onConnected: async (connectionId) => {
|
|
197
|
-
await setConnectionBinding({
|
|
198
|
-
params: { scopeId: oauthCredentialTargetScope },
|
|
199
|
-
payload: {
|
|
200
|
-
scope: oauthCredentialTargetScope,
|
|
201
|
-
source: { id: props.sourceId, scope: sourceScope },
|
|
202
|
-
slotKey: oauth2.connectionSlot,
|
|
203
|
-
value: { kind: "connection", connectionId }
|
|
204
|
-
},
|
|
205
|
-
reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys]
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
reconnectingLabel: "Reconnecting\u2026",
|
|
209
|
-
reconnectLabel: "Reconnect",
|
|
210
|
-
signInLabel: oauthConnectionState.signInLabel,
|
|
211
|
-
signingInLabel: "Signing in\u2026"
|
|
212
|
-
}
|
|
213
|
-
),
|
|
214
|
-
error && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error }) }),
|
|
215
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t border-border pt-4", children: [
|
|
216
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: props.onSave, children: "Cancel" }),
|
|
217
|
-
/* @__PURE__ */ jsx(Button, { onClick: handleSave, disabled: !dirty || saving, children: saving ? "Saving\u2026" : "Save changes" })
|
|
218
|
-
] })
|
|
219
|
-
] });
|
|
220
|
-
}
|
|
221
|
-
function StdioReadOnly(props) {
|
|
222
|
-
const { command, args } = props.initial.config;
|
|
223
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
224
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
225
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
|
|
226
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Stdio MCP sources cannot be edited in the UI. Remove and recreate the source with the updated command." })
|
|
227
|
-
] }),
|
|
228
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3", children: [
|
|
229
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
230
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold text-card-foreground", children: props.sourceId }),
|
|
231
|
-
/* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-xs text-muted-foreground font-mono", children: [
|
|
232
|
-
command,
|
|
233
|
-
" ",
|
|
234
|
-
(args ?? []).join(" ")
|
|
235
|
-
] })
|
|
236
|
-
] }),
|
|
237
|
-
/* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "stdio" })
|
|
238
|
-
] }),
|
|
239
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end border-t border-border pt-4", children: /* @__PURE__ */ jsx(Button, { onClick: props.onSave, children: "Done" }) })
|
|
240
|
-
] });
|
|
241
|
-
}
|
|
242
|
-
function EditMcpSource({
|
|
243
|
-
sourceId,
|
|
244
|
-
onSave
|
|
245
|
-
}) {
|
|
246
|
-
const scopeId = useScope();
|
|
247
|
-
const userScope = useUserScope();
|
|
248
|
-
const sourceResult = useAtomValue(mcpSourceAtom(scopeId, sourceId));
|
|
249
|
-
const source = AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;
|
|
250
|
-
const sourceScope = source ? ScopeId.make(source.scope) : scopeId;
|
|
251
|
-
const bindingsResult = useAtomValue(mcpSourceBindingsAtom(userScope, sourceId, sourceScope));
|
|
252
|
-
if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {
|
|
253
|
-
return /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs("div", { children: [
|
|
254
|
-
/* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
|
|
255
|
-
/* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Loading configuration\u2026" })
|
|
256
|
-
] }) });
|
|
257
|
-
}
|
|
258
|
-
if (source.config.transport === "stdio") {
|
|
259
|
-
return /* @__PURE__ */ jsx(
|
|
260
|
-
StdioReadOnly,
|
|
261
|
-
{
|
|
262
|
-
sourceId,
|
|
263
|
-
initial: source,
|
|
264
|
-
onSave
|
|
265
|
-
}
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
return /* @__PURE__ */ jsx(
|
|
269
|
-
RemoteEditForm,
|
|
270
|
-
{
|
|
271
|
-
sourceId,
|
|
272
|
-
initial: source,
|
|
273
|
-
bindings: bindingsResult.value,
|
|
274
|
-
onSave
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
export {
|
|
279
|
-
EditMcpSource as default
|
|
280
|
-
};
|
|
281
|
-
//# sourceMappingURL=EditMcpSource-L5GC2B4J.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/react/EditMcpSource.tsx"],"sourcesContent":["import { useMemo, useState } from \"react\";\nimport { useAtomValue, useAtomSet } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport * as Exit from \"effect/Exit\";\nimport { mcpSourceAtom, mcpSourceBindingsAtom } from \"./atoms\";\nimport {\n configureSource,\n connectionsAtom,\n setSourceCredentialBinding,\n} from \"@executor-js/react/api/atoms\";\nimport { useScope, useUserScope } from \"@executor-js/react/api/scope-context\";\nimport { connectionWriteKeys, sourceWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { slugifyNamespace, useSourceIdentity } from \"@executor-js/react/plugins/source-identity\";\nimport { useCredentialTargetScope } from \"@executor-js/react/plugins/credential-target-scope\";\nimport { useSecretPickerSecrets } from \"@executor-js/react/plugins/use-secret-picker-secrets\";\nimport {\n httpCredentialsFromConfiguredCredentialBindings,\n serializeHttpCredentials,\n type HttpCredentialsState,\n} from \"@executor-js/react/plugins/http-credentials\";\nimport {\n useSourceCredentialBindingScopes,\n useSourceCredentialBindingWriter,\n} from \"@executor-js/react/plugins/source-credential-bindings\";\nimport {\n SourceOAuthConnectionControl,\n sourceOAuthConnectionUiState,\n} from \"@executor-js/react/plugins/source-oauth-connection\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntry,\n CardStackEntryContent,\n CardStackEntryDescription,\n CardStackEntryTitle,\n} from \"@executor-js/react/components/card-stack\";\nimport { Badge } from \"@executor-js/react/components/badge\";\nimport { type CredentialBindingRef, ScopeId } from \"@executor-js/sdk/shared\";\nimport {\n SecretCredentialSlotBindings,\n secretCredentialSlotsFromHttpConfig,\n} from \"@executor-js/react/plugins/credential-slot-bindings\";\nimport { McpRemoteSourceFields } from \"./McpRemoteSourceFields\";\nimport type { McpStoredSourceSchemaType } from \"../sdk/stored-source\";\n\n// ---------------------------------------------------------------------------\n// Remote edit form\n// ---------------------------------------------------------------------------\n\nfunction RemoteEditForm(props: {\n sourceId: string;\n initial: McpStoredSourceSchemaType & { config: { transport: \"remote\" } };\n bindings: readonly CredentialBindingRef[];\n onSave: () => void;\n}) {\n const displayScope = useScope();\n const userScope = useUserScope();\n const sourceScope = ScopeId.make(props.initial.scope);\n const {\n credentialTargetScope: oauthCredentialTargetScope,\n setCredentialTargetScope: setOAuthCredentialTargetScope,\n } = useCredentialTargetScope({\n sourceScope,\n initialTargetScope: userScope,\n });\n const doConfigure = useAtomSet(configureSource, { mode: \"promiseExit\" });\n const setConnectionBinding = useAtomSet(setSourceCredentialBinding, { mode: \"promise\" });\n const secretList = useSecretPickerSecrets();\n const connectionsResult = useAtomValue(connectionsAtom(userScope));\n\n const identity = useSourceIdentity({\n fallbackName: props.initial.name,\n fallbackNamespace: props.initial.namespace,\n });\n const [endpoint, setEndpoint] = useState(props.initial.config.endpoint);\n const credentials = useMemo<HttpCredentialsState>(\n () =>\n httpCredentialsFromConfiguredCredentialBindings({\n headers: props.initial.config.headers,\n queryParams: props.initial.config.queryParams,\n bindings: props.bindings,\n }),\n [props.bindings, props.initial.config.headers, props.initial.config.queryParams],\n );\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const { busyKey, setSecretBinding, clearBinding } = useSourceCredentialBindingWriter({\n displayScope,\n source: { id: props.sourceId, scope: sourceScope },\n onError: setError,\n });\n\n const identityDirty = identity.name.trim() !== props.initial.name.trim();\n const metadataDirty = identityDirty || endpoint.trim() !== props.initial.config.endpoint.trim();\n const dirty = metadataDirty;\n const oauth2 = props.initial.config.auth.kind === \"oauth2\" ? props.initial.config.auth : null;\n const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];\n const { credentialScopeOptions, secretBindingScopes, scopeRanks } =\n useSourceCredentialBindingScopes({ sourceScope });\n const secretSlots = secretCredentialSlotsFromHttpConfig({\n headers: props.initial.config.headers,\n queryParams: props.initial.config.queryParams,\n });\n const oauthConnectionState = oauth2\n ? sourceOAuthConnectionUiState({\n bindings: props.bindings,\n connectionSlot: oauth2.connectionSlot,\n tokenScope: oauthCredentialTargetScope,\n scopeRanks,\n credentialScopeOptions,\n connections,\n })\n : null;\n const oauthRequestCredentials = serializeHttpCredentials(credentials);\n\n const handleSave = async () => {\n setSaving(true);\n setError(null);\n const config: {\n name?: string;\n endpoint?: string;\n } = {\n name: metadataDirty ? identity.name.trim() || undefined : undefined,\n endpoint: metadataDirty ? endpoint.trim() || undefined : undefined,\n };\n const exit = await doConfigure({\n params: { scopeId: displayScope },\n payload: {\n source: { id: props.sourceId, scope: sourceScope },\n scope: sourceScope,\n type: \"mcp\",\n config,\n },\n reactivityKeys: sourceWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setError(\"Failed to update source\");\n setSaving(false);\n return;\n }\n setSaving(false);\n props.onSave();\n };\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit MCP Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Update the endpoint and headers for this MCP connection.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-card-foreground\">{props.sourceId}</p>\n </div>\n <Badge variant=\"secondary\" className=\"text-xs\">\n remote\n </Badge>\n </div>\n\n <McpRemoteSourceFields\n url={endpoint}\n onUrlChange={setEndpoint}\n identity={identity}\n preview={{\n name: props.initial.name,\n serverName: props.initial.name,\n connected: true,\n toolCount: null,\n }}\n namespaceReadOnly\n />\n\n {secretSlots.length > 0 && (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntry>\n <CardStackEntryContent>\n <CardStackEntryTitle>Request credentials</CardStackEntryTitle>\n <CardStackEntryDescription>\n Headers and query parameters sent with every MCP request.\n </CardStackEntryDescription>\n </CardStackEntryContent>\n </CardStackEntry>\n <SecretCredentialSlotBindings\n slots={secretSlots}\n bindingScopes={secretBindingScopes}\n bindingRows={props.bindings}\n scopeRanks={scopeRanks}\n secrets={secretList}\n sourceId={props.sourceId}\n sourceName={identity.name}\n credentialScopeOptions={credentialScopeOptions}\n busyKey={busyKey}\n onSetSecretBinding={setSecretBinding}\n onClearBinding={clearBinding}\n />\n </CardStackContent>\n </CardStack>\n )}\n\n {oauth2 && oauthConnectionState && (\n <SourceOAuthConnectionControl\n popupName=\"mcp-oauth\"\n pluginId=\"mcp\"\n namespace={slugifyNamespace(props.initial.namespace) || \"mcp\"}\n fallbackNamespace=\"mcp\"\n endpoint={endpoint.trim()}\n tokenScope={oauthCredentialTargetScope}\n onTokenScopeChange={setOAuthCredentialTargetScope}\n credentialScopeOptions={credentialScopeOptions}\n connectionId={oauthConnectionState.connectionId}\n sourceLabel={`${identity.name.trim() || props.initial.namespace || \"MCP\"} OAuth`}\n headers={oauthRequestCredentials.headers}\n queryParams={oauthRequestCredentials.queryParams}\n isConnected={oauthConnectionState.isConnected}\n buttonIsConnected={oauthConnectionState.buttonIsConnected}\n statusLabel={oauthConnectionState.statusLabel}\n onConnected={async (connectionId) => {\n await setConnectionBinding({\n params: { scopeId: oauthCredentialTargetScope },\n payload: {\n scope: oauthCredentialTargetScope,\n source: { id: props.sourceId, scope: sourceScope },\n slotKey: oauth2.connectionSlot,\n value: { kind: \"connection\", connectionId },\n },\n reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys],\n });\n }}\n reconnectingLabel=\"Reconnecting…\"\n reconnectLabel=\"Reconnect\"\n signInLabel={oauthConnectionState.signInLabel}\n signingInLabel=\"Signing in…\"\n />\n )}\n\n {error && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-sm text-destructive\">{error}</p>\n </div>\n )}\n\n <div className=\"flex items-center justify-between border-t border-border pt-4\">\n <Button variant=\"ghost\" onClick={props.onSave}>\n Cancel\n </Button>\n <Button onClick={handleSave} disabled={!dirty || saving}>\n {saving ? \"Saving…\" : \"Save changes\"}\n </Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Stdio read-only view\n// ---------------------------------------------------------------------------\n\nfunction StdioReadOnly(props: {\n sourceId: string;\n initial: McpStoredSourceSchemaType & { config: { transport: \"stdio\" } };\n onSave: () => void;\n}) {\n const { command, args } = props.initial.config;\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit MCP Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Stdio MCP sources cannot be edited in the UI. Remove and recreate the source with the\n updated command.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate text-sm font-semibold text-card-foreground\">{props.sourceId}</p>\n <p className=\"mt-0.5 text-xs text-muted-foreground font-mono\">\n {command} {(args ?? []).join(\" \")}\n </p>\n </div>\n <Badge variant=\"secondary\" className=\"text-xs\">\n stdio\n </Badge>\n </div>\n\n <div className=\"flex items-center justify-end border-t border-border pt-4\">\n <Button onClick={props.onSave}>Done</Button>\n </div>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Main component\n// ---------------------------------------------------------------------------\n\nexport default function EditMcpSource({\n sourceId,\n onSave,\n}: {\n readonly sourceId: string;\n readonly onSave: () => void;\n}) {\n const scopeId = useScope();\n const userScope = useUserScope();\n const sourceResult = useAtomValue(mcpSourceAtom(scopeId, sourceId)) as AsyncResult.AsyncResult<\n McpStoredSourceSchemaType | null,\n unknown\n >;\n const source =\n AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;\n const sourceScope = source ? ScopeId.make(source.scope) : scopeId;\n const bindingsResult = useAtomValue(mcpSourceBindingsAtom(userScope, sourceId, sourceScope));\n\n if (!AsyncResult.isSuccess(sourceResult) || !source || !AsyncResult.isSuccess(bindingsResult)) {\n return (\n <div className=\"space-y-6\">\n <div>\n <h1 className=\"text-xl font-semibold text-foreground\">Edit MCP Source</h1>\n <p className=\"mt-1 text-sm text-muted-foreground\">Loading configuration…</p>\n </div>\n </div>\n );\n }\n\n if (source.config.transport === \"stdio\") {\n return (\n <StdioReadOnly\n sourceId={sourceId}\n initial={source as McpStoredSourceSchemaType & { config: { transport: \"stdio\" } }}\n onSave={onSave}\n />\n );\n }\n\n return (\n <RemoteEditForm\n sourceId={sourceId}\n initial={source as McpStoredSourceSchemaType & { config: { transport: \"remote\" } }}\n bindings={bindingsResult.value}\n onSave={onSave}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,SAAS,gBAAgB;AAClC,SAAS,cAAc,kBAAkB;AACzC,YAAY,iBAAiB;AAC7B,YAAY,UAAU;AAEtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,oBAAoB;AACvC,SAAS,qBAAqB,uBAAuB;AACrD,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,gCAAgC;AACzC,SAAS,8BAA8B;AACvC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa;AACtB,SAAoC,eAAe;AACnD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAyGD,SACE,KADF;AAjGN,SAAS,e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|
|
4
|
-
} from "./chunk-FMTVLO5L.js";
|
|
5
|
-
import "./chunk-6OYEXHU3.js";
|
|
6
|
-
|
|
7
|
-
// src/react/McpSourceSummary.tsx
|
|
8
|
-
import { useAtomValue as useAtomValue2 } from "@effect/atom-react";
|
|
9
|
-
import * as AsyncResult2 from "effect/unstable/reactivity/AsyncResult";
|
|
10
|
-
import { connectionsAtom as connectionsAtom2 } from "@executor-js/react/api/atoms";
|
|
11
|
-
import { useScope as useScope2, useScopeStack, useUserScope as useUserScope2 } from "@executor-js/react/api/scope-context";
|
|
12
|
-
import { Button } from "@executor-js/react/components/button";
|
|
13
|
-
import {
|
|
14
|
-
SourceCredentialNotice,
|
|
15
|
-
SourceCredentialStatusBadge,
|
|
16
|
-
missingSourceCredentialLabels
|
|
17
|
-
} from "@executor-js/react/plugins/source-credential-status";
|
|
18
|
-
import { ScopeId as ScopeId2 } from "@executor-js/sdk/shared";
|
|
19
|
-
|
|
20
|
-
// src/react/McpSignInButton.tsx
|
|
21
|
-
import { useAtomSet, useAtomValue } from "@effect/atom-react";
|
|
22
|
-
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
23
|
-
import { ScopeId } from "@executor-js/sdk/shared";
|
|
24
|
-
import { useScope, useUserScope } from "@executor-js/react/api/scope-context";
|
|
25
|
-
import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys";
|
|
26
|
-
import { connectionsAtom, setSourceCredentialBinding } from "@executor-js/react/api/atoms";
|
|
27
|
-
import { SourceOAuthSignInButton } from "@executor-js/react/plugins/oauth-sign-in";
|
|
28
|
-
import { slugifyNamespace } from "@executor-js/react/plugins/source-identity";
|
|
29
|
-
import { secretBackedValuesFromConfiguredCredentialBindings } from "@executor-js/react/plugins/credential-bindings";
|
|
30
|
-
import { jsx } from "react/jsx-runtime";
|
|
31
|
-
function McpSignInButton(props) {
|
|
32
|
-
const scopeId = useScope();
|
|
33
|
-
const userScopeId = useUserScope();
|
|
34
|
-
const sourceResult = useAtomValue(
|
|
35
|
-
mcpSourceAtom(scopeId, props.sourceId)
|
|
36
|
-
);
|
|
37
|
-
const source = AsyncResult.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;
|
|
38
|
-
const sourceScope = source ? ScopeId.make(source.scope) : scopeId;
|
|
39
|
-
const bindingsResult = useAtomValue(
|
|
40
|
-
mcpSourceBindingsAtom(userScopeId, props.sourceId, sourceScope)
|
|
41
|
-
);
|
|
42
|
-
const connectionsResult = useAtomValue(connectionsAtom(userScopeId));
|
|
43
|
-
const setBinding = useAtomSet(setSourceCredentialBinding, { mode: "promise" });
|
|
44
|
-
const remote = source && source.config.transport === "remote" ? source.config : null;
|
|
45
|
-
const oauth2 = remote && remote.auth.kind === "oauth2" ? remote.auth : null;
|
|
46
|
-
const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : null;
|
|
47
|
-
const bindings = AsyncResult.isSuccess(bindingsResult) ? bindingsResult.value : null;
|
|
48
|
-
const connectionBinding = bindings?.find(
|
|
49
|
-
(binding) => binding.slotKey === oauth2?.connectionSlot && binding.value.kind === "connection"
|
|
50
|
-
);
|
|
51
|
-
const connectionId = connectionBinding?.value.kind === "connection" ? connectionBinding.value.connectionId : null;
|
|
52
|
-
const isConnected = oauth2 !== null && connections !== null && connectionId !== null && connections.some((c) => c.id === connectionId);
|
|
53
|
-
if (!remote || !oauth2 || !source) return null;
|
|
54
|
-
const namespaceSlug = slugifyNamespace(source.namespace) || "mcp";
|
|
55
|
-
return /* @__PURE__ */ jsx(
|
|
56
|
-
SourceOAuthSignInButton,
|
|
57
|
-
{
|
|
58
|
-
popupName: "mcp-oauth",
|
|
59
|
-
pluginId: "mcp",
|
|
60
|
-
namespace: namespaceSlug,
|
|
61
|
-
fallbackNamespace: "mcp",
|
|
62
|
-
endpoint: remote.endpoint,
|
|
63
|
-
tokenScope: userScopeId,
|
|
64
|
-
connectionId,
|
|
65
|
-
sourceLabel: `${source.name.trim() || source.namespace || "MCP"} OAuth`,
|
|
66
|
-
headers: secretBackedValuesFromConfiguredCredentialBindings(remote.headers, bindings ?? []),
|
|
67
|
-
queryParams: secretBackedValuesFromConfiguredCredentialBindings(
|
|
68
|
-
remote.queryParams,
|
|
69
|
-
bindings ?? []
|
|
70
|
-
),
|
|
71
|
-
isConnected,
|
|
72
|
-
detectPopupClosed: false,
|
|
73
|
-
onConnected: async (nextConnectionId) => {
|
|
74
|
-
await setBinding({
|
|
75
|
-
params: { scopeId: userScopeId },
|
|
76
|
-
payload: {
|
|
77
|
-
scope: userScopeId,
|
|
78
|
-
source: { id: props.sourceId, scope: sourceScope },
|
|
79
|
-
slotKey: oauth2.connectionSlot,
|
|
80
|
-
value: { kind: "connection", connectionId: nextConnectionId }
|
|
81
|
-
},
|
|
82
|
-
reactivityKeys: [...sourceWriteKeys, ...connectionWriteKeys]
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
|
-
reconnectingLabel: "Reconnecting\u2026",
|
|
86
|
-
signingInLabel: "Signing in\u2026"
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// src/react/McpSourceSummary.tsx
|
|
92
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
93
|
-
var sourceCredentialSlots = (source) => {
|
|
94
|
-
if (source.config.transport !== "remote") return [];
|
|
95
|
-
const slots = [];
|
|
96
|
-
for (const [name, value] of Object.entries(source.config.headers ?? {})) {
|
|
97
|
-
if (typeof value !== "string") slots.push({ kind: "secret", slot: value.slot, label: name });
|
|
98
|
-
}
|
|
99
|
-
for (const [name, value] of Object.entries(source.config.queryParams ?? {})) {
|
|
100
|
-
if (typeof value !== "string") slots.push({ kind: "secret", slot: value.slot, label: name });
|
|
101
|
-
}
|
|
102
|
-
const auth = source.config.auth;
|
|
103
|
-
if (auth.kind === "header") {
|
|
104
|
-
slots.push({
|
|
105
|
-
kind: "secret",
|
|
106
|
-
slot: auth.secretSlot,
|
|
107
|
-
label: auth.headerName
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (auth.kind === "oauth2") {
|
|
111
|
-
if (auth.clientIdSlot) {
|
|
112
|
-
slots.push({ kind: "secret", slot: auth.clientIdSlot, label: "Client ID" });
|
|
113
|
-
}
|
|
114
|
-
if (auth.clientSecretSlot) {
|
|
115
|
-
slots.push({ kind: "secret", slot: auth.clientSecretSlot, label: "Client Secret" });
|
|
116
|
-
}
|
|
117
|
-
slots.push({
|
|
118
|
-
kind: "connection",
|
|
119
|
-
slot: auth.connectionSlot,
|
|
120
|
-
label: "OAuth sign-in"
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return slots;
|
|
124
|
-
};
|
|
125
|
-
function McpSourceSummary(props) {
|
|
126
|
-
const displayScope = useScope2();
|
|
127
|
-
const userScope = useUserScope2();
|
|
128
|
-
const scopeStack = useScopeStack();
|
|
129
|
-
const sourceResult = useAtomValue2(mcpSourceAtom(displayScope, props.sourceId));
|
|
130
|
-
const source = AsyncResult2.isSuccess(sourceResult) && sourceResult.value ? sourceResult.value : null;
|
|
131
|
-
const sourceScope = source ? ScopeId2.make(source.scope) : displayScope;
|
|
132
|
-
const bindingsResult = useAtomValue2(
|
|
133
|
-
mcpSourceBindingsAtom(userScope, props.sourceId, sourceScope)
|
|
134
|
-
);
|
|
135
|
-
const connectionsResult = useAtomValue2(connectionsAtom2(userScope));
|
|
136
|
-
if (!source) return null;
|
|
137
|
-
const slots = sourceCredentialSlots(source);
|
|
138
|
-
if (slots.length === 0) return null;
|
|
139
|
-
if (!AsyncResult2.isSuccess(bindingsResult) || !AsyncResult2.isSuccess(connectionsResult)) {
|
|
140
|
-
return props.variant === "panel" ? null : /* @__PURE__ */ jsx2(SourceCredentialStatusBadge, { missing: ["credentials"] });
|
|
141
|
-
}
|
|
142
|
-
const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index]));
|
|
143
|
-
const liveConnectionIds = new Set(connectionsResult.value.map((connection) => connection.id));
|
|
144
|
-
const missing = missingSourceCredentialLabels({
|
|
145
|
-
slots,
|
|
146
|
-
bindings: bindingsResult.value,
|
|
147
|
-
targetScope: userScope,
|
|
148
|
-
scopeRanks,
|
|
149
|
-
liveConnectionIds
|
|
150
|
-
});
|
|
151
|
-
if (props.variant === "panel") {
|
|
152
|
-
const needsOAuth = missing.includes("OAuth sign-in");
|
|
153
|
-
const needsConfiguration = missing.some((label) => label !== "OAuth sign-in");
|
|
154
|
-
return /* @__PURE__ */ jsx2(
|
|
155
|
-
SourceCredentialNotice,
|
|
156
|
-
{
|
|
157
|
-
missing,
|
|
158
|
-
action: /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
159
|
-
needsOAuth && /* @__PURE__ */ jsx2(McpSignInButton, { sourceId: props.sourceId }),
|
|
160
|
-
needsConfiguration && props.onAction && /* @__PURE__ */ jsx2(Button, { type: "button", size: "sm", variant: "outline", onClick: props.onAction, children: "Configure" })
|
|
161
|
-
] })
|
|
162
|
-
}
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
return /* @__PURE__ */ jsx2(SourceCredentialStatusBadge, { missing });
|
|
166
|
-
}
|
|
167
|
-
export {
|
|
168
|
-
McpSourceSummary as default
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=McpSourceSummary-LE3WXFUE.js.map
|