# How to Configure DesktopCommanderMCP Settings: A Complete Guide

> Learn how to configure DesktopCommanderMCP settings with this complete guide. Dynamically update security policies, shell preferences, and performance limits via config.json.

- Repository: [Eduard Ruzga/DesktopCommanderMCP](https://github.com/wonderwhy-er/DesktopCommanderMCP)
- Tags: how-to-guide
- Published: 2026-07-16

---

**DesktopCommanderMCP stores all runtime configuration in a [`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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 settings
- **`set_config_value`** – Updates a single configuration key and immediately persists the change to [`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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 access
- **`fileReadLineLimit`** – 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:

```javascript
get_config({})

```

This returns a JSON payload containing all current settings:

```json
{
  "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:

```javascript
// 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:

```javascript
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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/search-manager.ts). Terminal commands executed via the terminal manager in [`src/terminal-manager.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.json) and are managed through the `get_config` and `set_config_value` MCP 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
- `allowedDirectories` restricts only MCP file-system operations, not terminal command execution
- Empty arrays for `allowedDirectories` grant full filesystem access, while `blockedCommands` provides 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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/search-manager.ts). The terminal manager in [`src/terminal-manager.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/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`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts).