Desktop Commander MCP is a powerful tool that enables Claude to access your file system and terminal, transforming it into a versatile AI assistant for executing commands, managing processes, working with files, and automating tasks - all without additional API token costs.
Run this command in your terminal:
npx @wonderwhy-er/desktop-commander@latest setup
For debugging mode:
npx @wonderwhy-er/desktop-commander@latest setup --debug
curl -fsSL https://raw.githubusercontent.com/wonderwhy-er/DesktopCommanderMCP/refs/heads/main/install.sh | bash
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
Add this entry to your claude_desktop_config.json file located at:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"desktop-commander": {
"command": "npx",
"args": [
"-y",
"@wonderwhy-er/desktop-commander"
]
}
}
}
git clone https://github.com/wonderwhy-er/DesktopCommanderMCP.git
cd DesktopCommanderMCP
npm run setup
When installed through npx or Smithery, Desktop Commander automatically updates to the latest version when you restart Claude.
Desktop Commander provides tools in several categories:
Configuration Tools:
get_config
: View current configurationset_config_value
: Update configuration settingsTerminal Tools:
execute_command
: Run terminal commandsread_output
: Get output from running commandsforce_terminate
: End a terminal sessionlist_sessions
: View active sessionslist_processes
: See running processeskill_process
: Terminate a process by PIDFilesystem Tools:
read_file
: View file contents (local or URL)read_multiple_files
: Open several files at oncewrite_file
: Create or update filescreate_directory
: Make new folderslist_directory
: View folder contentsmove_file
: Rename or relocate filessearch_files
: Find files by namesearch_code
: Look for text patterns in filesget_file_info
: View file metadataText Editing Tools:
edit_block
: Make precise text replacementsFor making targeted changes to files, use this format:
filepath.ext
<<<<<<< SEARCH
content to find
=======
new content
>>>>>>> REPLACE
Example:
src/main.js
<<<<<<< SEARCH
console.log("old message");
=======
console.log("new message");
>>>>>>> REPLACE
allowedDirectories
setting only restricts filesystem operations, not terminal commands.// View current config
get_config({})
// Change shell preference
set_config_value({ "key": "defaultShell", "value": "/bin/zsh" })
// Set allowed directories
set_config_value({ "key": "allowedDirectories", "value": ["/Users/username/projects"] })
// Default shell
execute_command({ "command": "echo $SHELL" })
// Specific shell
execute_command({ "command": "echo $SHELL", "shell": "/bin/zsh" })
execute_command
with appropriate timeoutread_output
with that PID to check progressforce_terminate
if neededThe read_file
tool can fetch content from both local files and URLs by setting the isUrl
parameter to true
.
All tool calls are automatically logged with timestamps and arguments to:
~/.claude-server-commander/claude_tool_call.log
%USERPROFILE%\.claude-server-commander\claude_tool_call.log
Desktop Commander collects limited anonymous telemetry data by default. To opt out, simply ask in chat:
Disable telemetry
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.