You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A local MCP server entry may declare an empty command and is then launched with no executable #818
exportconstMcpLocal=z.object({type: z.literal("local").describe("Type of MCP server connection"),command: z.string().array().describe("Command and arguments to run the MCP server"),
...
})
z.string().array() accepts an empty list. The connection is then started from src/mcp/index.ts:918:
With mcp.command === [], cmd is undefined, so the launch is attempted with file: undefined — a sandbox-wrapped spawn of nothing. The failure surfaces far from the config that caused it, as an MCP server that will not start.
Why it is wrong
An MCP entry with an empty command is a configuration mistake with no valid interpretation: there is no executable to run. It should be rejected where the mistake is, not turned into a spawn attempt.
Compare McpRemote, which validates its url in the schema. A local server's command is the equivalent required field, and it is the only part of the entry with nothing to fall back on.
Repro
Config.McpLocal.safeParse({type: "local",command: []})// -> { success: true } an empty command is accepted
which then reaches Sandbox.wrapArgv({ file: undefined, args: [] }).
Suggested fix
command: z.string().array().min(1,'A local MCP server needs a command to run, for example ["npx", "-y", "my-mcp-server"]').describe("Command and arguments to run the MCP server"),
The message names the field problem and shows a working example, matching the style of the other schema messages in this file.
test/config/mcp-command-schema.test.ts is new and covers a valid command, the empty list, a bare string, a non-string element, and that the rejection message mentions command.
Activity