MCP server: argument values beginning with '-' are parsed as CLI flags (no '--' separator)

Author: chahollCreated Sep 26, 2026Updated Sep 26, 2026

Summary. agent-browser mcp builds each tool call's CLI argv from the tool's typed arguments without a -- end-of-options separator. A string value that starts with - is therefore parsed as a flag.

Repro (v0.38.1, agent-browser mcp --tools core):

  • agent_browser_open with {"url":"--headed"} relaunches the browser headed.
  • agent_browser_click with {"selector":"--help"} prints the CLI help.

Why it matters. The MCP server's typed-argument design exists so that clients can approve structured calls ("each tool has typed fields … so MCP clients show meaningful approval prompts instead of raw command arrays"). Flag injection through a value undoes that: a model-controlled url or selector can switch on options the client never approved. In our case that means a sandbox that deliberately withholds extraArgs.

Suggested fix. Emit -- before positional values when building argv from MCP arguments, or pass values in a way the CLI parser cannot read as flags.

Workaround we use. Refuse any string argument that starts with - in a proxy in front of the MCP server. This blocks legitimate text such as fill values that begin with a hyphen.

Source: vercel-labs/agent-browser