@executor-js/plugin-mcp 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/{AddMcpSource-4LLERUW5.js → AddMcpSource-ZDNQ7F6I.js} +70 -97
  2. package/dist/AddMcpSource-ZDNQ7F6I.js.map +1 -0
  3. package/dist/EditMcpSource-75NJRWZR.js +178 -0
  4. package/dist/EditMcpSource-75NJRWZR.js.map +1 -0
  5. package/dist/McpAccountsPanel-QBCSCJE7.js +83 -0
  6. package/dist/McpAccountsPanel-QBCSCJE7.js.map +1 -0
  7. package/dist/api/group.d.ts +106 -15
  8. package/dist/api/index.d.ts +121 -15
  9. package/dist/{chunk-N4EAF5CA.js → chunk-3AOD4VAW.js} +74 -5
  10. package/dist/chunk-3AOD4VAW.js.map +1 -0
  11. package/dist/{chunk-6OEQZ72N.js → chunk-3H5Y7JCQ.js} +65 -11
  12. package/dist/chunk-3H5Y7JCQ.js.map +1 -0
  13. package/dist/{chunk-HSJWIVME.js → chunk-6BJ6MZF7.js} +110 -52
  14. package/dist/chunk-6BJ6MZF7.js.map +1 -0
  15. package/dist/client.js +3 -3
  16. package/dist/core.js +152 -5
  17. package/dist/core.js.map +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/react/atoms.d.ts +128 -26
  20. package/dist/react/auth-method-config.d.ts +22 -7
  21. package/dist/react/client.d.ts +103 -15
  22. package/dist/sdk/connection.d.ts +1 -1
  23. package/dist/sdk/index.d.ts +3 -1
  24. package/dist/sdk/invoke.d.ts +1 -1
  25. package/dist/sdk/migrate-config.d.ts +6 -0
  26. package/dist/sdk/migrate-config.test.d.ts +1 -0
  27. package/dist/sdk/multi-placement-auth.test.d.ts +1 -0
  28. package/dist/sdk/plugin.d.ts +92 -5
  29. package/dist/sdk/types.d.ts +105 -15
  30. package/package.json +4 -4
  31. package/dist/AddMcpSource-4LLERUW5.js.map +0 -1
  32. package/dist/EditMcpSource-GKJRP75X.js +0 -313
  33. package/dist/EditMcpSource-GKJRP75X.js.map +0 -1
  34. package/dist/McpAccountsPanel-UX7MHEIG.js +0 -132
  35. package/dist/McpAccountsPanel-UX7MHEIG.js.map +0 -1
  36. package/dist/chunk-6OEQZ72N.js.map +0 -1
  37. package/dist/chunk-7FJ3PUUL.js +0 -21
  38. package/dist/chunk-7FJ3PUUL.js.map +0 -1
  39. package/dist/chunk-HSJWIVME.js.map +0 -1
  40. package/dist/chunk-N4EAF5CA.js.map +0 -1
@@ -1,10 +1,38 @@
1
1
  import { Schema } from "effect";
2
+ import { ApiKeyAuthMethod, ApiKeyAuthTemplate } from "@executor-js/sdk/http-auth";
2
3
  export declare const McpRemoteTransport: Schema.Literals<readonly ["streamable-http", "sse", "auto"]>;
3
4
  export type McpRemoteTransport = typeof McpRemoteTransport.Type;
4
5
  /** All transport types (used in the connector layer) */
5
6
  export declare const McpTransport: Schema.Literals<readonly ["streamable-http", "sse", "stdio", "auto"]>;
6
7
  export type McpTransport = typeof McpTransport.Type;
7
- export declare const McpAuthTemplate: Schema.Union<readonly [Schema.Struct<{
8
+ export declare const McpOAuthMethod: Schema.Struct<{
9
+ readonly slug: Schema.String;
10
+ readonly kind: Schema.Literal<"oauth2">;
11
+ }>;
12
+ export type McpOAuthMethod = typeof McpOAuthMethod.Type;
13
+ export declare const McpAuthMethod: Schema.Union<readonly [Schema.Struct<{
14
+ readonly slug: Schema.String;
15
+ readonly kind: Schema.Literal<"none">;
16
+ }>, Schema.Struct<{
17
+ readonly slug: Schema.String;
18
+ readonly kind: Schema.Literal<"apikey">;
19
+ readonly label: Schema.optional<Schema.String>;
20
+ readonly placements: Schema.$Array<Schema.Struct<{
21
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
22
+ readonly name: Schema.String;
23
+ readonly prefix: Schema.optional<Schema.String>;
24
+ readonly variable: Schema.optional<Schema.String>;
25
+ readonly literal: Schema.optional<Schema.String>;
26
+ }>>;
27
+ }>, Schema.Struct<{
28
+ readonly slug: Schema.String;
29
+ readonly kind: Schema.Literal<"oauth2">;
30
+ }>]>;
31
+ export type McpAuthMethod = typeof McpAuthMethod.Type;
32
+ /** Single-method `auth` shorthand on `addServer` — agent convenience for the
33
+ * common cases. Normalized into `authenticationTemplate` at the boundary;
34
+ * never stored. */
35
+ export declare const McpAuthShorthand: Schema.Union<readonly [Schema.Struct<{
8
36
  readonly kind: Schema.Literal<"none">;
9
37
  }>, Schema.Struct<{
10
38
  readonly kind: Schema.Literal<"header">;
@@ -13,7 +41,47 @@ export declare const McpAuthTemplate: Schema.Union<readonly [Schema.Struct<{
13
41
  }>, Schema.Struct<{
14
42
  readonly kind: Schema.Literal<"oauth2">;
15
43
  }>]>;
16
- export type McpAuthTemplate = typeof McpAuthTemplate.Type;
44
+ export type McpAuthShorthand = typeof McpAuthShorthand.Type;
45
+ /** Expand the `auth` shorthand into a declared method. Slugs match what the
46
+ * shorthand has always produced (`none` / `header` / `oauth2`) so existing
47
+ * connections bound to them keep matching. */
48
+ export declare const mcpAuthMethodFromShorthand: (auth: McpAuthShorthand) => McpAuthMethod;
49
+ /** Input variant of `McpAuthMethod` — callers (UI, agents) may omit the slug;
50
+ * `normalizeMcpAuthMethods` backfills it. */
51
+ export declare const McpAuthMethodInput: Schema.Union<readonly [Schema.Struct<{
52
+ readonly slug: Schema.optional<Schema.String>;
53
+ readonly kind: Schema.Literal<"none">;
54
+ }>, Schema.Struct<{
55
+ readonly slug: Schema.optional<Schema.String>;
56
+ readonly kind: Schema.Literal<"oauth2">;
57
+ }>, Schema.Struct<{
58
+ readonly slug: Schema.optional<Schema.String>;
59
+ readonly type: Schema.Literal<"apiKey">;
60
+ readonly label: Schema.optional<Schema.String>;
61
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
62
+ readonly type: Schema.Literal<"variable">;
63
+ readonly name: Schema.String;
64
+ }>]>>]>>>;
65
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
66
+ readonly type: Schema.Literal<"variable">;
67
+ readonly name: Schema.String;
68
+ }>]>>]>>>;
69
+ }>]>;
70
+ export type McpAuthMethodInput = typeof McpAuthMethodInput.Type;
71
+ /** The expansion target: input arms with the dialect resolved to canonical
72
+ * placements (slug still optional — backfill is a separate pass). */
73
+ export type McpCanonicalAuthMethodInput = Exclude<McpAuthMethodInput, ApiKeyAuthTemplate> | (Omit<ApiKeyAuthMethod, "slug"> & {
74
+ readonly slug?: string;
75
+ });
76
+ /** Expand request-shaped dialect entries into canonical placements; canonical
77
+ * entries pass through. Slug backfill is the caller's concern
78
+ * (`normalizeMcpAuthMethods` for declare flows, `mergeAuthTemplates` for the
79
+ * custom-method merge). */
80
+ export declare const expandMcpAuthMethodInputs: (methods: readonly McpAuthMethodInput[]) => readonly McpCanonicalAuthMethodInput[];
81
+ /** Assign each method a stable slug: a caller-provided one wins, otherwise a
82
+ * kind/carrier-derived default, suffixed `_2`, `_3`, … on collision. The
83
+ * request-shaped dialect is expanded to canonical placements first. */
84
+ export declare const normalizeMcpAuthMethods: (methods: readonly McpAuthMethodInput[]) => readonly McpAuthMethod[];
17
85
  export declare const McpRemoteIntegrationConfig: Schema.Struct<{
18
86
  readonly transport: Schema.Literal<"remote">;
19
87
  /** The MCP server endpoint URL */
@@ -24,16 +92,26 @@ export declare const McpRemoteIntegrationConfig: Schema.Struct<{
24
92
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
25
93
  /** Static headers sent on every request (non-credential) */
26
94
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
27
- /** Auth template — how the connection's value is rendered onto requests */
28
- readonly auth: Schema.Union<readonly [Schema.Struct<{
95
+ /** Declared auth methods — how a connection's values are rendered onto
96
+ * requests. A connection's `template` picks one by slug. */
97
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
98
+ readonly slug: Schema.String;
29
99
  readonly kind: Schema.Literal<"none">;
30
100
  }>, Schema.Struct<{
31
- readonly kind: Schema.Literal<"header">;
32
- readonly headerName: Schema.String;
33
- readonly prefix: Schema.optional<Schema.String>;
101
+ readonly slug: Schema.String;
102
+ readonly kind: Schema.Literal<"apikey">;
103
+ readonly label: Schema.optional<Schema.String>;
104
+ readonly placements: Schema.$Array<Schema.Struct<{
105
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
106
+ readonly name: Schema.String;
107
+ readonly prefix: Schema.optional<Schema.String>;
108
+ readonly variable: Schema.optional<Schema.String>;
109
+ readonly literal: Schema.optional<Schema.String>;
110
+ }>>;
34
111
  }>, Schema.Struct<{
112
+ readonly slug: Schema.String;
35
113
  readonly kind: Schema.Literal<"oauth2">;
36
- }>]>;
114
+ }>]>>;
37
115
  }>;
38
116
  export type McpRemoteIntegrationConfig = typeof McpRemoteIntegrationConfig.Type;
39
117
  export declare const McpStdioIntegrationConfig: Schema.Struct<{
@@ -58,16 +136,26 @@ export declare const McpIntegrationConfig: Schema.Union<readonly [Schema.Struct<
58
136
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
59
137
  /** Static headers sent on every request (non-credential) */
60
138
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
61
- /** Auth template — how the connection's value is rendered onto requests */
62
- readonly auth: Schema.Union<readonly [Schema.Struct<{
139
+ /** Declared auth methods — how a connection's values are rendered onto
140
+ * requests. A connection's `template` picks one by slug. */
141
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
142
+ readonly slug: Schema.String;
63
143
  readonly kind: Schema.Literal<"none">;
64
144
  }>, Schema.Struct<{
65
- readonly kind: Schema.Literal<"header">;
66
- readonly headerName: Schema.String;
67
- readonly prefix: Schema.optional<Schema.String>;
145
+ readonly slug: Schema.String;
146
+ readonly kind: Schema.Literal<"apikey">;
147
+ readonly label: Schema.optional<Schema.String>;
148
+ readonly placements: Schema.$Array<Schema.Struct<{
149
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
150
+ readonly name: Schema.String;
151
+ readonly prefix: Schema.optional<Schema.String>;
152
+ readonly variable: Schema.optional<Schema.String>;
153
+ readonly literal: Schema.optional<Schema.String>;
154
+ }>>;
68
155
  }>, Schema.Struct<{
156
+ readonly slug: Schema.String;
69
157
  readonly kind: Schema.Literal<"oauth2">;
70
- }>]>;
158
+ }>]>>;
71
159
  }>, Schema.Struct<{
72
160
  readonly transport: Schema.Literal<"stdio">;
73
161
  /** The command to run */
@@ -81,7 +169,9 @@ export declare const McpIntegrationConfig: Schema.Union<readonly [Schema.Struct<
81
169
  }>]>;
82
170
  export type McpIntegrationConfig = typeof McpIntegrationConfig.Type;
83
171
  /** Parse an opaque integration `config` blob into a typed MCP config, or null
84
- * if it isn't this plugin's shape. */
172
+ * if it isn't this plugin's (canonical) shape. Pre-canonical stored shapes
173
+ * are rewritten by the one-off config migration (`migrate-config.ts`), not
174
+ * decoded here — runtime code knows only the canonical model. */
85
175
  export declare const parseMcpIntegrationConfig: (config: unknown) => McpIntegrationConfig | null;
86
176
  export declare const McpToolAnnotations: Schema.Struct<{
87
177
  readonly title: Schema.optional<Schema.String>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@executor-js/plugin-mcp",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/plugins/mcp",
5
5
  "bugs": {
6
6
  "url": "https://github.com/RhysSullivan/executor/issues"
@@ -54,10 +54,10 @@
54
54
  "dependencies": {
55
55
  "@cfworker/json-schema": "^4.1.1",
56
56
  "@effect/platform-node": "4.0.0-beta.59",
57
- "@executor-js/config": "1.5.6",
58
- "@executor-js/sdk": "1.5.6",
57
+ "@executor-js/config": "1.5.8",
58
+ "@executor-js/sdk": "1.5.8",
59
59
  "@modelcontextprotocol/sdk": "^1.29.0",
60
- "zod": "^4.3.6"
60
+ "zod": "4.3.6"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@effect/atom-react": "4.0.0-beta.59",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/react/AddMcpSource.tsx","../src/react/McpRemoteSourceFields.tsx"],"sourcesContent":["import { useReducer, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport { Link } from \"@tanstack/react-router\";\nimport * as Exit from \"effect/Exit\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Schema from \"effect/Schema\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\n\nimport { integrationsOptimisticAtom } from \"@executor-js/react/api/atoms\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n AuthTemplateEditor,\n type AuthTemplateEditorKind,\n type AuthTemplateEditorValue,\n} from \"@executor-js/react/components/auth-template-editor\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntryField,\n} from \"@executor-js/react/components/card-stack\";\nimport { FieldLabel } from \"@executor-js/react/components/field\";\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 integrationDisplayNameFromUrl,\n slugifyNamespace,\n IntegrationIdentityFields,\n useIntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\n\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\nimport { probeMcpEndpoint, addMcpServer } from \"./atoms\";\nimport { McpRemoteSourceFields } from \"./McpRemoteSourceFields\";\nimport { mcpAuthTemplateFromEditorValue } from \"./auth-method-config\";\nimport { mcpPresets, type McpPreset } from \"../sdk/presets\";\n\n// Post-redesign the remote add flow only REGISTERS the auth template through the\n// shared `AuthTemplateEditor` — accounts (the API key value / OAuth sign-in) are\n// added later from the integration's detail hub (P6: add without auth, connect\n// later). An OAuth-only server (DCR-capable) is constrained to the OAuth tab.\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\nconst isIntegrationAlreadyExistsExit = (exit: Exit.Exit<unknown, unknown>): boolean =>\n Option.match(Exit.findErrorOption(exit), {\n onNone: () => false,\n onSome: Predicate.isTagged(\"IntegrationAlreadyExistsError\"),\n });\n\nconst integrationExistsMessage = (slug: string): string =>\n `An integration named \"${slug}\" already exists. To add more authentication, update your existing integration.`;\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 ProbeResult = {\n connected: boolean;\n requiresAuthentication: boolean;\n requiresOAuth: boolean;\n supportsDynamicRegistration: boolean;\n name: string;\n slug: 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: \"adding\"; url: string; probe: ProbeResult }\n | {\n step: \"error\";\n url: string;\n probe: ProbeResult | 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: \"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 error: a.error,\n }),\n ),\n Match.discriminator(\"type\")(\"add-start\", (): State => {\n const probe = \"probe\" in state ? state.probe : null;\n if (!probe) return state;\n return { step: \"adding\", url: state.url, probe };\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 error: a.error,\n };\n }),\n Match.discriminator(\"type\")(\"retry\", (): State => {\n if (state.step !== \"error\") return state;\n return state.probe\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: (slug?: string) => 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 = useIntegrationIdentity({\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 doProbe = useAtomSet(probeMcpEndpoint, { mode: \"promiseExit\" });\n const doAddServer = useAtomSet(addMcpServer, { mode: \"promiseExit\" });\n\n const [authValue, setAuthValue] = useState<AuthTemplateEditorValue>({ kind: \"none\" });\n\n const probe = \"probe\" in state ? state.probe : null;\n\n // OAuth-only servers (DCR-capable) constrain the editor to the OAuth tab; all\n // other servers offer none / API key / OAuth (matching the prior tab set).\n const allowedAuthKinds: readonly AuthTemplateEditorKind[] =\n probe?.requiresOAuth && probe.supportsDynamicRegistration\n ? [\"oauth\"]\n : probe?.requiresAuthentication\n ? [\"apikey\", \"oauth\"]\n : [\"none\", \"apikey\", \"oauth\"];\n\n const remoteIdentity = useIntegrationIdentity({\n fallbackName:\n integrationDisplayNameFromUrl(state.url, \"MCP\") ?? probe?.serverName ?? probe?.name ?? \"\",\n });\n const isProbing = state.step === \"probing\";\n const isAdding = state.step === \"adding\";\n\n // Pre-empt the API's `IntegrationAlreadyExistsError`: adding an integration\n // whose slug already exists clobbers the existing one's connections/policies,\n // so the API blocks it. Surface that here from the tenant-scoped catalog list.\n // A blank derived namespace lets the server assign the slug, so only flag a\n // collision when the user-derived slug is non-empty.\n const integrationsResult = useAtomValue(integrationsOptimisticAtom);\n const existingSlugs = useMemo(\n () =>\n AsyncResult.isSuccess(integrationsResult)\n ? integrationsResult.value.map((integration) => String(integration.slug))\n : [],\n [integrationsResult],\n );\n const remoteSlug = slugifyNamespace(remoteIdentity.namespace);\n const stdioSlug = slugifyNamespace(stdioIdentity.namespace);\n const remoteSlugExists = remoteSlug.length > 0 && existingSlugs.includes(remoteSlug);\n const stdioSlugExists = stdioSlug.length > 0 && existingSlugs.includes(stdioSlug);\n\n const canAdd = Boolean(probe) && !isAdding && !remoteSlugExists;\n // Probe failures are shown inline on the URL field; other failures\n // (add server) 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 exit = await doProbe({\n payload: { endpoint: state.url.trim() },\n });\n if (Exit.isFailure(exit)) {\n dispatch({\n type: \"probe-fail\",\n error: errorMessageFromExit(exit, \"Failed to connect\"),\n });\n return;\n }\n setAuthValue(\n exit.value.requiresOAuth\n ? { kind: \"oauth\", authorizationUrl: \"\", tokenUrl: \"\", scopes: [] }\n : exit.value.requiresAuthentication\n ? {\n kind: \"apikey\",\n placements: [{ carrier: \"header\", name: \"Authorization\", prefix: \"Bearer \" }],\n }\n : { kind: \"none\" },\n );\n dispatch({ type: \"probe-ok\", probe: exit.value });\n }, [state.url, doProbe]);\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 // Register the integration with the chosen auth template, returning the\n // assigned slug (or null on failure — an error is dispatched in that case).\n const registerIntegration = useCallback(\n async (\n auth:\n | { kind: \"none\" }\n | { kind: \"header\"; headerName: string; prefix?: string }\n | { kind: \"oauth2\" },\n ): Promise<string | null> => {\n const displayName = remoteIdentity.name.trim() || probe?.serverName || probe?.name || \"MCP\";\n const slug = slugifyNamespace(remoteIdentity.namespace) || undefined;\n const exit = await doAddServer({\n payload: {\n transport: \"remote\" as const,\n name: displayName,\n endpoint: state.url.trim(),\n ...(slug ? { slug } : {}),\n auth,\n },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n dispatch({\n type: \"add-fail\",\n error: isIntegrationAlreadyExistsExit(exit)\n ? integrationExistsMessage(slug ?? displayName)\n : errorMessageFromExit(exit, \"Failed to add server\"),\n });\n return null;\n }\n return exit.value.slug;\n },\n [doAddServer, probe, remoteIdentity, state.url],\n );\n\n const handleAddRemote = useCallback(async () => {\n if (!probe) return;\n dispatch({ type: \"add-start\" });\n const slug = await registerIntegration(mcpAuthTemplateFromEditorValue(authValue));\n if (slug === null) return;\n props.onComplete(slug);\n }, [probe, authValue, registerIntegration, props]);\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 slug = slugifyNamespace(stdioIdentity.namespace) || undefined;\n const exit = await doAddServer({\n payload: {\n transport: \"stdio\" as const,\n name: displayName,\n ...(slug ? { slug } : {}),\n command: cmd,\n args: parseStdioArgs(stdioArgs),\n env: parseStdioEnv(stdioEnv),\n },\n reactivityKeys: integrationWriteKeys,\n });\n if (Exit.isFailure(exit)) {\n setStdioError(\n isIntegrationAlreadyExistsExit(exit)\n ? integrationExistsMessage(slug ?? displayName)\n : errorMessageFromExit(exit, \"Failed to add server\"),\n );\n setStdioAdding(false);\n return;\n }\n props.onComplete(exit.value.slug);\n }, [stdioCommand, stdioArgs, stdioEnv, stdioIdentity, doAddServer, 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 {/* Authentication — declares the auth template to register through the\n shared editor. The credential itself (API key value / OAuth sign-in)\n is added from the integration's detail hub after adding. */}\n {probe && (\n <section className=\"space-y-2.5\">\n <FieldLabel>How does this server authenticate?</FieldLabel>\n <AuthTemplateEditor\n value={authValue}\n onChange={setAuthValue}\n allowedKinds={allowedAuthKinds}\n oauthMetadata=\"discovered\"\n />\n </section>\n )}\n\n {/* Error (add server). 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 {remoteSlugExists && !isAdding && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">\n An integration named &quot;{remoteSlug}&quot; already exists. To add more\n authentication, update your existing integration.{\" \"}\n <Link\n to=\"/integrations/$namespace\"\n params={{ namespace: remoteSlug }}\n className=\"font-medium underline underline-offset-2\"\n >\n Open it\n </Link>\n </p>\n </div>\n )}\n\n <FloatActions>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.onCancel()}\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 <IntegrationIdentityFields 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 {stdioSlugExists && !stdioAdding && (\n <div className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive\">\n An integration named &quot;{stdioSlug}&quot; already exists. To add more\n authentication, update your existing integration.{\" \"}\n <Link\n to=\"/integrations/$namespace\"\n params={{ namespace: stdioSlug }}\n className=\"font-medium underline underline-offset-2\"\n >\n Open it\n </Link>\n </p>\n </div>\n )}\n\n <FloatActions>\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.onCancel()}\n disabled={stdioAdding}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n onClick={handleAddStdio}\n disabled={!stdioCommand.trim() || stdioAdding || stdioSlugExists}\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","import { Badge } from \"@executor-js/react/components/badge\";\nimport {\n CardStack,\n CardStackContent,\n CardStackEntry,\n CardStackEntryActions,\n CardStackEntryContent,\n CardStackEntryDescription,\n CardStackEntryField,\n CardStackEntryMedia,\n CardStackEntryTitle,\n} from \"@executor-js/react/components/card-stack\";\nimport { FieldError } from \"@executor-js/react/components/field\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { Skeleton } from \"@executor-js/react/components/skeleton\";\nimport { IntegrationFavicon } from \"@executor-js/react/components/integration-favicon\";\nimport { IOSSpinner } from \"@executor-js/react/components/spinner\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport {\n IntegrationIdentityFieldRows,\n type IntegrationIdentity,\n} from \"@executor-js/react/plugins/integration-identity\";\n\nexport type McpRemoteSourcePreview = {\n readonly name: string;\n readonly serverName: string | null;\n readonly connected: boolean;\n readonly requiresAuthentication: boolean;\n readonly requiresOAuth: boolean;\n readonly toolCount: number | null;\n};\n\nexport function McpRemoteSourceFields(props: {\n readonly url: string;\n readonly onUrlChange: (url: string) => void;\n readonly identity: IntegrationIdentity;\n readonly preview: McpRemoteSourcePreview | null;\n readonly probing?: boolean;\n readonly error?: string | null;\n readonly onRetry?: () => void;\n readonly namespaceReadOnly?: boolean;\n readonly urlDisabled?: boolean;\n}) {\n const previewDescription = props.preview\n ? props.preview.connected\n ? props.preview.toolCount === null\n ? null\n : `${props.preview.toolCount} tool${props.preview.toolCount !== 1 ? \"s\" : \"\"} available`\n : props.preview.requiresOAuth\n ? \"OAuth required to discover tools\"\n : props.preview.requiresAuthentication\n ? \"Authentication required to discover tools\"\n : \"Ready to add\"\n : null;\n\n if (props.preview) {\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntry>\n <CardStackEntryMedia>\n <IntegrationFavicon url={props.url} size={32} />\n </CardStackEntryMedia>\n <CardStackEntryContent>\n <CardStackEntryTitle>\n {props.preview.serverName ?? props.preview.name}\n </CardStackEntryTitle>\n {previewDescription ? (\n <CardStackEntryDescription>{previewDescription}</CardStackEntryDescription>\n ) : null}\n </CardStackEntryContent>\n <CardStackEntryActions>\n {props.preview.connected ? (\n <Badge\n variant=\"outline\"\n className=\"border-emerald-500/20 bg-emerald-500/10 text-[10px] text-emerald-600 dark:text-emerald-400\"\n >\n Connected\n </Badge>\n ) : props.preview.requiresOAuth ? (\n <Badge\n variant=\"outline\"\n className=\"border-amber-500/20 bg-amber-500/10 text-[10px] text-amber-600 dark:text-amber-400\"\n >\n OAuth required\n </Badge>\n ) : (\n <Badge\n variant=\"outline\"\n className=\"border-amber-500/20 bg-amber-500/10 text-[10px] text-amber-600 dark:text-amber-400\"\n >\n Auth required\n </Badge>\n )}\n </CardStackEntryActions>\n </CardStackEntry>\n <IntegrationIdentityFieldRows\n identity={props.identity}\n namePlaceholder=\"e.g. Linear\"\n namespaceReadOnly={props.namespaceReadOnly}\n />\n <CardStackEntryField label=\"Server URL\">\n <Input\n value={props.url}\n onChange={(e) => props.onUrlChange((e.target as HTMLInputElement).value)}\n placeholder=\"https://mcp.example.com\"\n className=\"w-full font-mono text-sm\"\n disabled={props.urlDisabled}\n />\n </CardStackEntryField>\n </CardStackContent>\n </CardStack>\n );\n }\n\n if (props.probing) {\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntry>\n <CardStackEntryMedia>\n <Skeleton className=\"size-4 rounded\" />\n </CardStackEntryMedia>\n <CardStackEntryContent>\n <Skeleton className=\"h-4 w-40\" />\n <Skeleton className=\"mt-1 h-3 w-32\" />\n </CardStackEntryContent>\n <CardStackEntryActions>\n <Skeleton className=\"h-4 w-20 rounded-full\" />\n </CardStackEntryActions>\n </CardStackEntry>\n </CardStackContent>\n </CardStack>\n );\n }\n\n return (\n <CardStack>\n <CardStackContent className=\"border-t-0\">\n <CardStackEntryField label=\"Server URL\">\n <div className=\"relative\">\n <Input\n value={props.url}\n onChange={(e) => props.onUrlChange((e.target as HTMLInputElement).value)}\n placeholder=\"https://mcp.example.com\"\n className=\"w-full pr-9 font-mono text-sm\"\n aria-invalid={props.error ? true : undefined}\n disabled={props.urlDisabled}\n />\n {props.probing && (\n <div className=\"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2\">\n <IOSSpinner className=\"size-4\" />\n </div>\n )}\n </div>\n {props.error && (\n <div className=\"mt-2 space-y-2\">\n <FieldError>{props.error}</FieldError>\n {props.onRetry && (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={props.onRetry}\n className=\"h-7 px-2 text-xs\"\n >\n Try again\n </Button>\n )}\n </div>\n )}\n </CardStackEntryField>\n </CardStackContent>\n </CardStack>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,aAAa,WAAW,SAAS,QAAQ,gBAAgB;AAC9E,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AACrB,YAAY,UAAU;AACtB,YAAY,WAAW;AACvB,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,YAAY,YAAY;AACxB,YAAY,iBAAiB;AAE7B,SAAS,kCAAkC;AAC3C,SAAS,UAAAA,eAAc;AACvB;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,uBAAAC;AAAA,OACK;AACP,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,SAAAC,cAAa;AACtB,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,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BAAAA,KAAC,6BAA0B,UAAU,eAAe,iBAAgB,iBAAgB;AAAA,MAGnF,cACC,gBAAAA,KAAC,SAAI,WAAU,sEACb,0BAAAA,KAAC,OAAE,WAAU,gCAAgC,sBAAW,GAC1D;AAAA,MAGD,mBAAmB,CAAC,eACnB,gBAAAA,KAAC,SAAI,WAAU,sEACb,0BAAAC,MAAC,OAAE,WAAU,gCAA+B;AAAA;AAAA,QACd;AAAA,QAAU;AAAA,QACY;AAAA,QAClD,gBAAAD;AAAA,UAAC;AAAA;AAAA,YACC,IAAG;AAAA,YACH,QAAQ,EAAE,WAAW,UAAU;AAAA,YAC/B,WAAU;AAAA,YACX;AAAA;AAAA,QAED;AAAA,SACF,GACF;AAAA,MAGF,gBAAAC,MAAC,gBACC;AAAA,wBAAAD;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,SAAS,MAAM,MAAM,SAAS;AAAA,YAC9B,UAAU;AAAA,YACX;AAAA;AAAA,QAED;AAAA,QACA,gBAAAJ;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;AAAA,YACT,UAAU,CAAC,aAAa,KAAK,KAAK,eAAe;AAAA,YAEhD,wBACC,gBAAAH,MAAA,YACE;AAAA,8BAAAD,KAAC,WAAQ,WAAU,YAAW;AAAA,cAAE;AAAA,eAClC,IAEA;AAAA;AAAA,QAEJ;AAAA,SACF;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":["Button","CardStack","CardStackContent","CardStackEntryField","Input","jsx","jsxs","match","value","Button","CardStack","CardStackContent","CardStackEntryField","Input"]}
@@ -1,313 +0,0 @@
1
- import {
2
- mcpAuthTemplateFromEditorValue
3
- } from "./chunk-7FJ3PUUL.js";
4
- import {
5
- configureMcpServer,
6
- mcpServerAtom
7
- } from "./chunk-N4EAF5CA.js";
8
- import "./chunk-6OEQZ72N.js";
9
-
10
- // src/react/EditMcpSource.tsx
11
- import { useCallback, useEffect, 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 { AuthTemplateSlug, IntegrationSlug } from "@executor-js/sdk/shared";
16
- import { createConnection } from "@executor-js/react/api/atoms";
17
- import { connectionWriteKeys, integrationWriteKeys } from "@executor-js/react/api/reactivity-keys";
18
- import { connectionIdentifier } from "@executor-js/react/lib/connection-name";
19
- import {
20
- AuthTemplateEditor
21
- } from "@executor-js/react/components/auth-template-editor";
22
- import {
23
- CredentialControlField,
24
- ConnectionOwnerUsageRow,
25
- useConnectionOwner
26
- } from "@executor-js/react/plugins/connection-owner";
27
- import { OAuthSignInButton } from "@executor-js/react/plugins/oauth-sign-in";
28
- import { Button } from "@executor-js/react/components/button";
29
- import { AddAccountModal } from "@executor-js/react/components/add-account-modal";
30
- import {
31
- CardStack,
32
- CardStackContent,
33
- CardStackEntry,
34
- CardStackEntryContent,
35
- CardStackEntryDescription,
36
- CardStackEntryTitle
37
- } from "@executor-js/react/components/card-stack";
38
- import { Input } from "@executor-js/react/components/input";
39
- import { Badge } from "@executor-js/react/components/badge";
40
- import { jsx, jsxs } from "react/jsx-runtime";
41
- var HEADER_TEMPLATE = AuthTemplateSlug.make("header");
42
- var OAUTH_TEMPLATE = AuthTemplateSlug.make("oauth2");
43
- var authTemplateToEditorValue = (auth) => {
44
- if (auth.kind === "none") return { kind: "none" };
45
- if (auth.kind === "oauth2")
46
- return { kind: "oauth", authorizationUrl: "", tokenUrl: "", scopes: [] };
47
- return {
48
- kind: "apikey",
49
- placements: [
50
- {
51
- carrier: "header",
52
- name: auth.headerName,
53
- prefix: auth.prefix ?? ""
54
- }
55
- ]
56
- };
57
- };
58
- var authTemplatesEqual = (left, right) => {
59
- if (left.kind !== right.kind) return false;
60
- if (left.kind === "header" && right.kind === "header") {
61
- return left.headerName === right.headerName && (left.prefix ?? "") === (right.prefix ?? "");
62
- }
63
- return true;
64
- };
65
- function RemoteEdit(props) {
66
- const { server } = props;
67
- const auth = server.config.auth;
68
- const { connectionOwner, setConnectionOwner, connectionOwnerOptions } = useConnectionOwner();
69
- const doCreate = useAtomSet(createConnection, { mode: "promiseExit" });
70
- const doConfigure = useAtomSet(configureMcpServer, { mode: "promiseExit" });
71
- const [authValue, setAuthValue] = useState(
72
- () => authTemplateToEditorValue(auth)
73
- );
74
- const [apiKey, setApiKey] = useState("");
75
- const [saving, setSaving] = useState(false);
76
- const [authSaving, setAuthSaving] = useState(false);
77
- const [error, setError] = useState(null);
78
- const [connected, setConnected] = useState(false);
79
- const [oauthModalOpen, setOauthModalOpen] = useState(false);
80
- const editedAuth = mcpAuthTemplateFromEditorValue(authValue);
81
- const authChanged = !authTemplatesEqual(editedAuth, auth);
82
- useEffect(() => {
83
- setAuthValue(authTemplateToEditorValue(auth));
84
- }, [auth]);
85
- const handleSaveAuth = useCallback(async () => {
86
- setAuthSaving(true);
87
- setError(null);
88
- const nextConfig = {
89
- ...server.config,
90
- auth: mcpAuthTemplateFromEditorValue(authValue)
91
- };
92
- const exit = await doConfigure({
93
- params: { slug: server.slug },
94
- payload: { config: nextConfig },
95
- reactivityKeys: integrationWriteKeys
96
- });
97
- if (Exit.isFailure(exit)) {
98
- setError("Failed to update authentication method");
99
- setAuthSaving(false);
100
- return;
101
- }
102
- setAuthSaving(false);
103
- }, [authValue, doConfigure, server.config, server.slug]);
104
- const handleSaveKey = useCallback(async () => {
105
- if (apiKey.trim() === "") return;
106
- setSaving(true);
107
- setError(null);
108
- const exit = await doCreate({
109
- payload: {
110
- owner: connectionOwner,
111
- name: connectionIdentifier(`${server.slug} key`),
112
- integration: server.slug,
113
- template: HEADER_TEMPLATE,
114
- identityLabel: server.description || String(server.slug),
115
- value: apiKey.trim()
116
- },
117
- reactivityKeys: connectionWriteKeys
118
- });
119
- if (Exit.isFailure(exit)) {
120
- setError("Failed to save credential");
121
- setSaving(false);
122
- return;
123
- }
124
- setSaving(false);
125
- setConnected(true);
126
- props.onSave();
127
- }, [apiKey, connectionOwner, doCreate, server, props]);
128
- const handleOAuth = useCallback(() => {
129
- setError(null);
130
- setOauthModalOpen(true);
131
- }, []);
132
- const oauthMethods = useMemo(
133
- () => auth.kind === "oauth2" ? [
134
- {
135
- id: "oauth2",
136
- label: "OAuth",
137
- kind: "oauth",
138
- source: "spec",
139
- template: OAUTH_TEMPLATE,
140
- placements: [],
141
- oauth: { discoveryUrl: server.config.endpoint, supportsDynamicRegistration: true }
142
- }
143
- ] : [],
144
- [auth.kind, server.config.endpoint]
145
- );
146
- const oauthInitialState = useMemo(
147
- () => oauthModalOpen && auth.kind === "oauth2" ? {
148
- key: `${String(server.slug)}:${connectionOwner}:oauth`,
149
- owner: connectionOwner,
150
- template: String(OAUTH_TEMPLATE),
151
- label: `${server.description || String(server.slug)} OAuth`
152
- } : null,
153
- [auth.kind, connectionOwner, oauthModalOpen, server]
154
- );
155
- return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
156
- /* @__PURE__ */ jsxs("div", { children: [
157
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
158
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Manage the connection for this MCP server. The endpoint is part of the server's identity \u2014 remove and re-add to change it." })
159
- ] }),
160
- /* @__PURE__ */ jsx(CardStack, { children: /* @__PURE__ */ jsx(CardStackContent, { className: "border-t-0", children: /* @__PURE__ */ jsxs(CardStackEntry, { children: [
161
- /* @__PURE__ */ jsxs(CardStackEntryContent, { children: [
162
- /* @__PURE__ */ jsx(CardStackEntryTitle, { children: server.description || String(server.slug) }),
163
- /* @__PURE__ */ jsx(CardStackEntryDescription, { className: "font-mono text-xs", children: server.config.endpoint })
164
- ] }),
165
- /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "remote" })
166
- ] }) }) }),
167
- /* @__PURE__ */ jsxs("div", { className: "space-y-3 rounded-lg border border-border bg-card p-4", children: [
168
- /* @__PURE__ */ jsxs("div", { children: [
169
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-card-foreground", children: "Authentication method" }),
170
- /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-muted-foreground", children: "Choose how a connection credential is sent to this MCP server." })
171
- ] }),
172
- /* @__PURE__ */ jsx(
173
- AuthTemplateEditor,
174
- {
175
- value: authValue,
176
- onChange: setAuthValue,
177
- allowedKinds: ["none", "apikey", "oauth"],
178
- oauthMetadata: "discovered"
179
- }
180
- ),
181
- authChanged ? /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(
182
- Button,
183
- {
184
- type: "button",
185
- size: "sm",
186
- onClick: () => void handleSaveAuth(),
187
- disabled: authSaving,
188
- children: authSaving ? "Saving\u2026" : "Save authentication method"
189
- }
190
- ) }) : null
191
- ] }),
192
- authChanged ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: "Save the authentication method before adding a connection." }) : null,
193
- !authChanged && auth.kind === "header" && /* @__PURE__ */ jsx(
194
- ConnectionOwnerUsageRow,
195
- {
196
- value: connectionOwner,
197
- options: connectionOwnerOptions,
198
- onChange: setConnectionOwner,
199
- label: "Connection saved to",
200
- help: "Choose who can use this credential.",
201
- children: /* @__PURE__ */ jsxs(CredentialControlField, { label: `${auth.headerName} value`, help: "Saved as a connection.", children: [
202
- /* @__PURE__ */ jsx(
203
- Input,
204
- {
205
- type: "password",
206
- value: apiKey,
207
- onChange: (e) => setApiKey(e.target.value),
208
- placeholder: "sk-\u2026",
209
- className: "font-mono text-sm",
210
- autoComplete: "new-password"
211
- }
212
- ),
213
- /* @__PURE__ */ jsx("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsx(
214
- Button,
215
- {
216
- type: "button",
217
- size: "sm",
218
- onClick: () => void handleSaveKey(),
219
- disabled: apiKey.trim() === "" || saving,
220
- children: saving ? "Saving\u2026" : connected ? "Saved" : "Save connection"
221
- }
222
- ) })
223
- ] })
224
- }
225
- ),
226
- !authChanged && auth.kind === "oauth2" && /* @__PURE__ */ jsx(
227
- ConnectionOwnerUsageRow,
228
- {
229
- value: connectionOwner,
230
- options: connectionOwnerOptions,
231
- onChange: setConnectionOwner,
232
- label: "Connection saved to",
233
- help: "Choose who can use the OAuth connection.",
234
- children: /* @__PURE__ */ jsxs(CredentialControlField, { label: "Connect via OAuth", help: "Start the provider OAuth flow.", children: [
235
- /* @__PURE__ */ jsx(
236
- OAuthSignInButton,
237
- {
238
- busy: false,
239
- error,
240
- isConnected: connected,
241
- onSignIn: handleOAuth,
242
- signingInLabel: "Signing in\u2026",
243
- reconnectingLabel: "Reconnecting\u2026"
244
- }
245
- ),
246
- /* @__PURE__ */ jsx(
247
- AddAccountModal,
248
- {
249
- integration: server.slug,
250
- integrationName: server.description || String(server.slug),
251
- methods: oauthMethods,
252
- open: oauthModalOpen,
253
- onOpenChange: setOauthModalOpen,
254
- initialState: oauthInitialState
255
- }
256
- )
257
- ] })
258
- }
259
- ),
260
- !authChanged && auth.kind === "none" && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-border bg-muted/30 px-3 py-2 text-xs text-muted-foreground", children: "This server does not require a credential." }),
261
- 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 }) }),
262
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end border-t border-border pt-4", children: /* @__PURE__ */ jsx(Button, { onClick: props.onSave, children: "Done" }) })
263
- ] });
264
- }
265
- function StdioReadOnly(props) {
266
- const { command, args } = props.server.config;
267
- return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
268
- /* @__PURE__ */ jsxs("div", { children: [
269
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
270
- /* @__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." })
271
- ] }),
272
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 rounded-lg border border-border bg-card px-4 py-3", children: [
273
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
274
- /* @__PURE__ */ jsx("p", { className: "truncate text-sm font-semibold text-card-foreground", children: String(props.server.slug) }),
275
- /* @__PURE__ */ jsxs("p", { className: "mt-0.5 text-xs text-muted-foreground font-mono", children: [
276
- command,
277
- " ",
278
- (args ?? []).join(" ")
279
- ] })
280
- ] }),
281
- /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "stdio" })
282
- ] }),
283
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end border-t border-border pt-4", children: /* @__PURE__ */ jsx(Button, { onClick: props.onSave, children: "Done" }) })
284
- ] });
285
- }
286
- function EditMcpSource({
287
- sourceId,
288
- onSave
289
- }) {
290
- const slug = IntegrationSlug.make(sourceId);
291
- const serverResult = useAtomValue(mcpServerAtom(slug));
292
- const server = AsyncResult.isSuccess(serverResult) ? serverResult.value : null;
293
- if (!AsyncResult.isSuccess(serverResult) || server === null) {
294
- return /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs("div", { children: [
295
- /* @__PURE__ */ jsx("h1", { className: "text-xl font-semibold text-foreground", children: "Edit MCP Source" }),
296
- /* @__PURE__ */ jsx("p", { className: "mt-1 text-sm text-muted-foreground", children: "Loading configuration\u2026" })
297
- ] }) });
298
- }
299
- if (server.config.transport === "stdio") {
300
- return /* @__PURE__ */ jsx(
301
- StdioReadOnly,
302
- {
303
- server,
304
- onSave
305
- }
306
- );
307
- }
308
- return /* @__PURE__ */ jsx(RemoteEdit, { server, onSave });
309
- }
310
- export {
311
- EditMcpSource as default
312
- };
313
- //# sourceMappingURL=EditMcpSource-GKJRP75X.js.map