DEV Community

Cojiroooo
Cojiroooo

Posted on

3 1

MCP using node on asdf

What happend?

I tried this tutorial( 👉https://modelcontextprotocol.io/quickstart ) , and encountered following error in MCP log when I started the Claude Desktop App.

2024-12-12T07:24:00.201Z [error] Could not start MCP server weather: Error: spawn node ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn node',
  path: 'node',
  spawnargs: [Array]
}
Enter fullscreen mode Exit fullscreen mode

Environment

macOS 14.3.1(Sonoma)
asdf v0.13.1
node v20.11.0

% which node
/Users/user_name/.asdf/shims/node
Enter fullscreen mode Exit fullscreen mode

Solution

My claude_desktop_config.json has problems.
I changed laude_desktop_config.json like "after" and restarted the Claude Desktop App.

  • before
{
    "mcpServers": {
        "weather": {
            "command": "node",
            "args": [
                "/Users/user_name/develop/mcp/tutorial/weather-server/build/index.js"
            ]
        }
    }
}
Enter fullscreen mode Exit fullscreen mode
  • after
{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["/Users/user_name/develop/mcp/tutorial/weather-server/build/index.js"],
      "env": {
        "PATH": "/Users/user_name/.asdf/shims:/usr/bin:/bin",
        "ASDF_DIR": "/opt/homebrew/opt/asdf/libexec",
        "ASDF_DATA_DIR": "/Users/user_name/.asdf",
        "ASDF_NODEJS_VERSION": "20.11.0"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

I add "env" key.
ASDF_DIR is set this(↓) value.

% echo $ASDF_DIR                             
/opt/homebrew/opt/asdf/libexec
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (2)

Collapse
 
vertis profile image
Luke Chadwick •

Thank you!

Collapse
 
hyperfocus profile image
Hyperfocus •

OMG you really saved me there, thanks!!!

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay