Skip to content

fix: reorder 'claude mcp add' arguments so the printed command parses - #270

Merged
TAJD merged 1 commit into
TAJD:mainfrom
gn-spawn:fix/mcp-add-argument-order
Aug 10, 2026
Merged

fix: reorder 'claude mcp add' arguments so the printed command parses#270
TAJD merged 1 commit into
TAJD:mainfrom
gn-spawn:fix/mcp-add-argument-order

Conversation

@gn-spawn

Copy link
Copy Markdown
Contributor

Problem

The claude mcp add command shown in Settings → Tokens (and in the API's mcpAddCommandTemplate, README, and docs) places --transport/--header options before the positional name/url arguments. The claude CLI enforces positional-first parsing for mcp add, so copy-pasting the command fails with:

error: missing required argument 'name'

Fix

Reorder to positionals-first everywhere the command is emitted or documented:

claude mcp add projektor "https://.../mcp/<uuid>" \
  --transport http \
  --header "Authorization: Bearer pk_..." \
  --header "X-Workspace-Slug: ..."

Verified both forms against the claude CLI: options-first reproduces the error, positionals-first adds the server successfully. AGENTS.md's interleaved variant (add projektor --transport http <url>) already parses, so it's left unchanged. Existing test assertions (toContain("claude mcp add")) still pass.

Files: TokenManager.tsx (UI), services/workspaces.ts (API template), README.md, docs/agents/mcp-connection.md (×2), llms.txt.

Aware of the auto-close policy for external PRs — filing this as a reference patch, feel free to adopt however suits.

🤖 Generated with Claude Code

The command templates put --transport/--header before the positional
name/url arguments. The claude CLI enforces positional-first parsing for
'mcp add', so the copy-pasted command fails with:

    error: missing required argument 'name'

Reproduced with claude CLI 2.x: options-first fails, positionals-first
succeeds. Fixed the UI template, the API-served template, README, docs,
and llms.txt. (AGENTS.md's variant already parses and is left as-is.)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TAJD
TAJD merged commit a239c39 into TAJD:main Aug 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants