Claude Code · tool · fg-0484

claude mcp add treats the MCP server's own flags as Claude Code options

If you see error: unknown option '--port', the cause and the fix for Claude Code are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
error: unknown option '--port'The server is not added, so claude mcp get reports no server by that name
Cause
Without a double dash, Claude Code parses everything on the line as its own options, so server flags are consumed or rejected. Everything after -- is passed to the server untouched.
Fix
Put Claude Code options such as --transport, --env, and --scope before the server name, then -- and the server command with its own flags.
Apply
claude mcp add --transport stdio --env KEY=value --scope project myserver -- python server.py --port 8080
Affected
Claude Code claude mcp add, as of 2026-10
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun