fix(setup): read an OpenCode V2 server named type as a table entry (#866)
Only a string type is the V1 entry discriminator; a native mcp.servers table may hold a server object named type. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bb19c9477e
commit
4e17be5705
@@ -108,11 +108,15 @@ export const parseClientConfiguration = (
|
||||
const value = document[serversKey];
|
||||
const servers = value === undefined ? {} : objectSchema.parse(value);
|
||||
const native = servers.servers;
|
||||
// A V1 server named `servers` is an entry with a `type`; the V2 table is not.
|
||||
// A V1 server named `servers` has a string `type` discriminator; the V2
|
||||
// table may instead hold a server object named `type`.
|
||||
if (
|
||||
format !== "opencode" ||
|
||||
native === undefined ||
|
||||
(typeof native === "object" && native !== null && "type" in native)
|
||||
(typeof native === "object" &&
|
||||
native !== null &&
|
||||
"type" in native &&
|
||||
typeof native.type === "string")
|
||||
)
|
||||
return {
|
||||
document,
|
||||
|
||||
Reference in New Issue
Block a user