[BUG] Windows/PowerShell 5.1: bare -- in 'claude mcp add' is stripped by the shell, producing a misleading "missing required argument 'commandOrUrl'"

Status Open
Maintainer reply None cached
Activity 1 comment · opened Aug 28, 2026

Summary

In PowerShell 5.1, the bare -- separator in claude mcp add is consumed by the shell before it
reaches the CLI, so the command fails claiming an argument is missing that the user did in fact
supply. The error text points at the wrong thing and sends people hunting for a quoting problem.

Reproduction

PowerShell 5.1:

claude mcp add -s local my-server `
  -e SOME_VAR=value `
  -- C:\Users\<user>\bin\my-server.exe

Result:

error: missing required argument 'commandOrUrl'

The same command works in PowerShell 7, which passes -- through.

Why the message is misleading

commandOrUrl was provided. PowerShell 5.1 strips the bare -- from argv, so the CLI sees
the executable path in the separator's position and reports the positional argument as missing.
A user reasonably concludes they have a quoting or line-continuation problem, and neither
'single' nor "double" quoting changes anything. It cost roughly 20 minutes of trial and error
before the shell was identified as the cause, and only after a diff between PS 5.1 and PS 7
behaviour was suggested.

Workarounds, for the docs if nothing else

  • Drop the --. It is only needed when the target command has flags of its own that would

otherwise be parsed by claude. For a bare executable path it is unnecessary, and omitting it
works in PS 5.1.

  • Wrap the invocation: cmd --% /c claude mcp add ....
  • Use PowerShell 7.

Expected behaviour

Either of:

  • detect that no commandOrUrl was received while a trailing positional exists, and emit an

actionable error naming PowerShell 5.1 and the -- stripping;

  • document the caveat in claude mcp add --help and in the MCP docs, since -- appears in every

example including the built-in ones.

Given that PowerShell 5.1 ships as the default on Windows, every Windows user following the
documented examples verbatim hits this.

Environment

Claude Code VS Code extension, native Windows, PowerShell 5.1. Exact Claude Code version was not
captured. Reported second-hand from the affected user's session output; the error string above is
quoted verbatim from it.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗