How to Configure DesktopCommanderMCP Settings: A Complete Guide
DesktopCommanderMCP stores all runtime configuration in a config.json file controlled by the get_config and set_config_value MCP tools, enabling dynamic updates to security policies, shell preferences, and performance limits.
The DesktopCommanderMCP server by wonderwhy-er/DesktopCommanderMCP provides a flexible, persistent configuration system that survives server restarts. All settings are maintained in config.json located in the server's working directory, allowing administrators to customize security boundaries and resource constraints without modifying source code.
Configuration Architecture and Tools
According to the DesktopCommanderMCP source code in src/server.ts, the server exposes two dedicated MCP tools for configuration management:
get_config– Returns the complete configuration object, including blocked command lists, directory permissions, and telemetry settingsset_config_value– Updates a single configuration key and immediately persists the change toconfig.json
The configuration file is automatically created and maintained in the server's working directory. All changes made through set_config_value take effect immediately and survive server restarts.
Available Configuration Keys
The config.json file supports six configurable keys that control security and performance:
blockedCommands– Array of shell command strings to prevent execution (e.g.,["rm -rf /", "sudo"])defaultShell– Path to the preferred shell executable (e.g.,/bin/bash,/bin/zsh,/bin/sh)allowedDirectories– Array of absolute paths restricting file-system operations; empty array[]grants full filesystem accessfileReadLineLimit– Maximum lines read per file operation (default:1000)fileWriteLineLimit– Maximum lines written per file operation (default:50)telemetryEnabled– Boolean flag controlling anonymous usage reporting
Step-by-Step Configuration Workflow
Inspect Current Settings
Retrieve the complete configuration to verify current values before making changes:
get_config({})
This returns a JSON payload containing all current settings:
{
"blockedCommands": [],
"defaultShell": "/bin/bash",
"allowedDirectories": ["/home/user/projects"],
"fileReadLineLimit": 1000,
"fileWriteLineLimit": 50,
"telemetryEnabled": true
}
Update Individual Values
Modify specific configuration keys using set_config_value. Each call accepts a key and value parameter:
// Change the default shell to Zsh
set_config_value({ "key": "defaultShell", "value": "/bin/zsh" })
// Add additional allowed directories
set_config_value({ "key": "allowedDirectories", "value": [
"/home/user/projects",
"/mnt/shared"
] })
// Increase write limits for batch operations
set_config_value({ "key": "fileWriteLineLimit", "value": 500 })
// Disable telemetry
set_config_value({ "key": "telemetryEnabled", "value": false })
Verify Changes
Confirm your modifications by retrieving the configuration again:
get_config({})
Security and Performance Considerations
Directory Restrictions vs. Terminal Access: The allowedDirectories parameter only restricts file-system operations performed through MCP tools implemented in src/search-manager.ts. Terminal commands executed via the terminal manager in src/terminal-manager.ts can still access any path on the host regardless of this setting.
Command Blocking: Use blockedCommands to prevent accidental execution of dangerous operations. As implemented in src/terminal-manager.ts, this array filters commands before execution, providing an additional safety layer beyond directory restrictions.
Resource Limits: The default fileReadLineLimit of 1000 lines and fileWriteLineLimit of 50 lines protect against token overflow in large files. These can be safely increased to thousands of lines for batch processing workflows, though extremely high values may impact performance.
Telemetry Opt-Out: Set telemetryEnabled to false to disable anonymous usage reporting as described in the repository's privacy policy documentation.
Summary
- DesktopCommanderMCP settings persist in
config.jsonand are managed through theget_configandset_config_valueMCP tools - Six configuration keys control shell preferences (
defaultShell), directory access (allowedDirectories), command security (blockedCommands), file operation limits (fileReadLineLimit,fileWriteLineLimit), and privacy (telemetryEnabled) - Changes apply immediately without server restart and survive across sessions
allowedDirectoriesrestricts only MCP file-system operations, not terminal command execution- Empty arrays for
allowedDirectoriesgrant full filesystem access, whileblockedCommandsprovides execution-level protection
Frequently Asked Questions
How do I completely disable directory restrictions in DesktopCommanderMCP?
Set allowedDirectories to an empty array [] using set_config_value({ "key": "allowedDirectories", "value": [] }). This removes all filesystem restrictions for MCP file operations, though terminal commands always retain full host access regardless of this setting.
Why can terminal commands still access directories outside my allowed list?
The allowedDirectories parameter only constrains file-system operations performed through MCP search and file management tools implemented in src/search-manager.ts. The terminal manager in src/terminal-manager.ts executes shell commands directly without path filtering, meaning allowedDirectories does not sandbox terminal execution.
What are the default file operation limits in DesktopCommanderMCP?
By default, fileReadLineLimit is set to 1000 lines and fileWriteLineLimit to 50 lines per operation. These defaults prevent token overflow when processing large files, but you can increase them to thousands of lines if your workflow requires handling larger datasets.
Where is the DesktopCommanderMCP configuration file stored?
The server creates and maintains config.json in the server's working directory (where the server process starts). This file is automatically updated whenever you call set_config_value, and the server loads these settings on startup as implemented in src/server.ts.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →