CLI (Computer Commander) MCP server

Integrates terminal and filesystem capabilities for executing system commands, managing processes, and performing advanced file operations on the local system.
Back to servers
Setup instructions
Provider
Eduard Ruzga
Release date
Jan 08, 2025
Language
TypeScript
Stats
4.4K stars

Desktop Commander MCP is a server that allows Claude to interact with your file system and terminal, enabling tasks like running commands, searching files, and editing code without API token costs.

Installation Options

Desktop Commander offers several installation methods to suit different needs:

Option 1: Install through npx (Auto-Updates, Requires Node.js)

npx @wonderwhy-er/desktop-commander@latest setup

For debugging mode:

npx @wonderwhy-er/desktop-commander@latest setup --debug

Option 2: Using bash script installer for macOS (Auto-Updates, Installs Node.js if needed)

curl -fsSL https://raw.githubusercontent.com/wonderwhy-er/DesktopCommanderMCP/refs/heads/main/install.sh | bash

Option 3: Installing via Smithery (Auto-Updates, Requires Node.js)

  1. Visit Smithery's Desktop Commander page
  2. Login to Smithery
  3. Select Claude Desktop as your client
  4. Install with the provided key
  5. Restart Claude Desktop

Option 4: Add to claude_desktop_config manually (Auto-Updates, Requires Node.js)

Add this entry to your claude_desktop_config.json:

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

Option 5: Checkout locally (Manual Updates, Requires Node.js)

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

Option 6: Docker Installation (Auto-Updates, No Node.js Required)

macOS/Linux:

bash <(curl -fsSL https://raw.githubusercontent.com/wonderwhy-er/DesktopCommanderMCP/refs/heads/main/install-docker.sh)

Windows PowerShell:

iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/wonderwhy-er/DesktopCommanderMCP/refs/heads/main/install-docker.ps1'))

Uninstalling Desktop Commander

The easiest way to completely remove Desktop Commander:

npx @wonderwhy-er/desktop-commander@latest remove

Usage

Desktop Commander provides several tools organized into categories:

Terminal Tools

  • start_process: Start programs with smart detection of when they're ready for input
  • interact_with_process: Send commands to running programs and get responses
  • read_process_output: Read output from running processes
  • force_terminate: Force terminate a running terminal session
  • list_sessions: List all active terminal sessions
  • list_processes: List all running processes with detailed information
  • kill_process: Terminate a running process by PID

Filesystem Tools

  • read_file: Read contents from local filesystem or URLs with pagination
  • read_multiple_files: Read multiple files simultaneously
  • write_file: Write file contents with options for rewrite or append mode
  • create_directory: Create a new directory or ensure it exists
  • list_directory: Get detailed listing of files and directories
  • move_file: Move or rename files and directories
  • start_search: Start streaming search for files by name or content patterns
  • get_more_search_results: Get paginated results from active search with offset support
  • stop_search: Stop an active search gracefully
  • list_searches: List all active search sessions
  • get_file_info: Retrieve detailed metadata about a file or directory

Text Editing Tools

  • edit_block: Apply targeted text replacements with enhanced prompting

Configuration Tools

  • get_config: Get the complete server configuration as JSON
  • set_config_value: Set a specific configuration value by key

Text Editing Example

Search/Replace Block Format:

filepath.ext
<<<<<<< SEARCH
content to find
=======
new content
>>>>>>> REPLACE

Example:

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

Configuration Management

You can manage server configuration using these tools:

// Get the entire config
get_config({})

// Set a specific config value
set_config_value({ "key": "defaultShell", "value": "/bin/zsh" })

Important config settings include:

  • blockedCommands: Array of shell commands that cannot be executed
  • defaultShell: Shell to use for commands
  • allowedDirectories: Array of filesystem paths the server can access
  • fileReadLineLimit: Maximum lines to read at once (default: 1000)
  • fileWriteLineLimit: Maximum lines to write at once (default: 50)
  • telemetryEnabled: Enable/disable telemetry (boolean)

Handling Long-Running Commands

For commands that may take a while:

  1. Command starts with a timeout for initial output
  2. Command continues in background
  3. Use read_output with PID to get new output
  4. Use force_terminate to stop if needed

Security Considerations

For better security:

  • Change configuration in a separate chat from your actual work
  • The allowedDirectories setting only restricts filesystem operations, not terminal commands
  • For maximum security, use the Docker installation which provides complete isolation

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "desktop-commander" '{"command":"npx","args":["-y","@wonderwhy-er/desktop-commander"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

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

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

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