History

remove legacy compatibility codepaths

Rhys Sullivan committed 7 months ago

Commit ddd3aaa1 parent e2977a021 files · +111 −1158Browse files

Showing the changes to plugins/mcp (2 of 21 files). Show all

Unified · Split

2 files
  1. plugins/mcp/sdk/index.ts +0 −56
  2. plugins/mcp/sdk/tools.test.ts +1 −1
plugins/mcp/sdk/index.ts+0−56
@@ -249,37 +249,12 @@ const normalizeStringArray = ( · 248 unmodified lines
249 return normalized.length > 0 ? normalized : null;249 return normalized.length > 0 ? normalized : null;
250};250};
251 251
252const decodeMcpAuthOption = Schema.decodeUnknownOption(McpConnectionAuthSchema);
253const decodeMcpCurrentLocalConfigOption = Schema.decodeUnknownOption(252const decodeMcpCurrentLocalConfigOption = Schema.decodeUnknownOption(
254 createPluginLocalConfigEntrySchema({253 createPluginLocalConfigEntrySchema({
255 kind: "mcp",254 kind: "mcp",
256 config: McpStoredSourceDataSchema,255 config: McpStoredSourceDataSchema,
257 }),256 }),
258);257);
259const decodeMcpLegacyLocalConfigOption = Schema.decodeUnknownOption(
260 Schema.Struct({
261 kind: Schema.Literal("mcp"),
262 name: Schema.optional(Schema.String),
263 namespace: Schema.optional(Schema.String),
264 enabled: Schema.optional(Schema.Boolean),
265 connection: Schema.optional(
266 Schema.Struct({
267 endpoint: Schema.optional(Schema.NullOr(Schema.String)),
268 auth: Schema.optional(Schema.Unknown),
269 }),
270 ),
271 binding: Schema.Struct({
272 transport: Schema.optional(Schema.NullOr(SourceTransportSchema)),
273 queryParams: Schema.optional(Schema.NullOr(StringMapSchema)),
274 headers: Schema.optional(Schema.NullOr(StringMapSchema)),
275 command: Schema.optional(Schema.NullOr(Schema.String)),
276 args: Schema.optional(Schema.NullOr(StringArraySchema)),
277 env: Schema.optional(Schema.NullOr(StringMapSchema)),
278 cwd: Schema.optional(Schema.NullOr(Schema.String)),
279 }),
280 config: Schema.optional(Schema.Unknown),
281 }),
282);
283 258
284const normalizeStoredSourceData = (259const normalizeStoredSourceData = (
285 input: McpConnectInput | McpSourceConfigPayload,260 input: McpConnectInput | McpSourceConfigPayload,
@@ -399,37 +374,6 @@ const mcpStoredSourceDataFromLocalConfig = ( · 113 unmodified lines
399 return Effect.succeed(current.value.config);374 return Effect.succeed(current.value.config);
400 }375 }
401 376
402 const legacy = decodeMcpLegacyLocalConfigOption(config);
403 if (Option.isSome(legacy)) {
404 const auth = decodeMcpAuthOption(legacy.value.connection?.auth);
405 if (
406 legacy.value.connection?.auth !== undefined &&
407 Option.isNone(auth)
408 ) {
409 return runtimeEffectError(
410 "plugins/mcp/sdk",
411 "Unsupported MCP auth configuration in local source config.",
412 );
413 }
414
415 return normalizeStoredSourceData({
416 name: legacy.value.name ?? "MCP",
417 endpoint: legacy.value.connection?.endpoint ?? null,
418 transport: legacy.value.binding.transport ?? null,
419 queryParams: legacy.value.binding.queryParams ?? null,
420 headers: legacy.value.binding.headers ?? null,
421 command: legacy.value.binding.command ?? null,
422 args: legacy.value.binding.args ?? null,
423 env: legacy.value.binding.env ?? null,
424 cwd: legacy.value.binding.cwd ?? null,
425 auth: Option.isSome(auth)
426 ? auth.value
427 : {
428 kind: "none",
429 },
430 });
431 }
432
433 return runtimeEffectError(377 return runtimeEffectError(
434 "plugins/mcp/sdk",378 "plugins/mcp/sdk",
435 "Unsupported MCP local source config.",379 "Unsupported MCP local source config.",
plugins/mcp/sdk/tools.test.ts+1−1
@@ -500,7 +500,7 @@ describe("codemode-mcp", () => { · 499 unmodified lines
500 action: "accept" as const,500 action: "accept" as const,
501 };501 };
502 }),502 }),
503 path: "executor.sources.add" as ToolPath,503 path: "executor.mcp.createSource" as ToolPath,
504 sourceKey: "executor",504 sourceKey: "executor",
505 args: {505 args: {
506 endpoint: "https://example.com/mcp",506 endpoint: "https://example.com/mcp",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t