feat(opencode): support cwd on local MCP servers (#30676)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Grant Martin 2026-06-11 16:05:45 -05:00 committed by GitHub
commit 7e7ad37736
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 11 deletions

View file

@ -6,6 +6,9 @@ import { PositiveInt } from "../schema"
export class Local extends Schema.Class<Local>("ConfigV2.MCP.Local")({
type: Schema.Literal("local"),
command: Schema.String.pipe(Schema.Array),
cwd: Schema.String.pipe(Schema.optional).annotate({
description: "Working directory for the MCP server process. Relative paths resolve from the workspace directory.",
}),
environment: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),
disabled: Schema.Boolean.pipe(Schema.optional),
timeout: PositiveInt.pipe(Schema.optional),

View file

@ -8,6 +8,9 @@ export const Local = Schema.Struct({
command: Schema.mutable(Schema.Array(Schema.String)).annotate({
description: "Command and arguments to run the MCP server",
}),
cwd: Schema.optional(Schema.String).annotate({
description: "Working directory for the MCP server process. Relative paths resolve from the workspace directory.",
}),
environment: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({
description: "Environment variables to set when running the MCP server",
}),

View file

@ -139,7 +139,14 @@ function mcp(info: typeof ConfigV1.Info.Type) {
function migrateMcp(info: ConfigMCPV1.Info) {
const disabled = info.enabled === undefined ? undefined : !info.enabled
if (info.type === "local")
return { type: info.type, command: info.command, environment: info.environment, disabled, timeout: info.timeout }
return {
type: info.type,
command: info.command,
cwd: info.cwd,
environment: info.environment,
disabled,
timeout: info.timeout,
}
return {
type: info.type,
url: info.url,