Home / MCP / Desktop Commander MCP Server
Provides long-running command execution, process management, and file editing via MCP for Claude Desktop
Configuration
View docs{
"mcpServers": {
"desktop_commander": {
"command": "npx",
"args": [
"-y",
"@wonderwhy-er/desktop-commander"
]
}
}
}You deploy and use the Desktop Commander MCP server to let Claude Desktop execute long-running terminal commands, manage processes, and perform file operations through the Model Context Protocol. This MCP server enables direct, programmatic control over your local machine’s terminal and filesystem from Claude, with output streaming, session management, and code editing capabilities.
You interact with the server through an MCP client integrated in Claude Desktop. Use the Terminal Tools to run commands with timeouts, stream outputs, and manage sessions. Use the Filesystem Tools to read and write files, create and list directories, move files, and search for content. Use the Edit Tools to apply surgical text replacements or rewrite entire files when needed. As you run long-running commands, you can poll for output and terminate sessions if necessary. All actions are exposed as MCP endpoints that you call from your client, allowing you to automate workflows and edits across your filesystem and processes.
Run commands with a configurable timeout and receive streaming output. List active sessions, view running processes, terminate processes by PID, and manage command access with a blacklist.
Key tools you will use include: execute_command, read_output, force_terminate, list_sessions, list_processes, kill_process, block_command, and unblock_command.
Perform full filesystem operations: read and write files, create and list directories, move files, search for content with patterns, and retrieve file metadata.
Edit blocks enable surgical changes for small edits, while write_file allows complete file rewrites for larger changes. Use a pattern-based replacement approach when making targeted edits, and apply full rewrites for major updates.
Use a block format to describe replacements precisely. The format starts with the file path, followed by a search region, and then the replacement region.
Example:
src/main.js
<<<<<<< SEARCH
console.log("old message");
=======
console.log("new message");
>>>>>>> REPLACERun terminal commands with a configurable timeout and streaming output.
Retrieve incremental output from long-running commands using a running session PID.
Terminate an active command session to stop execution immediately.
List all currently active command sessions for monitoring.
Display processes currently running on the system.
Terminate a specific process using its PID.
Blacklist specific commands to prevent their execution.
Remove a command from the blacklist to allow execution again.
Read the contents of a file.
Write or overwrite file contents.
Create a new directory.
List files and subdirectories within a directory.
Move or rename a file or directory.
Search for files matching a pattern.
Retrieve file metadata such as size, permissions, and timestamps.
Apply surgical text replacements using a search/replace block format.
Rewrite an entire file when large changes are required.