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.
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 → Settings → Developer → Edit Config.
This opens claude_desktop_config.json in your default editor. On Mac it's at:
~/Library/Application Support/Claude/claude_desktop_config.jsonOn Windows:
%APPDATA%\Claude\claude_desktop_config.jsonIf the file doesn't exist yet, Claude Desktop creates it when you first open the config. An empty server list looks like:
{
"mcpServers": {}
}Adding Your Server
Add an entry under mcpServers:
{
"mcpServers": {
"demo": {
"command": "/full/path/to/node",
"args": ["/full/path/to/my-mcp-server/mcp.js"],
"env": {
"NODE_NO_WARNINGS": "1"
}
}
}
}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
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
# 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.jsWhy NODE_NO_WARNINGS?
Node.js sometimes outputs deprecation warnings like:
ExperimentalWarning: The fs.promises API is experimental
DeprecationWarning: Buffer() is deprecatedThese 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.
"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.
The Full Config Example
{
"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.
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:
- Click the Tools icon (the plug icon or similar, bottom of the chat input)
- You should see your server name and its tools listed
- 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:
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.
SyntaxError: Cannot use import statement in a module→ Missing "type": "module" in your package.json.
Cannot find module 'api-based-tools.js'→ Relative import without the .js extension. Add it.
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:
- Open a new chat in Claude Desktop
- Type: "Please use the add tool to add 2 and 7"
- Claude will show a tool use request -- it's asking permission to call your tool
- Click Allow
- You'll see the input it sent and the response it received
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.
Adding to Tome (Optional)
If you prefer the open-source Tome client:
- Open Tome → Settings
- Add server: command =
node, args =/full/path/to/mcp.js - 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
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=1prevents 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.