Claude Code 中 MCP 在Windows上警告信息
问题说明
在 Windows 上,直接执行 npx 命令可能无法正常工作,需要通过 cmd /c 来包装执行
解决方法
打开你的配置文件 C:\Users\rog.claude.json,将 MCP 服务器的配置修改为:
{
"mcpServers": {
"context7": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@upstash/context7-mcp"
],
"type": "stdio"
},
"fetch": {
"command": "uvx",
"args": [
"mcp-server-fetch"
],
"type": "stdio"
},
"memory": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-memory"
],
"type": "stdio"
},
"sequential-thinking": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-sequential-thinking"
],
"type": "stdio"
}
}
}
主要改动
context7, memory, sequential-thinking: 将 "command": "npx" 改为 "command": "cmd",并在 args 数组开头添加 "/c", "npx"
fetch: 保持不变,因为它使用的是 uvx 而不是 npx
修改完成后,保存文件并重启 Claude Code,警告就会消失。