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
3.9K stars

Desktop Commander MCP allows you to leverage Claude's AI capabilities to interact with your file system, execute terminal commands, and manage processes directly from the chat interface. It extends Claude beyond just conversation, turning it into a powerful tool for developers.

Installation

To install Desktop Commander MCP, you have several options:

Option 1: Install through npx (Recommended)

This method provides automatic updates when you restart Claude:

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

For debugging mode:

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

To uninstall:

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

Option 2: Using Smithery

Another option with automatic updates:

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

To uninstall:

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

Basic Usage

Desktop Commander provides tools in several categories:

Terminal Commands

Execute terminal commands and manage processes:

// Execute a command
execute_command({ "command": "ls -la" })

// Start a process
start_process({ "command": "node" })

// Interact with a running process
interact_with_process({ "sessionId": "123", "input": "console.log('Hello World')" })

// List all running processes
list_processes({})

File Operations

Read, write, and manage files:

// Read a file
read_file({ "path": "/path/to/file.txt" })

// Read a file from the web
read_file({ "path": "https://example.com/data.json", "isUrl": true })

// Write to a file
write_file({ "path": "/path/to/file.txt", "content": "Hello, world!" })

// List directory contents
list_directory({ "path": "/path/to/directory" })

// Search for files
search_files({ "path": "/path/to/directory", "pattern": "*.js" })

// Search within file contents
search_code({ "path": "/path/to/directory", "pattern": "function getUser" })

Text Editing

Make surgical edits to files:

// Edit a specific block of text
edit_block({
  "filepath": "src/main.js",
  "search_text": "console.log(\"old message\");",
  "replace_text": "console.log(\"new message\");"
})

Alternative format for edit_block:

edit_block({
  "filepath": "src/main.js",
  "block": `<<<<<<< SEARCH
console.log("old message");
=======
console.log("new message");
>>>>>>> REPLACE`
})

Configuration Management

You can customize Desktop Commander's behavior:

// Get current configuration
get_config({})

// Set specific configuration values
set_config_value({ "key": "defaultShell", "value": "/bin/zsh" })
set_config_value({ "key": "allowedDirectories", "value": ["/Users/username/projects"] })
set_config_value({ "key": "fileWriteLineLimit", "value": 100 })

Important security note: The allowedDirectories setting only restricts filesystem operations, not terminal commands.

Working with Long-Running Commands

For commands that may take a while:

  1. Start a process with start_process
  2. Use interact_with_process to send input
  3. Use read_process_output to get new output
  4. Use force_terminate to stop if needed

Example workflow:

// Start a Node.js REPL
const response = start_process({ "command": "node" })
const sessionId = response.sessionId

// Send commands to the REPL
interact_with_process({ 
  "sessionId": sessionId, 
  "input": "console.log('Hello from Node.js')" 
})

// Read the latest output
read_process_output({ "sessionId": sessionId })

// When finished, terminate the session
force_terminate({ "sessionId": sessionId })

Privacy & Security

By default, Desktop Commander collects anonymous telemetry data. To disable this:

  1. Simply ask "Disable telemetry" in the chat
  2. The system will update your settings automatically

All tool calls are logged locally for auditing purposes in:

  • macOS/Linux: ~/.claude-server-commander/claude_tool_call.log
  • Windows: %USERPROFILE%\.claude-server-commander\claude_tool_call.log

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