Claude Code · tool · fg-0484
claude mcp add treats the MCP server's own flags as Claude Code options
error: unknown option '--port'
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
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
Affects: Claude Code claude mcp add, as of 2026-10
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp