[bug]解决vscode+cline使用mcp服务报错spawn npx enoent spawn npx enoent

在使用MCP(Model Context Protocol)协议进行大模型的使用时候,报错

首先我在cmd出口和ps窗口都对node环境进行查看,如下:

首先要说明下npx是在npm v5.2.0开始引进的命令,更好的安装最新版本的包,而mcp服务大部分都是通过js写的并发布的,所以需要你安装相应的node依赖,而mcp服务是Anthropic 公司推出的,首先支持的是claude这种工具,而他们的编程环境是mac电脑,因此对windows支持不太好,也就是说我明明已经配置好了node的环境,并且在系统环境变量中配置好了,采用的是.msi的安装方式进行安装(就是下载安装包安装),所以要将这个命令换为cmd后者绝对路径来执行:

解决办法:

就是说不要以uvx直接执行

javascript 复制代码
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mongo-server",
        "mongodb://muhammed:kilic@mongodb.localhost/sample_namespace"
      ]
    },
}

正确:

javascript 复制代码
{
  "mcpServers": {
    "mongodb": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "mcp-mongo-server",
        "mongodb://192.168.0.52:27017/school_db?authSource=admin"
      ],
      }
   }
 }

参考:

csharp 复制代码
https://github.com/cline/cline/issues/1948
https://github.com/cline/cline/issues/902
https://smithery.ai/
相关推荐
tan180°8 小时前
MySQL表的操作(3)
linux·数据库·c++·vscode·后端·mysql
zzc9218 小时前
Adobe Illustrator设置的颜色和显示的颜色不对应问题
adobe·bug·illustrator·错误·配色·透明度·底色
万千思绪11 小时前
【PyCharm 2025.1.2配置debug】
ide·python·pycharm
我在看世界13 小时前
家里vscode连公司内网vscede
vscode·ssh
不想迷路的小男孩16 小时前
Android Studio 中Palette跟Component Tree面板消失怎么恢复正常
android·ide·android studio
AlickLbc16 小时前
在phpstudy环境下配置搭建XDEBUG配合PHPSTORM的调试环境
ide·phpstorm
悠悠小茉莉16 小时前
Win11 安装 Visual Studio(保姆教程 - 更新至2025.07)
c++·ide·vscode·python·visualstudio·visual studio
SZ17011023117 小时前
华为云 银河麒麟 vscode远程连接
ide·vscode·华为云
yanjiee18 小时前
需要scl来指定编译器的clangd+cmake在vscode/cursor开发环境下的配置
ide·vscode·编辑器
Waltt_Qiope21 小时前
关于使用cursor tunnel链接vscode(避免1006 issue的做法)
ide·vscode·issue