# Desktop Commander MCP Configuration Tools: Complete Guide to `get_config` and `set_config_value`

> Master Desktop Commander MCP configuration with get_config and set_config_value tools. Learn to read and set validated settings in your JSON config file.

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

---

**Desktop Commander MCP provides two built-in configuration tools—`get_config` and `set_config_value`—that read and persist validated settings to a JSON configuration file in the user's home directory.**

All runtime settings in Desktop Commander MCP are centralized in a single JSON file ([`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.json)). To expose these settings to external integrations, Claude plugins, CLI scripts, and the built-in UI, the project implements two dedicated tool endpoints. This guide examines how these **configuration tools** work, where they are implemented, and how to use them programmatically.

## Overview of Available Configuration Tools

Desktop Commander MCP ships with exactly two tools for configuration management. Both are registered server-side and used by the **Config Editor** UI component.

### `get_config`: Retrieve Configuration Values

The `get_config` tool returns the current value of any valid configuration key. It is defined in the UI config editor ([`src/ui/config-editor/src/app.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/ui/config-editor/src/app.ts)) and wired through the server ([`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts)).

**Implementation details:**
- Accepts a single parameter: `key` (string)
- Validates the key against the master field definitions
- Returns the stored value or an error if the key is unrecognized

### `set_config_value`: Persist Configuration Changes

The `set_config_value` tool writes a new value to the configuration file after validation. Core logic lives in [`src/tools/config.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/tools/config.ts), with server registration in [`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts).

**Implementation details:**
- Accepts parameters: `key` (string) and `value` (any valid JSON type)
- Validates against rules in [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts)
- Persists to [`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.json) in the user's home directory
- Returns the normalized key/value pair or validation errors

## Configuration Field Definitions

Both tools rely on the **field definitions** declared in [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts). This file enumerates every supported setting with metadata including labels, default values, and validation rules.

Example configurable keys include:
- `defaultShell` — Path to the preferred shell executable
- `telemetryEnabled` — Boolean flag for analytics collection
- `currentClient` — Identifier for the active client integration

You cannot read or write arbitrary keys. Any `key` parameter must exist in this master list.

## How to Use the Configuration Tools

### Reading a Configuration Value

Retrieve the current value of any valid key using `get_config`:

```typescript
// Example: Retrieve the current default shell
const result = await callTool('get_config', { key: 'defaultShell' });
console.log('Current shell →', result?.value);

```

The response includes:
- `value`: The stored value (type varies by setting)
- `key`: The normalized key name

### Updating a Configuration Value

Persist changes with `set_config_value`:

```typescript
// Example: Change the default shell to Zsh
await callTool('set_config_value', {
  key: 'defaultShell',
  value: '/bin/zsh',
});
console.log('Default shell updated.');

```

The tool validates the input against [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts) before writing. Invalid keys or malformed values return structured error objects.

## Source File Reference

The **Desktop Commander MCP configuration tools** are implemented across these files:

| File | Purpose |
|------|---------|
| [`src/tools/config.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/tools/config.ts) | Core implementation of `get_config` and `set_config_value` including argument validation and file persistence |
| [`src/ui/config-editor/src/app.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/ui/config-editor/src/app.ts) | UI layer that renders the Config Editor and invokes both tools |
| [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts) | Master registry of all configurable settings with validation schema |
| [`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts) | Server-side registration of tool names and telemetry hooks |
| [`src/config.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config.ts) | Constants for `CONFIG_FILE` path and tool-call log locations |

## Server Registration

In [`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts), both tools are registered under the **tool-call** protocol:

```typescript
// Simplified excerpt from src/server.ts
server.setRequestHandler('tools/list', async () => ({
  tools: [
    { name: 'get_config', /* schema */ },
    { name: 'set_config_value', /* schema */ },
  ],
}));

```

This registration makes them available to any caller implementing the MCP tool-call protocol, including Claude Desktop, custom Python scripts, or HTTP clients.

## Summary

- Desktop Commander MCP provides **exactly two configuration tools**: `get_config` and `set_config_value`.
- Both operate on a validated set of keys defined in [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts).
- Configuration is stored in [`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.json) under the user's home directory.
- The tools are implemented in [`src/tools/config.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/tools/config.ts) and registered in [`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts).
- The Config Editor UI (`src/ui/config-editor/`) provides an interactive interface for the same operations.

These tools enable both programmatic automation and manual configuration management through a consistent, validated interface.

## Frequently Asked Questions

### How do I know which configuration keys are available?

Check [`src/config-field-definitions.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config-field-definitions.ts) in the repository. This file contains the authoritative list of all supported keys, their types, defaults, and validation rules. Attempting to read or write keys not defined here will return an error.

### Can I use these tools outside the Config Editor UI?

Yes. Both tools are registered in [`src/server.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/server.ts) and available to any client implementing the MCP tool-call protocol. You can invoke them from Claude Desktop plugins, custom scripts, or direct API calls.

### Where is the configuration file stored?

The configuration file location is defined by the `CONFIG_FILE` constant in [`src/config.ts`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/src/config.ts). By default, it resides in the user's home directory as [`config.json`](https://github.com/wonderwhy-er/DesktopCommanderMCP/blob/main/config.json). The exact path varies by operating system.