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.
Ensure you've downloaded and installed the Claude Desktop app and have npm installed before setting up Desktop Commander.
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
npx @wonderwhy-er/desktop-commander setup
Remember to restart Claude if it's already running.
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.
git clone https://github.com/wonderwhy-er/ClaudeComputerCommander.git
cd ClaudeComputerCommander
npm run setup
Restart Claude if it's already running.
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
For commands that may take a while to complete:
execute_command
returns after timeout with initial outputread_output
with the PID to get new outputforce_terminate
to stop the command if neededThe project is actively being developed with planned improvements for:
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.
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"
]
}
}
}
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.
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.