@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
@@ -0,0 +1,83 @@
1
+ import {
2
+ authMethodsFromConfig,
3
+ configureMcpAuth,
4
+ mcpAuthMethodInputsFromPlacements,
5
+ mcpServerAtom,
6
+ mcpWireAuthInput
7
+ } from "./chunk-3AOD4VAW.js";
8
+ import "./chunk-3H5Y7JCQ.js";
9
+
10
+ // src/react/McpAccountsPanel.tsx
11
+ import { useCallback, useMemo } from "react";
12
+ import { useAtomSet, useAtomValue } from "@effect/atom-react";
13
+ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
14
+ import * as Exit from "effect/Exit";
15
+ import { IntegrationSlug } from "@executor-js/sdk/shared";
16
+ import { AccountsSection } from "@executor-js/react/components/accounts-section";
17
+ import {
18
+ useCustomMethodActions
19
+ } from "@executor-js/react/lib/custom-auth-methods";
20
+ import { integrationWriteKeys } from "@executor-js/react/api/reactivity-keys";
21
+ import { jsx } from "react/jsx-runtime";
22
+ function McpAccountsPanel(props) {
23
+ const { sourceId, integrationName, accountHandoff } = props;
24
+ const slug = IntegrationSlug.make(sourceId);
25
+ const serverResult = useAtomValue(mcpServerAtom(slug));
26
+ const doConfigureAuth = useAtomSet(configureMcpAuth, { mode: "promiseExit" });
27
+ const server = AsyncResult.isSuccess(serverResult) ? serverResult.value : null;
28
+ const config = server?.config ?? null;
29
+ const remote = config !== null && config.transport === "remote" ? config : null;
30
+ const existingTemplate = useMemo(
31
+ () => remote?.authenticationTemplate ?? [],
32
+ [remote]
33
+ );
34
+ const methods = useMemo(
35
+ () => remote ? authMethodsFromConfig(existingTemplate, remote.endpoint) : [],
36
+ [existingTemplate, remote]
37
+ );
38
+ const configure = useCallback(
39
+ async (input) => {
40
+ const exit = await doConfigureAuth({
41
+ params: { slug },
42
+ payload: {
43
+ authenticationTemplate: input.authenticationTemplate.map(mcpWireAuthInput),
44
+ ...input.mode ? { mode: input.mode } : {}
45
+ },
46
+ reactivityKeys: integrationWriteKeys
47
+ });
48
+ return Exit.map(exit, (result) => result.authenticationTemplate);
49
+ },
50
+ [doConfigureAuth, slug]
51
+ );
52
+ const codec = useMemo(
53
+ () => ({
54
+ toAuthMethods: (templates) => authMethodsFromConfig(templates, remote?.endpoint ?? ""),
55
+ // MCP custom methods are header credentials; the inputs omit slugs and
56
+ // the backend merge backfills `custom_<id>`.
57
+ templatesFromPlacements: (placements) => mcpAuthMethodInputsFromPlacements(placements),
58
+ slugOf: (template) => template.slug
59
+ }),
60
+ [remote?.endpoint]
61
+ );
62
+ const { createCustomMethod, removeCustomMethod } = useCustomMethodActions({
63
+ existing: existingTemplate,
64
+ codec,
65
+ configure
66
+ });
67
+ const canConfigureAuth = remote !== null;
68
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-3xl space-y-8 px-6 py-8", children: /* @__PURE__ */ jsx(
69
+ AccountsSection,
70
+ {
71
+ integration: slug,
72
+ integrationName,
73
+ methods,
74
+ accountHandoff,
75
+ createCustomMethod: canConfigureAuth ? createCustomMethod : void 0,
76
+ removeCustomMethod: canConfigureAuth ? removeCustomMethod : void 0
77
+ }
78
+ ) });
79
+ }
80
+ export {
81
+ McpAccountsPanel as default
82
+ };
83
+ //# sourceMappingURL=McpAccountsPanel-QBCSCJE7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/McpAccountsPanel.tsx"],"sourcesContent":["import { useCallback, useMemo } from \"react\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport * as Exit from \"effect/Exit\";\n\nimport { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport type { IntegrationAccountHandoff } from \"@executor-js/sdk/client\";\nimport { AccountsSection } from \"@executor-js/react/components/accounts-section\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n useCustomMethodActions,\n type AuthMethodsCodec,\n type ConfigureAuthMethods,\n} from \"@executor-js/react/lib/custom-auth-methods\";\nimport { integrationWriteKeys } from \"@executor-js/react/api/reactivity-keys\";\n\nimport { configureMcpAuth, mcpServerAtom } from \"./atoms\";\nimport {\n authMethodsFromConfig,\n mcpAuthMethodInputsFromPlacements,\n mcpWireAuthInput,\n} from \"./auth-method-config\";\nimport type { McpAuthMethod } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// MCP Accounts hub — fills the generic detail page's `accounts` slot.\n//\n// Reads the integration's declared `authenticationTemplate` (via `getServer`),\n// converts it to generic `AuthMethod[]`, and composes the generic\n// `AccountsSection` — whose Add-account offers those methods plus a \"+ Custom\n// method\" row. The custom-method create/remove is the shared skeleton\n// (`useCustomMethodActions`) parameterized by the MCP codec and the\n// merge-append `configureAuth` endpoint, so adding an API key method never\n// displaces a declared OAuth method. Stdio servers have no remote credential\n// to configure — no methods, no custom-method affordance.\n// ---------------------------------------------------------------------------\n\nexport default function McpAccountsPanel(props: {\n readonly sourceId: string;\n readonly integrationName: string;\n readonly accountHandoff?: IntegrationAccountHandoff | null;\n}) {\n const { sourceId, integrationName, accountHandoff } = props;\n const slug = IntegrationSlug.make(sourceId);\n const serverResult = useAtomValue(mcpServerAtom(slug));\n const doConfigureAuth = useAtomSet(configureMcpAuth, { mode: \"promiseExit\" });\n\n const server = AsyncResult.isSuccess(serverResult) ? serverResult.value : null;\n const config = server?.config ?? null;\n const remote = config !== null && config.transport === \"remote\" ? config : null;\n\n const existingTemplate = useMemo<readonly McpAuthMethod[]>(\n () => remote?.authenticationTemplate ?? [],\n [remote],\n );\n\n const methods = useMemo<readonly AuthMethod[]>(\n () => (remote ? authMethodsFromConfig(existingTemplate, remote.endpoint) : []),\n [existingTemplate, remote],\n );\n\n const configure = useCallback<ConfigureAuthMethods<McpAuthMethod>>(\n async (input) => {\n const exit = await doConfigureAuth({\n params: { slug },\n payload: {\n authenticationTemplate: input.authenticationTemplate.map(mcpWireAuthInput),\n ...(input.mode ? { mode: input.mode } : {}),\n },\n reactivityKeys: integrationWriteKeys,\n });\n return Exit.map(exit, (result) => result.authenticationTemplate);\n },\n [doConfigureAuth, slug],\n );\n\n const codec = useMemo<AuthMethodsCodec<McpAuthMethod>>(\n () => ({\n toAuthMethods: (templates: readonly McpAuthMethod[]) =>\n authMethodsFromConfig(templates, remote?.endpoint ?? \"\"),\n // MCP custom methods are header credentials; the inputs omit slugs and\n // the backend merge backfills `custom_<id>`.\n templatesFromPlacements: (placements: readonly Placement[]) =>\n mcpAuthMethodInputsFromPlacements(placements) as readonly McpAuthMethod[],\n slugOf: (template: McpAuthMethod) => template.slug,\n }),\n [remote?.endpoint],\n );\n\n const { createCustomMethod, removeCustomMethod } = useCustomMethodActions({\n existing: existingTemplate,\n codec,\n configure,\n });\n\n const canConfigureAuth = remote !== null;\n\n return (\n <div className=\"mx-auto max-w-3xl space-y-8 px-6 py-8\">\n <AccountsSection\n integration={slug}\n integrationName={integrationName}\n methods={methods}\n accountHandoff={accountHandoff}\n createCustomMethod={canConfigureAuth ? createCustomMethod : undefined}\n removeCustomMethod={canConfigureAuth ? removeCustomMethod : undefined}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,eAAe;AACrC,SAAS,YAAY,oBAAoB;AACzC,YAAY,iBAAiB;AAC7B,YAAY,UAAU;AAEtB,SAAS,uBAAuB;AAEhC,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,OAGK;AACP,SAAS,4BAA4B;AAqF/B;AA9DS,SAAR,iBAAkC,OAItC;AACD,QAAM,EAAE,UAAU,iBAAiB,eAAe,IAAI;AAC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AA,IACA;AAAA,EACF,CAAC;AAED,QAAM,mBAAmB,WAAW;AAEpC,SACE,oBAAC,SAAI,WAAU,yCACb;AAAA,IAAC;AAAA;AAAA,MACC,aAAa;AAAA,MACb;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB,mBAAmB,qBAAqB;AAAA,MAC5D,oBAAoB,mBAAmB,qBAAqB;AAAA;AAAA,EAC9D,GACF;AAEJ;","names":[]}
@@ -23,6 +23,28 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.
23
23
  readonly slug: Schema.optional<Schema.String>;
24
24
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
25
25
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
26
+ /** Declared auth methods a connection can be applied through. */
27
+ readonly authenticationTemplate: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
28
+ readonly slug: Schema.optional<Schema.String>;
29
+ readonly kind: Schema.Literal<"none">;
30
+ }>, Schema.Struct<{
31
+ readonly slug: Schema.optional<Schema.String>;
32
+ readonly kind: Schema.Literal<"oauth2">;
33
+ }>, Schema.Struct<{
34
+ readonly slug: Schema.optional<Schema.String>;
35
+ readonly type: Schema.Literal<"apiKey">;
36
+ readonly label: Schema.optional<Schema.String>;
37
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
38
+ readonly type: Schema.Literal<"variable">;
39
+ readonly name: Schema.String;
40
+ }>]>>]>>>;
41
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
42
+ readonly type: Schema.Literal<"variable">;
43
+ readonly name: Schema.String;
44
+ }>]>>]>>>;
45
+ }>]>>>;
46
+ /** Single-method shorthand (legacy callers); ignored when
47
+ * `authenticationTemplate` is present. */
26
48
  readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
27
49
  readonly kind: Schema.Literal<"none">;
28
50
  }>, Schema.Struct<{
@@ -60,15 +82,24 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.
60
82
  readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
61
83
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
62
84
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
63
- readonly auth: Schema.Union<readonly [Schema.Struct<{
85
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
86
+ readonly slug: Schema.String;
64
87
  readonly kind: Schema.Literal<"none">;
65
88
  }>, Schema.Struct<{
66
- readonly kind: Schema.Literal<"header">;
67
- readonly headerName: Schema.String;
68
- readonly prefix: Schema.optional<Schema.String>;
89
+ readonly slug: Schema.String;
90
+ readonly kind: Schema.Literal<"apikey">;
91
+ readonly label: Schema.optional<Schema.String>;
92
+ readonly placements: Schema.$Array<Schema.Struct<{
93
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
94
+ readonly name: Schema.String;
95
+ readonly prefix: Schema.optional<Schema.String>;
96
+ readonly variable: Schema.optional<Schema.String>;
97
+ readonly literal: Schema.optional<Schema.String>;
98
+ }>>;
69
99
  }>, Schema.Struct<{
100
+ readonly slug: Schema.String;
70
101
  readonly kind: Schema.Literal<"oauth2">;
71
- }>]>;
102
+ }>]>>;
72
103
  }>, Schema.Struct<{
73
104
  readonly transport: Schema.Literal<"stdio">;
74
105
  readonly command: Schema.String;
@@ -85,15 +116,24 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.
85
116
  readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
86
117
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
87
118
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
88
- readonly auth: Schema.Union<readonly [Schema.Struct<{
119
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
120
+ readonly slug: Schema.String;
89
121
  readonly kind: Schema.Literal<"none">;
90
122
  }>, Schema.Struct<{
91
- readonly kind: Schema.Literal<"header">;
92
- readonly headerName: Schema.String;
93
- readonly prefix: Schema.optional<Schema.String>;
123
+ readonly slug: Schema.String;
124
+ readonly kind: Schema.Literal<"apikey">;
125
+ readonly label: Schema.optional<Schema.String>;
126
+ readonly placements: Schema.$Array<Schema.Struct<{
127
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
128
+ readonly name: Schema.String;
129
+ readonly prefix: Schema.optional<Schema.String>;
130
+ readonly variable: Schema.optional<Schema.String>;
131
+ readonly literal: Schema.optional<Schema.String>;
132
+ }>>;
94
133
  }>, Schema.Struct<{
134
+ readonly slug: Schema.String;
95
135
  readonly kind: Schema.Literal<"oauth2">;
96
- }>]>;
136
+ }>]>>;
97
137
  }>, Schema.Struct<{
98
138
  readonly transport: Schema.Literal<"stdio">;
99
139
  readonly command: Schema.String;
@@ -108,15 +148,24 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.
108
148
  readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
109
149
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
110
150
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
111
- readonly auth: Schema.Union<readonly [Schema.Struct<{
151
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
152
+ readonly slug: Schema.String;
112
153
  readonly kind: Schema.Literal<"none">;
113
154
  }>, Schema.Struct<{
114
- readonly kind: Schema.Literal<"header">;
115
- readonly headerName: Schema.String;
116
- readonly prefix: Schema.optional<Schema.String>;
155
+ readonly slug: Schema.String;
156
+ readonly kind: Schema.Literal<"apikey">;
157
+ readonly label: Schema.optional<Schema.String>;
158
+ readonly placements: Schema.$Array<Schema.Struct<{
159
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
160
+ readonly name: Schema.String;
161
+ readonly prefix: Schema.optional<Schema.String>;
162
+ readonly variable: Schema.optional<Schema.String>;
163
+ readonly literal: Schema.optional<Schema.String>;
164
+ }>>;
117
165
  }>, Schema.Struct<{
166
+ readonly slug: Schema.String;
118
167
  readonly kind: Schema.Literal<"oauth2">;
119
- }>]>;
168
+ }>]>>;
120
169
  }>, Schema.Struct<{
121
170
  readonly transport: Schema.Literal<"stdio">;
122
171
  readonly command: Schema.String;
@@ -124,4 +173,46 @@ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.
124
173
  readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
125
174
  readonly cwd: Schema.optional<Schema.String>;
126
175
  }>]>;
176
+ }>>, HttpApiEndpoint.Json<typeof InternalError | typeof McpConnectionError | typeof McpToolDiscoveryError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"configureAuth", "POST", "/mcp/servers/:slug/auth", HttpApiEndpoint.StringTree<Schema.Struct<{
177
+ slug: Schema.brand<Schema.String, "IntegrationSlug">;
178
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
179
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
180
+ readonly slug: Schema.optional<Schema.String>;
181
+ readonly kind: Schema.Literal<"none">;
182
+ }>, Schema.Struct<{
183
+ readonly slug: Schema.optional<Schema.String>;
184
+ readonly kind: Schema.Literal<"oauth2">;
185
+ }>, Schema.Struct<{
186
+ readonly slug: Schema.optional<Schema.String>;
187
+ readonly type: Schema.Literal<"apiKey">;
188
+ readonly label: Schema.optional<Schema.String>;
189
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
190
+ readonly type: Schema.Literal<"variable">;
191
+ readonly name: Schema.String;
192
+ }>]>>]>>>;
193
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Struct<{
194
+ readonly type: Schema.Literal<"variable">;
195
+ readonly name: Schema.String;
196
+ }>]>>]>>>;
197
+ }>]>>;
198
+ readonly mode: Schema.optional<Schema.Literals<readonly ["merge", "replace"]>>;
199
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
200
+ readonly authenticationTemplate: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
201
+ readonly slug: Schema.String;
202
+ readonly kind: Schema.Literal<"none">;
203
+ }>, Schema.Struct<{
204
+ readonly slug: Schema.String;
205
+ readonly kind: Schema.Literal<"apikey">;
206
+ readonly label: Schema.optional<Schema.String>;
207
+ readonly placements: Schema.$Array<Schema.Struct<{
208
+ readonly carrier: Schema.Literals<readonly ["header", "query"]>;
209
+ readonly name: Schema.String;
210
+ readonly prefix: Schema.optional<Schema.String>;
211
+ readonly variable: Schema.optional<Schema.String>;
212
+ readonly literal: Schema.optional<Schema.String>;
213
+ }>>;
214
+ }>, Schema.Struct<{
215
+ readonly slug: Schema.String;
216
+ readonly kind: Schema.Literal<"oauth2">;
217
+ }>]>>;
127
218
  }>>, HttpApiEndpoint.Json<typeof InternalError | typeof McpConnectionError | typeof McpToolDiscoveryError>, never, never>, false>;
@@ -37,6 +37,24 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
37
37
  removeServer: (slug: string) => import("effect/Effect").Effect<void, import("@executor-js/sdk/core").StorageFailure, never>;
38
38
  getServer: (slug: string) => import("effect/Effect").Effect<import("@executor-js/sdk/core").IntegrationRecord | null, import("@executor-js/sdk/core").StorageFailure, never>;
39
39
  configureServer: (slug: string, config: import("../sdk").McpIntegrationConfig) => import("effect/Effect").Effect<void, import("@executor-js/sdk/core").StorageFailure, never>;
40
+ configureAuth: (slug: string, input: import("../sdk/plugin").McpConfigureAuthInput) => import("effect/Effect").Effect<readonly ({
41
+ readonly slug: string;
42
+ readonly kind: "apikey";
43
+ readonly placements: readonly {
44
+ readonly name: string;
45
+ readonly carrier: "header" | "query";
46
+ readonly variable?: string | undefined;
47
+ readonly prefix?: string | undefined;
48
+ readonly literal?: string | undefined;
49
+ }[];
50
+ readonly label?: string | undefined;
51
+ } | {
52
+ readonly slug: string;
53
+ readonly kind: "none";
54
+ } | {
55
+ readonly slug: string;
56
+ readonly kind: "oauth2";
57
+ })[], import("@executor-js/sdk/core").StorageFailure, never>;
40
58
  }, {}, McpPluginOptions, typeof McpExtensionService, import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "mcp">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", McpExtensionService>>, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"mcp", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"probeEndpoint", "POST", "/mcp/probe", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
41
59
  readonly endpoint: import("effect/Schema").String;
42
60
  readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
@@ -58,6 +76,25 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
58
76
  readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
59
77
  readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
60
78
  readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
79
+ readonly authenticationTemplate: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
80
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
81
+ readonly kind: import("effect/Schema").Literal<"none">;
82
+ }>, import("effect/Schema").Struct<{
83
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
84
+ readonly kind: import("effect/Schema").Literal<"oauth2">;
85
+ }>, import("effect/Schema").Struct<{
86
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
87
+ readonly type: import("effect/Schema").Literal<"apiKey">;
88
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
89
+ readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
90
+ readonly type: import("effect/Schema").Literal<"variable">;
91
+ readonly name: import("effect/Schema").String;
92
+ }>]>>]>>>;
93
+ readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
94
+ readonly type: import("effect/Schema").Literal<"variable">;
95
+ readonly name: import("effect/Schema").String;
96
+ }>]>>]>>>;
97
+ }>]>>>;
61
98
  readonly auth: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
62
99
  readonly kind: import("effect/Schema").Literal<"none">;
63
100
  }>, import("effect/Schema").Struct<{
@@ -95,15 +132,24 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
95
132
  readonly remoteTransport: import("effect/Schema").withConstructorDefault<import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["streamable-http", "sse", "auto"]>>>;
96
133
  readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
97
134
  readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
98
- readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
135
+ readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
136
+ readonly slug: import("effect/Schema").String;
99
137
  readonly kind: import("effect/Schema").Literal<"none">;
100
138
  }>, import("effect/Schema").Struct<{
101
- readonly kind: import("effect/Schema").Literal<"header">;
102
- readonly headerName: import("effect/Schema").String;
103
- readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
139
+ readonly slug: import("effect/Schema").String;
140
+ readonly kind: import("effect/Schema").Literal<"apikey">;
141
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
142
+ readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
143
+ readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
144
+ readonly name: import("effect/Schema").String;
145
+ readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
146
+ readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
147
+ readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
148
+ }>>;
104
149
  }>, import("effect/Schema").Struct<{
150
+ readonly slug: import("effect/Schema").String;
105
151
  readonly kind: import("effect/Schema").Literal<"oauth2">;
106
- }>]>;
152
+ }>]>>;
107
153
  }>, import("effect/Schema").Struct<{
108
154
  readonly transport: import("effect/Schema").Literal<"stdio">;
109
155
  readonly command: import("effect/Schema").String;
@@ -120,15 +166,24 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
120
166
  readonly remoteTransport: import("effect/Schema").withConstructorDefault<import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["streamable-http", "sse", "auto"]>>>;
121
167
  readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
122
168
  readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
123
- readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
169
+ readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
170
+ readonly slug: import("effect/Schema").String;
124
171
  readonly kind: import("effect/Schema").Literal<"none">;
125
172
  }>, import("effect/Schema").Struct<{
126
- readonly kind: import("effect/Schema").Literal<"header">;
127
- readonly headerName: import("effect/Schema").String;
128
- readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
173
+ readonly slug: import("effect/Schema").String;
174
+ readonly kind: import("effect/Schema").Literal<"apikey">;
175
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
176
+ readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
177
+ readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
178
+ readonly name: import("effect/Schema").String;
179
+ readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
180
+ readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
181
+ readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
182
+ }>>;
129
183
  }>, import("effect/Schema").Struct<{
184
+ readonly slug: import("effect/Schema").String;
130
185
  readonly kind: import("effect/Schema").Literal<"oauth2">;
131
- }>]>;
186
+ }>]>>;
132
187
  }>, import("effect/Schema").Struct<{
133
188
  readonly transport: import("effect/Schema").Literal<"stdio">;
134
189
  readonly command: import("effect/Schema").String;
@@ -143,15 +198,24 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
143
198
  readonly remoteTransport: import("effect/Schema").withConstructorDefault<import("effect/Schema").optionalKey<import("effect/Schema").Literals<readonly ["streamable-http", "sse", "auto"]>>>;
144
199
  readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
145
200
  readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
146
- readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
201
+ readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
202
+ readonly slug: import("effect/Schema").String;
147
203
  readonly kind: import("effect/Schema").Literal<"none">;
148
204
  }>, import("effect/Schema").Struct<{
149
- readonly kind: import("effect/Schema").Literal<"header">;
150
- readonly headerName: import("effect/Schema").String;
151
- readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
205
+ readonly slug: import("effect/Schema").String;
206
+ readonly kind: import("effect/Schema").Literal<"apikey">;
207
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
208
+ readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
209
+ readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
210
+ readonly name: import("effect/Schema").String;
211
+ readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
212
+ readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
213
+ readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
214
+ }>>;
152
215
  }>, import("effect/Schema").Struct<{
216
+ readonly slug: import("effect/Schema").String;
153
217
  readonly kind: import("effect/Schema").Literal<"oauth2">;
154
- }>]>;
218
+ }>]>>;
155
219
  }>, import("effect/Schema").Struct<{
156
220
  readonly transport: import("effect/Schema").Literal<"stdio">;
157
221
  readonly command: import("effect/Schema").String;
@@ -159,4 +223,46 @@ export declare const mcpHttpPlugin: import("@executor-js/sdk/core").ConfiguredPl
159
223
  readonly env: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>>;
160
224
  readonly cwd: import("effect/Schema").optional<import("effect/Schema").String>;
161
225
  }>]>;
226
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../sdk").McpConnectionError | typeof import("../sdk").McpToolDiscoveryError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"configureAuth", "POST", "/mcp/servers/:slug/auth", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
227
+ slug: import("effect/Schema").brand<import("effect/Schema").String, "IntegrationSlug">;
228
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
229
+ readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
230
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
231
+ readonly kind: import("effect/Schema").Literal<"none">;
232
+ }>, import("effect/Schema").Struct<{
233
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
234
+ readonly kind: import("effect/Schema").Literal<"oauth2">;
235
+ }>, import("effect/Schema").Struct<{
236
+ readonly slug: import("effect/Schema").optional<import("effect/Schema").String>;
237
+ readonly type: import("effect/Schema").Literal<"apiKey">;
238
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
239
+ readonly headers: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
240
+ readonly type: import("effect/Schema").Literal<"variable">;
241
+ readonly name: import("effect/Schema").String;
242
+ }>]>>]>>>;
243
+ readonly queryParams: import("effect/Schema").optional<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").Struct<{
244
+ readonly type: import("effect/Schema").Literal<"variable">;
245
+ readonly name: import("effect/Schema").String;
246
+ }>]>>]>>>;
247
+ }>]>>;
248
+ readonly mode: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["merge", "replace"]>>;
249
+ }>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
250
+ readonly authenticationTemplate: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
251
+ readonly slug: import("effect/Schema").String;
252
+ readonly kind: import("effect/Schema").Literal<"none">;
253
+ }>, import("effect/Schema").Struct<{
254
+ readonly slug: import("effect/Schema").String;
255
+ readonly kind: import("effect/Schema").Literal<"apikey">;
256
+ readonly label: import("effect/Schema").optional<import("effect/Schema").String>;
257
+ readonly placements: import("effect/Schema").$Array<import("effect/Schema").Struct<{
258
+ readonly carrier: import("effect/Schema").Literals<readonly ["header", "query"]>;
259
+ readonly name: import("effect/Schema").String;
260
+ readonly prefix: import("effect/Schema").optional<import("effect/Schema").String>;
261
+ readonly variable: import("effect/Schema").optional<import("effect/Schema").String>;
262
+ readonly literal: import("effect/Schema").optional<import("effect/Schema").String>;
263
+ }>>;
264
+ }>, import("effect/Schema").Struct<{
265
+ readonly slug: import("effect/Schema").String;
266
+ readonly kind: import("effect/Schema").Literal<"oauth2">;
267
+ }>]>>;
162
268
  }>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../sdk").McpConnectionError | typeof import("../sdk").McpToolDiscoveryError>, never, never>, false>>;
@@ -1,9 +1,11 @@
1
1
  import {
2
- McpAuthTemplate,
2
+ McpAuthMethod,
3
+ McpAuthMethodInput,
4
+ McpAuthShorthand,
3
5
  McpConnectionError,
4
6
  McpIntegrationConfig,
5
7
  McpToolDiscoveryError
6
- } from "./chunk-6OEQZ72N.js";
8
+ } from "./chunk-3H5Y7JCQ.js";
7
9
 
8
10
  // src/react/atoms.ts
9
11
  import { ReactivityKey } from "@executor-js/react/api/reactivity-keys";
@@ -33,7 +35,11 @@ var AddRemoteServerPayload = Schema.Struct({
33
35
  slug: Schema.optional(Schema.String),
34
36
  queryParams: Schema.optional(StringMap),
35
37
  headers: Schema.optional(StringMap),
36
- auth: Schema.optional(McpAuthTemplate)
38
+ /** Declared auth methods a connection can be applied through. */
39
+ authenticationTemplate: Schema.optional(Schema.Array(McpAuthMethodInput)),
40
+ /** Single-method shorthand (legacy callers); ignored when
41
+ * `authenticationTemplate` is present. */
42
+ auth: Schema.optional(McpAuthShorthand)
37
43
  });
38
44
  var AddStdioServerPayload = Schema.Struct({
39
45
  transport: Schema.Literal("stdio"),
@@ -72,6 +78,13 @@ var ConfigureServerPayload = Schema.Struct({
72
78
  var ConfigureServerResponse = Schema.Struct({
73
79
  config: McpIntegrationConfig
74
80
  });
81
+ var ConfigureAuthPayload = Schema.Struct({
82
+ authenticationTemplate: Schema.Array(McpAuthMethodInput),
83
+ mode: Schema.optional(Schema.Literals(["merge", "replace"]))
84
+ });
85
+ var ConfigureAuthResponse = Schema.Struct({
86
+ authenticationTemplate: Schema.Array(McpAuthMethod)
87
+ });
75
88
  var GetServerResponse = Schema.NullOr(
76
89
  Schema.Struct({
77
90
  slug: IntegrationSlug,
@@ -118,6 +131,13 @@ var McpGroup = HttpApiGroup.make("mcp").add(
118
131
  success: ConfigureServerResponse,
119
132
  error: [InternalError, McpConnectionError, McpToolDiscoveryError]
120
133
  })
134
+ ).add(
135
+ HttpApiEndpoint.post("configureAuth", "/mcp/servers/:slug/auth", {
136
+ params: SlugParams,
137
+ payload: ConfigureAuthPayload,
138
+ success: ConfigureAuthResponse,
139
+ error: [InternalError, McpConnectionError, McpToolDiscoveryError]
140
+ })
121
141
  );
122
142
 
123
143
  // src/react/client.ts
@@ -136,11 +156,60 @@ var probeMcpEndpoint = McpClient.mutation("mcp", "probeEndpoint");
136
156
  var addMcpServer = McpClient.mutation("mcp", "addServer");
137
157
  var removeMcpServer = McpClient.mutation("mcp", "removeServer");
138
158
  var configureMcpServer = McpClient.mutation("mcp", "configureServer");
159
+ var configureMcpAuth = McpClient.mutation("mcp", "configureAuth");
160
+
161
+ // src/react/auth-method-config.ts
162
+ import { AuthTemplateSlug } from "@executor-js/sdk/shared";
163
+ import {
164
+ authMethodFromSharedTemplate,
165
+ editorValueFromSharedMethod,
166
+ sharedMethodInputFromEditorValue,
167
+ wirePlacementsFromEditor
168
+ } from "@executor-js/react/lib/shared-auth-method-codec";
169
+ import { wireAuthInputFromShared } from "@executor-js/react/lib/shared-auth-method-codec";
170
+ var mcpWireAuthInput = (method) => wireAuthInputFromShared(method);
171
+ var oauthAuthMethod = (slug, endpoint) => ({
172
+ id: slug,
173
+ label: "OAuth",
174
+ kind: "oauth",
175
+ source: slug.startsWith("custom_") ? "custom" : "spec",
176
+ template: AuthTemplateSlug.make(slug),
177
+ placements: [],
178
+ oauth: { discoveryUrl: endpoint, supportsDynamicRegistration: true }
179
+ });
180
+ function mcpAuthMethodInputFromEditorValue(value) {
181
+ if (value.kind === "oauth") return { kind: "oauth2" };
182
+ return sharedMethodInputFromEditorValue(value) ?? {
183
+ kind: "none"
184
+ };
185
+ }
186
+ function editorValueFromMcpAuthMethod(method) {
187
+ if (method.kind === "oauth2") {
188
+ return { kind: "oauth", authorizationUrl: "", tokenUrl: "", scopes: [] };
189
+ }
190
+ return editorValueFromSharedMethod(method);
191
+ }
192
+ function authMethodsFromConfig(methods, endpoint) {
193
+ return methods.map((method) => {
194
+ if (method.kind === "oauth2") return oauthAuthMethod(method.slug, endpoint);
195
+ return authMethodFromSharedTemplate(method);
196
+ });
197
+ }
198
+ function mcpAuthMethodInputsFromPlacements(placements) {
199
+ const wire = wirePlacementsFromEditor(placements);
200
+ if (wire.length === 0) return [];
201
+ return [{ kind: "apikey", placements: wire }];
202
+ }
139
203
 
140
204
  export {
141
205
  mcpServerAtom,
142
206
  probeMcpEndpoint,
143
207
  addMcpServer,
144
- configureMcpServer
208
+ configureMcpAuth,
209
+ mcpWireAuthInput,
210
+ mcpAuthMethodInputFromEditorValue,
211
+ editorValueFromMcpAuthMethod,
212
+ authMethodsFromConfig,
213
+ mcpAuthMethodInputsFromPlacements
145
214
  };
146
- //# sourceMappingURL=chunk-N4EAF5CA.js.map
215
+ //# sourceMappingURL=chunk-3AOD4VAW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts","../src/react/auth-method-config.ts"],"sourcesContent":["import type { IntegrationSlug } from \"@executor-js/sdk/shared\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { McpClient } from \"./client\";\n\n// ---------------------------------------------------------------------------\n// Query atoms (v2)\n//\n// An MCP server is an integration. `getServer` reads the integration row's\n// opaque config (transport, endpoint, auth template). Credentials are separate\n// owner-scoped connections, created through the core connections / oauth surface\n// — there is no per-server credential binding to read here anymore.\n// ---------------------------------------------------------------------------\n\nexport const mcpServerAtom = (slug: IntegrationSlug) =>\n McpClient.query(\"mcp\", \"getServer\", {\n params: { slug },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.integrations, ReactivityKey.tools],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const probeMcpEndpoint = McpClient.mutation(\"mcp\", \"probeEndpoint\");\nexport const addMcpServer = McpClient.mutation(\"mcp\", \"addServer\");\nexport const removeMcpServer = McpClient.mutation(\"mcp\", \"removeServer\");\nexport const configureMcpServer = McpClient.mutation(\"mcp\", \"configureServer\");\n// Merge-append auth methods onto an integration's `authenticationTemplate`.\nexport const configureMcpAuth = McpClient.mutation(\"mcp\", \"configureAuth\");\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport {\n getExecutorApiBaseUrl,\n getExecutorServerAuthorizationHeader,\n} from \"@executor-js/react/api/server-connection\";\nimport { McpGroup } from \"../api/group\";\n\nexport const McpClient = createPluginAtomClient(McpGroup, {\n baseUrl: getExecutorApiBaseUrl,\n authorizationHeader: getExecutorServerAuthorizationHeader,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport {\n IntegrationSlug,\n InternalError,\n IntegrationAlreadyExistsError,\n} from \"@executor-js/sdk/shared\";\n\nimport { McpConnectionError, McpToolDiscoveryError } from \"../sdk/errors\";\nimport {\n McpAuthMethod,\n McpAuthMethodInput,\n McpAuthShorthand,\n McpIntegrationConfig,\n} from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst SlugParams = { slug: IntegrationSlug };\n\nconst StringMap = Schema.Record(Schema.String, Schema.String);\n\n// ---------------------------------------------------------------------------\n// Add server — discriminated union on transport. An MCP server is registered\n// as an integration; connections (credentials) are created separately through\n// the core connections / oauth surface.\n// ---------------------------------------------------------------------------\n\nconst AddRemoteServerPayload = Schema.Struct({\n transport: Schema.optional(Schema.Literal(\"remote\")),\n name: Schema.String,\n endpoint: Schema.String,\n remoteTransport: Schema.optional(Schema.Literals([\"streamable-http\", \"sse\", \"auto\"])),\n slug: Schema.optional(Schema.String),\n queryParams: Schema.optional(StringMap),\n headers: Schema.optional(StringMap),\n /** Declared auth methods a connection can be applied through. */\n authenticationTemplate: Schema.optional(Schema.Array(McpAuthMethodInput)),\n /** Single-method shorthand (legacy callers); ignored when\n * `authenticationTemplate` is present. */\n auth: Schema.optional(McpAuthShorthand),\n});\n\nconst AddStdioServerPayload = Schema.Struct({\n transport: Schema.Literal(\"stdio\"),\n name: Schema.String,\n command: Schema.String,\n args: Schema.optional(Schema.Array(Schema.String)),\n env: Schema.optional(StringMap),\n cwd: Schema.optional(Schema.String),\n slug: Schema.optional(Schema.String),\n});\n\nconst AddServerPayload = Schema.Union([AddRemoteServerPayload, AddStdioServerPayload]);\n\nconst ProbeEndpointPayload = Schema.Struct({\n endpoint: Schema.String,\n headers: Schema.optional(StringMap),\n queryParams: Schema.optional(StringMap),\n});\n\nconst ProbeEndpointResponse = Schema.Struct({\n connected: Schema.Boolean,\n requiresAuthentication: Schema.Boolean,\n requiresOAuth: Schema.Boolean,\n supportsDynamicRegistration: Schema.Boolean,\n name: Schema.String,\n slug: Schema.String,\n toolCount: Schema.NullOr(Schema.Number),\n serverName: Schema.NullOr(Schema.String),\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst AddServerResponse = Schema.Struct({\n slug: Schema.String,\n});\n\nconst RemoveServerResponse = Schema.Struct({\n removed: Schema.Boolean,\n});\n\nconst ConfigureServerPayload = Schema.Struct({\n config: McpIntegrationConfig,\n});\n\nconst ConfigureServerResponse = Schema.Struct({\n config: McpIntegrationConfig,\n});\n\n// The configureAuth payload/response — custom auth methods to merge-append\n// onto the integration's `authenticationTemplate` (or `replace` the set).\n// Mirrors the GraphQL/OpenAPI configure endpoints.\nconst ConfigureAuthPayload = Schema.Struct({\n authenticationTemplate: Schema.Array(McpAuthMethodInput),\n mode: Schema.optional(Schema.Literals([\"merge\", \"replace\"])),\n});\n\nconst ConfigureAuthResponse = Schema.Struct({\n authenticationTemplate: Schema.Array(McpAuthMethod),\n});\n\nconst GetServerResponse = Schema.NullOr(\n Schema.Struct({\n slug: IntegrationSlug,\n description: Schema.String,\n kind: Schema.String,\n canRemove: Schema.Boolean,\n canRefresh: Schema.Boolean,\n config: McpIntegrationConfig,\n }),\n);\n\n// ---------------------------------------------------------------------------\n// Group\n//\n// Integrations are tenant-level (no scope segment); plugin domain errors carry\n// their own `HttpApiSchema` status (4xx). `InternalError` is the shared opaque\n// 500 translated at the HTTP edge.\n// ---------------------------------------------------------------------------\n\nexport const McpGroup = HttpApiGroup.make(\"mcp\")\n .add(\n HttpApiEndpoint.post(\"probeEndpoint\", \"/mcp/probe\", {\n payload: ProbeEndpointPayload,\n success: ProbeEndpointResponse,\n error: [InternalError, McpConnectionError, McpToolDiscoveryError],\n }),\n )\n .add(\n HttpApiEndpoint.post(\"addServer\", \"/mcp/servers\", {\n payload: AddServerPayload,\n success: AddServerResponse,\n error: [\n InternalError,\n McpConnectionError,\n McpToolDiscoveryError,\n IntegrationAlreadyExistsError,\n ],\n }),\n )\n .add(\n HttpApiEndpoint.delete(\"removeServer\", \"/mcp/servers/:slug\", {\n params: SlugParams,\n success: RemoveServerResponse,\n error: [InternalError, McpConnectionError, McpToolDiscoveryError],\n }),\n )\n .add(\n HttpApiEndpoint.get(\"getServer\", \"/mcp/servers/:slug\", {\n params: SlugParams,\n success: GetServerResponse,\n error: [InternalError, McpConnectionError, McpToolDiscoveryError],\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configureServer\", \"/mcp/servers/:slug/config\", {\n params: SlugParams,\n payload: ConfigureServerPayload,\n success: ConfigureServerResponse,\n error: [InternalError, McpConnectionError, McpToolDiscoveryError],\n }),\n )\n .add(\n HttpApiEndpoint.post(\"configureAuth\", \"/mcp/servers/:slug/auth\", {\n params: SlugParams,\n payload: ConfigureAuthPayload,\n success: ConfigureAuthResponse,\n error: [InternalError, McpConnectionError, McpToolDiscoveryError],\n }),\n );\n","// ---------------------------------------------------------------------------\n// MCP ↔ generic auth-method converters — a thin oauth adapter over the shared\n// codec (`@executor-js/react/lib/shared-auth-method-codec`). The apikey/none\n// paths (multi-placement, multi-variable) live in the shared codec; MCP only\n// contributes its oauth flavor: endpoint-less methods whose metadata is\n// discovered at connect time (`discoveryUrl` = the MCP endpoint).\n// ---------------------------------------------------------------------------\n\nimport { AuthTemplateSlug } from \"@executor-js/sdk/shared\";\nimport type { AuthTemplateEditorValue } from \"@executor-js/react/components/auth-template-editor\";\nimport type { AuthMethod, Placement } from \"@executor-js/react/lib/auth-placements\";\nimport {\n authMethodFromSharedTemplate,\n editorValueFromSharedMethod,\n sharedMethodInputFromEditorValue,\n wirePlacementsFromEditor,\n} from \"@executor-js/react/lib/shared-auth-method-codec\";\n\nimport { wireAuthInputFromShared } from \"@executor-js/react/lib/shared-auth-method-codec\";\nimport type { McpAuthMethod, McpAuthMethodInput, McpCanonicalAuthMethodInput } from \"../sdk/types\";\n\n/** Serialize a canonical method into the wire input union (apikey → the\n * request-shaped dialect; none/oauth2 pass through). */\nexport const mcpWireAuthInput = (\n method: McpAuthMethod | McpCanonicalAuthMethodInput,\n): McpAuthMethodInput => wireAuthInputFromShared(method) as McpAuthMethodInput;\n\nconst oauthAuthMethod = (slug: string, endpoint: string): AuthMethod => ({\n id: slug,\n label: \"OAuth\",\n kind: \"oauth\",\n source: slug.startsWith(\"custom_\") ? \"custom\" : \"spec\",\n template: AuthTemplateSlug.make(slug),\n placements: [],\n oauth: { discoveryUrl: endpoint, supportsDynamicRegistration: true },\n});\n\n/** Convert a generic editor value into one MCP auth-method input (no slug —\n * the backend assigns carrier-derived slugs). An apikey value keeps every\n * named placement (headers and query params mix freely); one with no usable\n * placement falls back to `none`. */\nexport function mcpAuthMethodInputFromEditorValue(\n value: AuthTemplateEditorValue,\n): McpCanonicalAuthMethodInput {\n if (value.kind === \"oauth\") return { kind: \"oauth2\" };\n return (sharedMethodInputFromEditorValue(value) ?? {\n kind: \"none\",\n }) as McpCanonicalAuthMethodInput;\n}\n\n/** Convert one stored MCP method into the generic editor value. */\nexport function editorValueFromMcpAuthMethod(method: McpAuthMethod): AuthTemplateEditorValue {\n if (method.kind === \"oauth2\") {\n return { kind: \"oauth\", authorizationUrl: \"\", tokenUrl: \"\", scopes: [] };\n }\n return editorValueFromSharedMethod(method);\n}\n\n/** Project the stored methods into the generic `AuthMethod[]` the hub renders.\n * Mirrors the server's `describeMcpAuthMethods`; `custom_` slugs mark\n * user-created methods (removable from the hub). `endpoint` feeds the oauth\n * method's probe-at-connect `discoveryUrl`. */\nexport function authMethodsFromConfig(\n methods: readonly McpAuthMethod[],\n endpoint: string,\n): AuthMethod[] {\n return methods.map((method: McpAuthMethod): AuthMethod => {\n if (method.kind === \"oauth2\") return oauthAuthMethod(method.slug, endpoint);\n return authMethodFromSharedTemplate(method);\n });\n}\n\n/** Build the MCP method input for a custom method from generic placements —\n * ONE method carrying every named placement (header + query mix in a single\n * method; each placement renders from its own input variable, or shares one).\n * Empty when no placement is usable. */\nexport function mcpAuthMethodInputsFromPlacements(\n placements: readonly Placement[],\n): McpCanonicalAuthMethodInput[] {\n const wire = wirePlacementsFromEditor(placements);\n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