# wonderwhy-er/desktopcommandermcp architecture

> Architecture diagram of the GitHub repository wonderwhy-er/desktopcommandermcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wonderwhy-er/desktopcommandermcp
- Repository: https://github.com/wonderwhy-er/desktopcommandermcp

## Overview

Desktop Commander is an MCP server for AI clients to inspect and edit files, search code, manage configuration, and run or control local processes. The principal workflow is a client tool request routed by the server to a handler, which invokes a domain manager or file operation and returns a result. The README also documents document-format support, a file-preview UI, and remote access. Some handler and remote wiring is unsampled, so uncertain links are omitted or marked unverified.

Main entry points: [`src/handlers/index.ts`](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/index.ts) (Tool Handlers), [`src/ui/file-preview/src/app.ts`](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/app.ts) (File Preview UI), [`src/server.ts`](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/server.ts) (MCP Server), [`src/tools/filesystem.ts`](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/filesystem.ts) (Filesystem Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["MCP Runtime"]
  node_server["MCP Server<br/>[server.ts]"]
  node_handlers["Tool Handlers<br/>[index.ts]"]
  node_schemas["Tool Schemas<br/>[schemas.ts]"]
end

subgraph group_files["Files and Search"]
  node_fs_handlers["Filesystem Handlers"]
  node_filesystem["Filesystem Tools<br/>[filesystem.ts]"]
  node_file_readers["File Readers<br/>[base.ts]"]
  node_search_handlers["Search Handlers<br/>[search-handlers.ts]"]
  node_search["Search Manager<br/>[search-manager.ts]"]
  node_edit_handlers["Edit Handlers"]
  node_edit_tools["Edit Tools<br/>[edit.ts]"]
end

subgraph group_processes["Processes and Config"]
  node_terminal["Terminal Manager"]
  node_command_manager["Command Manager<br/>[command-manager.ts]"]
  node_config_manager[("Configuration<br/>[config-manager.ts]")]
end

subgraph group_remote["Remote Access"]
  node_remote_launcher["Remote Launcher<br/>[remote.ts]"]
  node_device_auth["Device Auth"]
  node_remote_channel["Remote Channel<br/>[remote-channel.ts]"]
  node_mqtt_enrollment["MQTT Enrollment<br/>[mqtt-enrollment.ts]"]
  node_mqtt_transport["MQTT Transport<br/>[mqtt-transport.ts]"]
end

subgraph group_uis["Client UIs"]
  node_preview_ui["File Preview UI<br/>[app.ts]"]
  node_preview_handlers["Preview Renderers"]
  node_markdown_editor["Markdown Editor<br/>[controller.ts]"]
  node_directory_view["Directory View"]
  node_preview_payload["Preview Payload<br/>[payload-utils.ts]"]
  node_config_ui["Config Editor UI<br/>[app.ts]"]
end

node_client(("AI Client"))

node_client -->|"sends tool requests"| node_server
node_server -->|"dispatches tools"| node_handlers
node_handlers -->|"uses schemas"| node_schemas
node_handlers -.->|"routes filesystem"| node_fs_handlers
node_fs_handlers -->|"calls tools"| node_filesystem
node_filesystem -->|"uses readers"| node_file_readers
node_handlers -.->|"routes search"| node_search_handlers
node_search_handlers -->|"calls search"| node_search
node_search -->|"validates paths"| node_filesystem
node_handlers -.->|"routes edits"| node_edit_handlers
node_edit_handlers -->|"calls edits"| node_edit_tools
node_command_manager -->|"reads settings"| node_config_manager
node_terminal -->|"reads settings"| node_config_manager
node_client -.->|"starts remote access"| node_remote_launcher
node_remote_launcher -->|"starts device auth"| node_device_auth
node_device_auth -->|"uses channel"| node_remote_channel
node_mqtt_enrollment -->|"uses transport"| node_mqtt_transport
node_server -->|"serves UI resources"| node_preview_ui
node_preview_ui -->|"selects renderers"| node_preview_handlers
node_preview_handlers -->|"renders directories"| node_directory_view
node_preview_ui -->|"uses editor controller"| node_markdown_editor
node_preview_ui -->|"uses payload helpers"| node_preview_payload
node_preview_ui -.->|"renders previews"| node_client
node_config_ui -.->|"presents settings"| node_client

click node_server "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/server.ts"
click node_handlers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/index.ts"
click node_schemas "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/schemas.ts"
click node_fs_handlers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/filesystem-handlers.ts"
click node_filesystem "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/filesystem.ts"
click node_file_readers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/utils/files/base.ts"
click node_search_handlers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/search-handlers.ts"
click node_search "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/search-manager.ts"
click node_edit_handlers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/edit-search-handlers.ts"
click node_edit_tools "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/edit.ts"
click node_terminal "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/terminal-manager.ts"
click node_command_manager "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/command-manager.ts"
click node_config_manager "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/config-manager.ts"
click node_remote_launcher "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/npm-scripts/remote.ts"
click node_device_auth "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/device-authenticator.ts"
click node_remote_channel "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/remote-channel.ts"
click node_mqtt_enrollment "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/mqtt/mqtt-enrollment.ts"
click node_mqtt_transport "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/mqtt/mqtt-transport.ts"
click node_preview_ui "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/app.ts"
click node_preview_handlers "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/file-type-handlers.ts"
click node_markdown_editor "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/markdown/controller.ts"
click node_directory_view "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/directory-controller.ts"
click node_preview_payload "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/payload-utils.ts"
click node_config_ui "https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/config-editor/src/app.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_handlers,node_schemas,node_client toneBlue
class node_fs_handlers,node_filesystem,node_file_readers,node_search_handlers,node_search,node_edit_handlers,node_edit_tools toneAmber
class node_terminal,node_command_manager,node_config_manager toneMint
class node_remote_launcher,node_device_auth,node_remote_channel,node_mqtt_enrollment,node_mqtt_transport toneRose
class node_preview_ui,node_preview_handlers,node_markdown_editor,node_directory_view,node_preview_payload,node_config_ui toneIndigo
```

## Components

### MCP Runtime

- [MCP Server](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/server.ts): `src/server.ts`
- [Tool Handlers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/index.ts): `src/handlers/index.ts`
- [Tool Schemas](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/schemas.ts): `src/tools/schemas.ts`

### Files and Search

- [Filesystem Handlers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/filesystem-handlers.ts): `src/handlers/filesystem-handlers.ts`
- [Filesystem Tools](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/filesystem.ts): `src/tools/filesystem.ts`
- [File Readers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/utils/files/base.ts): `src/utils/files/base.ts`
- [Search Handlers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/search-handlers.ts): `src/handlers/search-handlers.ts`
- [Search Manager](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/search-manager.ts): `src/search-manager.ts`
- [Edit Handlers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/handlers/edit-search-handlers.ts): `src/handlers/edit-search-handlers.ts`
- [Edit Tools](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/tools/edit.ts): `src/tools/edit.ts`

### Processes and Config

- [Terminal Manager](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/terminal-manager.ts): `src/terminal-manager.ts`
- [Command Manager](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/command-manager.ts): `src/command-manager.ts`
- [Configuration](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/config-manager.ts): `src/config-manager.ts`

### Remote Access

- [Remote Launcher](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/npm-scripts/remote.ts): `src/npm-scripts/remote.ts`
- [Device Auth](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/device-authenticator.ts): `src/remote-device/device-authenticator.ts`
- [Remote Channel](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/remote-channel.ts): `src/remote-device/remote-channel.ts`
- [MQTT Enrollment](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/mqtt/mqtt-enrollment.ts): `src/remote-device/mqtt/mqtt-enrollment.ts`
- [MQTT Transport](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/remote-device/mqtt/mqtt-transport.ts): `src/remote-device/mqtt/mqtt-transport.ts`

### Client UIs

- [File Preview UI](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/app.ts): `src/ui/file-preview/src/app.ts`
- [Preview Renderers](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/file-type-handlers.ts): `src/ui/file-preview/src/file-type-handlers.ts`
- [Markdown Editor](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/markdown/controller.ts): `src/ui/file-preview/src/markdown/controller.ts`
- [Directory View](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/directory-controller.ts): `src/ui/file-preview/src/directory-controller.ts`
- [Preview Payload](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/file-preview/src/payload-utils.ts): `src/ui/file-preview/src/payload-utils.ts`
- [Config Editor UI](https://github.com/wonderwhy-er/desktopcommandermcp/blob/main/src/ui/config-editor/src/app.ts): `src/ui/config-editor/src/app.ts`

### Other components

- **AI Client**

## Connections

- AI Client → MCP Server: sends tool requests (evidence: `README.md`)
- MCP Server → Tool Handlers: dispatches tools (evidence: `src/server.ts`)
- Tool Handlers → Tool Schemas: uses schemas
- Tool Handlers → Filesystem Handlers: routes filesystem
- Filesystem Handlers → Filesystem Tools: calls tools (evidence: `src/handlers/filesystem-handlers.ts`)
- Filesystem Tools → File Readers: uses readers (evidence: `src/tools/filesystem.ts`)
- Tool Handlers → Search Handlers: routes search
- Search Handlers → Search Manager: calls search (evidence: `src/handlers/search-handlers.ts`)
- Search Manager → Filesystem Tools: validates paths (evidence: `src/search-manager.ts`)
- Tool Handlers → Edit Handlers: routes edits
- Edit Handlers → Edit Tools: calls edits (evidence: `src/handlers/edit-search-handlers.ts`)
- Command Manager → Configuration: reads settings (evidence: `src/command-manager.ts`)
- Terminal Manager → Configuration: reads settings (evidence: `src/terminal-manager.ts`)
- AI Client → Remote Launcher: starts remote access (evidence: `README.md`)
- Remote Launcher → Device Auth: starts device auth (evidence: `src/npm-scripts/remote.ts`)
- Device Auth → Remote Channel: uses channel (evidence: `src/remote-device/device-authenticator.ts`)
- MQTT Enrollment → MQTT Transport: uses transport (evidence: `src/remote-device/mqtt/mqtt-enrollment.ts`)
- MCP Server → File Preview UI: serves UI resources (evidence: `src/server.ts`)
- File Preview UI → Preview Renderers: selects renderers (evidence: `src/ui/file-preview/src/app.ts`)
- Preview Renderers → Directory View: renders directories (evidence: `src/ui/file-preview/src/file-type-handlers.ts`)
- File Preview UI → Markdown Editor: uses editor controller (evidence: `src/ui/file-preview/src/app.ts`)
- File Preview UI → Preview Payload: uses payload helpers (evidence: `src/ui/file-preview/src/app.ts`)
- File Preview UI → AI Client: renders previews (evidence: `README.md`)
- Config Editor UI → AI Client: presents settings (evidence: `README.md`)
