diff --git a/.changeset/eleven-dragons-sell.md b/.changeset/eleven-dragons-sell.md new file mode 100644 index 00000000..b05bd612 --- /dev/null +++ b/.changeset/eleven-dragons-sell.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +no longer requires `transportType` property to be set in MCP Server configuration. diff --git a/src/services/mcp/McpHub.ts b/src/services/mcp/McpHub.ts index 9c81e957..b7923a07 100644 --- a/src/services/mcp/McpHub.ts +++ b/src/services/mcp/McpHub.ts @@ -55,23 +55,30 @@ const BaseConfigSchema = z.object({ }) const SseConfigSchema = BaseConfigSchema.extend({ - transportType: z.literal("sse"), url: z.string().url(), -}) +}).transform((config) => ({ + ...config, + transportType: "sse" as const, +})) const StdioConfigSchema = BaseConfigSchema.extend({ - transportType: z.literal("stdio"), command: z.string(), args: z.array(z.string()).optional(), env: z.record(z.string()).optional(), -}) +}).transform((config) => ({ + ...config, + transportType: "stdio" as const, +})) const StreamableHTTPConfigSchema = BaseConfigSchema.extend({ transportType: z.literal("http"), url: z.string().url(), -}) +}).transform((config) => ({ + ...config, + transportType: "http" as const, +})) -const ServerConfigSchema = z.discriminatedUnion("transportType", [StdioConfigSchema, SseConfigSchema, StreamableHTTPConfigSchema]) +const ServerConfigSchema = z.union([StdioConfigSchema, SseConfigSchema, StreamableHTTPConfigSchema]) const McpSettingsSchema = z.object({ mcpServers: z.record(ServerConfigSchema),