claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] "Error: unknown option '-y'" when adding mcp with npx in native windows installation

Open BeeegZee opened this issue 1 year ago • 3 comments

Environment

  • Platform (select one):
    • [ x ] Anthropic API
  • Claude CLI version: 1.0.53 (Claude Code)
  • Operating System: Windows 10 Pro 22H2
  • Terminal: PowerShell

Bug Description

Trying to add mcp servers that work through npx locally, for example claude mcp add context7 -- npx -y @upstash/context7-mcp Result: error: unknown option '-y received, no server added

Tried reinstalling CC, rebooting terminal and PC, nothing works Not sure if it's the problem in Claude Code or somewhere else

Steps to Reproduce

  1. CC installed natively on Windows
  2. run claude mcp add context7 -- npx -y @upstash/context7-mcp in PowerShell

Expected Behavior

MCP server added successfully

Actual Behavior

error: unknown option '-y received, no server added

Additional Context

It seems HTTP and SSE transport work fine

BeeegZee avatar Jul 17 '25 09:07 BeeegZee

Quick Fix:

{
  "mcpServers": {
    "context7": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "@upstash/context7-mcp"]
    }
  }
}

scervellera avatar Jul 17 '25 10:07 scervellera

Hey, I think this is a mirror of:

https://github.com/issues/assigned?issue=anthropics%7Cclaude-code%7C3369

ollie-anthropic avatar Jul 18 '25 01:07 ollie-anthropic

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jul 30 '25 14:07 github-actions[bot]