fix: revert ServerConfigSchema to union. (#3716)
This type was changed from a union to a discriminated union based on transportType. It seems like this is an internal implementation detail that end users shouldn't really care about. This change reverts that type back to a union. Co-authored-by: Adil Riazudeen <adiriazu@amazon.com>
This commit is contained in:
1 parent
782ed7ff21
commit
331da0f802
2 files changed
+18
-6
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
no longer requires `transportType` property to be set in MCP Server configuration.
|
||||
@@ -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),
|
||||
|
||||
Reference in new issue
Block a user