目前按照官方写在官方文档的说法,
Windows Users: On native Windows (not WSL), local MCP servers that use npx
require the cmd /c
wrapper to ensure proper execution.
Copy
# This creates command="cmd" which Windows can execute
claude mcp add my-server -- cmd /c npx -y @some/package
Without the cmd /c
wrapper, you’ll encounter “Connection closed” errors because Windows cannot directly execute npx
.
成功添加后,在Windows系统的用户环境文件夹中,.claude.json里的末尾会增加一段,除了上面的命令外,也可以直接修改json添加。如:
“mcpServers”: {
“context7”: {
“command”: “cmd”,
“args”: [
“/c”,
“npx”,
“-y”,
“@upstash/context7-mcp@latest”
]
},
“playwright”: {
“command”: “cmd”,
“args”: [
“/c”,
“npx”,
“-y”,
“@executeautomation/playwright-mcp-server@latest”
]
},
“server-memory”: {
“command”: “cmd”,
“args”: [
“/c”,
“npx”,
“-y”,
“@modelcontextprotocol/server-memory@latest”
]
},
“server-sequential-thinking”: {
“command”: “cmd”,
“args”: [
“/c”,
“npx”,
“-y”,
“@modelcontextprotocol/server-sequential-thinking@latest”
]
},
“mcp-shrimp-task-manager”: {
“command”: “cmd”,
“args”: [
“/c”,
“npx”,
“-y”,
“mcp-shrimp-task-manager@latest”
]
}
}