Run This Ai
EN DE

How to Set Up Desktop Commander MCP: AI-Powered Terminal Control in 10 Minutes

Step-by-step tutorial on installing and configuring Desktop Commander MCP. From npm install to first terminal command — with common fixes for mistakes that waste hours.

Desktop Commander MCP Logo

Set Up AI-Powered Terminal Control in 10 Minutes

I remember my first attempt at setting up an MCP server for terminal control. I followed the README, installed the npm package, configured Claude Desktop, and… nothing. The server started but Claude couldn't find it. I spent an hour debugging before realizing I'd put the config in the wrong file.

This tutorial saves you that hour. Here's exactly how to get Desktop Commander running — step by step, with the exact commands, so you don't waste time like I did.

🚀 Want the quick Docker setup?

Full Docker Compose config and system requirements on the tool page.

View Tool Page →

Prerequisites (What You'll Need)

  • Node.js 18+ — check with node --version
  • Claude Desktop (or any MCP-compatible client)
  • npm — comes with Node.js
  • ~10 minutes — grab a coffee, this is quick

Step 1: Install the Package

Open a terminal and run:

npm install -g @wonderwhy-er/desktop-commander

This installs the MCP server globally. It takes about 30 seconds. I chose global install so it's available everywhere, but you can also install per-project if you prefer.

💡 Why I picked this approach: The npm package is the official distribution method from the author. The Docker image on Docker Hub is community-maintained. For reliability, npm is the safest bet.

Step 2: Configure Claude Desktop

This is where I messed up. Claude Desktop reads MCP config from claude_desktop_config.json. On macOS it lives at:

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

On Windows: %APPDATA%\Claude\claude_desktop_config.json

Add or update the mcpServers section:

{
  "mcpServers": {
    "desktop-commander": {
      "command": "npx",
      "args": [
        "-y",
        "@wonderwhy-er/desktop-commander"
      ]
    }
  }
}

⚠️ The mistake I made: I used the npm package name wrong. It's @wonderwhy-er/desktop-commander, not desktop-commander-mcp or anything else. Triple-check the name.

Step 3: Restart Claude Desktop

Fully quit Claude Desktop (Cmd+Q on Mac) and relaunch. You should see a little hammer icon 🔨 in the bottom-right of the input area — that means MCP servers are connected.

Desktop Commander MCP on GitHub

Step 4: Test It Out

Try these prompts to verify everything works:

  • "Run ls -la in my home directory" — should show your files
  • "Find all Python files modified in the last 24 hours" — uses file search
  • "Create a directory called test-mcp and create a hello.txt file in it" — file operations

If Claude responds with actual output from your machine (not just a description of what it would do), you're good.

💡 First test I always do: "What's my current working directory?" If it returns a real path, the connection is alive.

Step 5: Work with the File Preview UI

One feature that caught me off guard: when you ask Claude to edit a file, it can show you a live preview with rendered markdown, inline images, and a built-in markdown editor. It's not automatic — Claude will offer it when relevant. But when it works, you can edit content directly in the preview and save it back.

The key binding to remember: in the markdown editor inside the preview, Cmd+S saves changes back. I spent 5 minutes clicking around before figuring that out.

Common Problems (and How I Fixed Them)

Problem Fix
Claude says "I don't have access to the terminal" Restart Claude Desktop fully (Cmd+Q). Check that the hammer icon appears.
npm install fails with permission errors Use npm install -g with sudo, or configure npm for a local prefix: npm config set prefix ~/.npm-global
Commands time out after 60 seconds Desktop Commander supports configurable timeouts. Ask Claude: "set command timeout to 300 seconds"
File preview shows raw markdown Update to the latest version: npm update -g @wonderwhy-er/desktop-commander

Quick Docker Alternative

If you prefer Docker over npm:

docker run -d --name desktop-commander \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $HOME:/workspace \
  mcp/desktop-commander:latest

This mounts your home directory into the container, giving Desktop Commander access to your files. Be careful — this gives the container full file system access.

Final Thoughts

Setting up Desktop Commander MCP takes maybe 10 minutes, but the payoff is massive. Once it's running, you'll find yourself using it for everything from quick file searches to data analysis to long-running process management. Just remember the golden rule: you're giving an AI terminal access — start with read-only operations, test the waters, and gradually expand what you trust it to do.

🚀 Explore Desktop Commander MCP on Run This Ai

Docker Compose configs, system requirements, installation guides, and more — all in one place.

View Desktop Commander MCP Tool Page →
#mcp #tutorial #desktop-commander #setup #docker