node.jsmacosclaudeanthropicmodel-context-protocol

Cannot build Claude MCP environment on Mac as expected


I am able to use the mcp-server-sqlite setup with uvx from the Mac desktop Claude app which works as expected. However, neither of the following is working.

Setting up with npx

claude_desktop_config.json

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/xxx/Desktop"
      ]
    }
  }
}
==> /Users/xxx/Library/Logs/Claude/mcp-server-filesystem.log <==
command not found: /Users/xxx/Desktop

But the following commands are working.

npx @modelcontextprotocol/server-filesystem '/Users/xxx/Desktop'           
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/users/xxx/desktop' ]

Setting up with node

claude_desktop_config.json

{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": [
        "/usr/local/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js",
        "/Users/xxx/Desktop"
      ]
    }
  }
}
==> /Users/xxx/Library/Logs/Claude/mcp-server-filesystem.log <==
/usr/local/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js:2
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

But the following commands are working.

node /usr/local/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js /Users/xxx/Desktop
Secure MCP Filesystem Server running on stdio
Allowed directories: [ '/users/xxx/desktop' ]

Perhaps I am missing some setting. What should I do? Any tips would be appreciated to help me.


Solution

  • I also ran into this issue. In my case, the problem was caused by old versions of node that were still installed (via nvm). After cleaning the old installation the issue was resolved.