Claude Desktop Commander MCP server

Enables Claude Desktop to execute terminal commands and manage files on the user's computer with security measures like command blacklisting and path validation for cross-platform development workflows.
Back to servers
Provider
Eduard Ruzga
Release date
Mar 24, 2025
Language
TypeScript
Stats
1 star

Desktop Commander MCP is a server that enables Claude desktop app to execute terminal commands on your computer and manage processes through Model Context Protocol (MCP). It also provides file editing capabilities with search and replace functionality, built on top of MCP Filesystem Server.

Installation

Ensure you've downloaded and installed the Claude Desktop app and have npm installed before setting up Desktop Commander.

Via Smithery

npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude

Via NPX

npx @wonderwhy-er/desktop-commander setup

Remember to restart Claude if it's already running.

Manual Configuration

Add this entry to your claude_desktop_config.json (on Mac, located at ~/Library/Application\ Support/Claude/claude_desktop_config.json):

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

Restart Claude if it's already running.

Local Development Setup

git clone https://github.com/wonderwhy-er/ClaudeComputerCommander.git
cd ClaudeComputerCommander
npm run setup

Restart Claude if it's already running.

Available Tools

Terminal Tools

  • execute_command: Run terminal commands with configurable timeout
  • read_output: Get output from long-running commands
  • force_terminate: Stop running command sessions
  • list_sessions: View active command sessions
  • list_processes: View system processes
  • kill_process: Terminate processes by PID
  • block_command/unblock_command: Manage command blacklist

Filesystem Tools

  • read_file/write_file: Basic file operations
  • create_directory/list_directory: Directory management
  • move_file: Move or rename files
  • search_files: Pattern-based file search
  • get_file_info: Get file metadata

Edit Tools

  • edit_block: Apply surgical text replacements (best for changes <20% of file size)
  • write_file: Complete file rewrites (best for large changes >20% or when edit_block fails)

Using the Edit Block Format

The search and replace block format for editing files is:

filepath.ext
<<<<<<< SEARCH
existing code to replace
=======
new code to insert
>>>>>>> REPLACE

For example:

src/main.js
<<<<<<< SEARCH
console.log("old message");
=======
console.log("new message");
>>>>>>> REPLACE

Handling Long-Running Commands

For commands that may take a while to complete:

  1. execute_command returns after timeout with initial output
  2. The command continues running in the background
  3. Use read_output with the PID to get new output
  4. Use force_terminate to stop the command if needed

Upcoming Features

The project is actively being developed with planned improvements for:

  • Better code search with context-aware results
  • Improved configurations for allowed paths and commands
  • Windows and Linux environment fixes
  • Support for WSL (Windows Subsystem for Linux)
  • SSH integration for remote server execution

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later