Connecting Your MCP Server to Claude Desktop

Wire your local MCP server to Claude Desktop -- edit claude_desktop_config.json, understand why you need the full node path, suppress deprecation warnings, and debug logs when things break.

April 1, 20267 min read3 / 7

You have a running MCP server. Now let's connect it to an actual AI and watch the LLM call your tool in response to a plain-English prompt.

This requires one JSON config file. It's not automatic -- Claude Desktop doesn't scan your computer for MCP servers. You tell it exactly what to run.


Finding the Config File

Open Claude Desktop → SettingsDeveloperEdit Config.

This opens claude_desktop_config.json in your default editor. On Mac it's at:

Plain text
~/Library/Application Support/Claude/claude_desktop_config.json

On Windows:

Plain text
%APPDATA%\Claude\claude_desktop_config.json

If the file doesn't exist yet, Claude Desktop creates it when you first open the config. An empty server list looks like:

JSON
{ "mcpServers": {} }

Adding Your Server

Add an entry under mcpServers:

JSON
{ "mcpServers": { "demo": { "command": "/full/path/to/node", "args": ["/full/path/to/my-mcp-server/mcp.js"], "env": { "NODE_NO_WARNINGS": "1" } } } }
⚠️ Use full paths, not relative ones. Claude Desktop spawns processes from its own working directory, not yours. node mcp.js won't work. You need the complete absolute path to both the node binary and your .js file.

Finding Your Node Path

Bash
which node # Example outputs: # /usr/local/bin/node (typical Mac/Linux) # /Users/you/.fnm/... (if using FNM) # /Users/you/.nvm/... (if using NVM)

Copy the full output and paste it as the "command" value.

Finding Your Script Path

Bash
# Navigate to your project directory: cd ~/Desktop/my-mcp-server pwd # Output: /Users/you/Desktop/my-mcp-server # Your script path: /Users/you/Desktop/my-mcp-server/mcp.js

Why NODE_NO_WARNINGS?

Node.js sometimes outputs deprecation warnings like:

Plain text
ExperimentalWarning: The fs.promises API is experimental DeprecationWarning: Buffer() is deprecated

These go to stdout -- the same channel Claude Desktop reads tool results from. If a deprecation warning appears mixed with your JSON response, Claude Desktop gets confused. It receives garbled data that isn't valid JSON and can't parse the tool result.

JSON
"env": { "NODE_NO_WARNINGS": "1" }

This suppresses all Node.js warnings from stdout. It won't hide actual errors -- it only silences the informational warnings that would pollute your MCP responses.

ℹ️ This isn't always necessary. If your specific Node version doesn't produce deprecation warnings for the packages you're using, you might not see any issues. But it's a good habit to include it -- it costs nothing and prevents a class of mysterious debugging sessions.

The Full Config Example

JSON
{ "mcpServers": { "demo": { "command": "/usr/local/bin/node", "args": ["/Users/you/Desktop/my-mcp-server/mcp.js"], "env": { "NODE_NO_WARNINGS": "1" } }, "weather": { "command": "/usr/local/bin/node", "args": ["/Users/you/Desktop/my-mcp-server/weather.js"], "env": { "NODE_NO_WARNINGS": "1" } } } }

Multiple servers are supported. Each gets its own entry. The key ("demo", "weather") is just a label -- pick anything descriptive.


Restart Required Every Time

After any config change or code change, fully quit and reopen Claude Desktop. Not just close the window -- quit the application (Cmd+Q on Mac).

This is one of the more annoying parts of the development loop. The servers are spawned at startup. There's no hot reload.

⚠️ Every code change requires a restart. Edit your mcp.js, save it, but if Claude Desktop is still running it's still running the old version. Always fully quit and reopen after changes.

Verifying Your Server Loaded

Once Claude Desktop reopens:

  1. Click the Tools icon (the plug icon or similar, bottom of the chat input)
  2. You should see your server name and its tools listed
  3. You can toggle individual tools on/off here

If you don't see your server, there's an error -- head to the logs.


Reading Logs When Things Break

Settings → Developer → Open Logs Folder

You'll see log files named after each MCP server. Open the most recent one for your server and scroll to the bottom.

Common errors:

Plain text
Error: Cannot find module '@modelcontextprotocol/sdk/server/mcp.js'

→ Wrong path to the script, or packages not installed in that directory. Run npm install in the project folder.

Plain text
SyntaxError: Cannot use import statement in a module

→ Missing "type": "module" in your package.json.

Plain text
Cannot find module 'api-based-tools.js'

→ Relative import without the .js extension. Add it.

Plain text
Error: ENOENT: no such file or directory

→ The path in args doesn't exist. Double-check pwd output.


First Real LLM Interaction

Once your server is connected:

  1. Open a new chat in Claude Desktop
  2. Type: "Please use the add tool to add 2 and 7"
  3. Claude will show a tool use request -- it's asking permission to call your tool
  4. Click Allow
  5. You'll see the input it sent and the response it received
Plain text
Tool: add Input: { "a": 2, "b": 7 } Result: "9"

Claude's response will be something like: "The sum of 2 and 7 is 9."

That's your code running. Not Claude's math -- your MCP tool's math.

✅ The first time this works is genuinely exciting. An LLM read your tool description, understood the user's intent, extracted the right parameters, and called your deterministic code. That handoff from AI reasoning to your execution is the entire point of MCP.

Adding to Tome (Optional)

If you prefer the open-source Tome client:

  1. Open Tome → Settings
  2. Add server: command = node, args = /full/path/to/mcp.js
  3. No restart required -- Tome handles reconnection automatically

Note: Tome only shows the tools it supports (not resources or prompts). But you don't need to restart to see changes, which is nicer for iteration.


Lab -- Config Validation

JavaScript · Live Editor
Loading editor...

Key Takeaways

  • Config file: claude_desktop_config.json -- find it via Settings → Developer → Edit Config
  • Use full absolute paths for both the node binary and your script
  • NODE_NO_WARNINGS=1 prevents deprecation warnings from polluting tool responses
  • Full restart required after every change to config or server code
  • Logs are your friend -- Settings → Developer → Open Logs Folder shows exactly what went wrong

What's Next

The add tool works but isn't very interesting. Let's build a tool that actually does something useful -- fetching live weather from a real API.

Practice what you just read.

Validate Your Claude Desktop Config
1 exercise