Skip to main content
Glama
luffy666code

Desktop Commander MCP

by luffy666code
README.md
<div align="center">

# ๐Ÿ–ฅ๏ธ Desktop Commander MCP

### Portable, general-purpose filesystem + terminal tools for MCP clients

[![CI](https://github.com/luffy666code/desktop-commander-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/luffy666code/desktop-commander-mcp/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
[![MCP](https://img.shields.io/badge/Model%20Context%20Protocol-MCP-6f42c1)](https://modelcontextprotocol.io/)

**Search files ยท edit documents ยท run commands ยท manage processes ยท inspect the local workspace**

**English** ยท [็ฎ€ไฝ“ไธญๆ–‡](README_zh-CN.md)

</div>

> A community-maintained portable adaptation of [Desktop Commander MCP](https://github.com/wonderwhy-er/DesktopCommanderMCP).  
> It is designed for standard **stdio-compatible MCP clients** and does not depend on any vendor-specific deployment platform.

---

## โœจ Highlights

| Capability | What it gives your AI client |
|---|---|
| ๐Ÿ“ Filesystem | Read, write, move, list, search, and inspect files and directories |
| ๐Ÿ”Ž Fast search | Recursive content search powered by ripgrep |
| ๐Ÿ’ป Terminal | Run shell commands, stream output, and handle long-running processes |
| โš™๏ธ Process control | List, inspect, and terminate processes |
| ๐Ÿ“ Editing | Targeted text replacement and larger file rewrites |
| ๐Ÿ“Š Documents | Excel, PDF, DOCX, Markdown, text, and binary-aware file handling |
| ๐Ÿงฐ Configuration | Runtime configuration plus a conservative default command blocklist |
| ๐ŸŒ Cross-platform | Windows, Linux, and macOS source installs with runtime ripgrep resolution |

## ๐Ÿš€ Quick start

### 1. Clone

```bash
git clone https://github.com/luffy666code/desktop-commander-mcp.git
cd desktop-commander-mcp
```

### 2. Install and build

```bash
npm install
npm run build
```

Requirements: **Node.js 18+** and npm.

### 3. Verify the search engine

```bash
npm run verify:rg
```

### 4. Add it to your MCP client

Use the standard stdio configuration pattern:

```json
{
  "mcpServers": {
    "desktop-commander": {
      "command": "node",
      "args": ["/absolute/path/to/desktop-commander-mcp/dist/index.js"]
    }
  }
}
```

Replace the path with the real absolute path on your machine. See **[Client setup](docs/CLIENT_SETUP.md)** for Windows path examples and Inspector usage.

## ๐Ÿงญ How it works

```text
MCP client
   โ”‚
   โ”‚ stdio / MCP requests
   โ–ผ
dist/index.js
   โ”‚
   โ–ผ
server + tool handlers
   โ”‚
   โ”œโ”€โ”€ filesystem operations
   โ”œโ”€โ”€ terminal / process manager
   โ”œโ”€โ”€ document utilities
   โ””โ”€โ”€ search manager
          โ”‚
          โ–ผ
       ripgrep
```

The ripgrep resolver first checks the platform-correct binary in `@vscode/ripgrep`, then falls back to the package export, the system `PATH`, and common installation locations. On Unix-like systems it also verifies executable permission.

## ๐Ÿ” Safety defaults

`config.json` ships with a conservative blocklist for destructive or privilege-escalating commands such as `format`, `mkfs`, `fdisk`, `dd`, `sudo`, and user-management commands.

```json
{
  "blockedCommands": [
    "format", "mount", "umount", "mkfs", "fdisk", "dd",
    "sudo", "su", "passwd", "adduser", "useradd", "usermod", "groupadd"
  ]
}
```

This is a guardrail, **not a sandbox**. Review [SECURITY.md](SECURITY.md) before using command execution against important data or production machines.

## ๐Ÿ› ๏ธ Development

```bash
# TypeScript watch mode
npm run watch

# Run from TypeScript during development
npm run dev

# Compile
npm run build

# Start compiled server
npm start

# Open MCP Inspector
npm run inspector
```

### Project layout

```text
src/
โ”œโ”€โ”€ index.ts                 # process entry point
โ”œโ”€โ”€ server.ts                # MCP server and tool registration
โ”œโ”€โ”€ handlers/                # request handlers
โ”œโ”€โ”€ tools/                   # filesystem, edit, process, PDF and other tools
โ”œโ”€โ”€ search-manager.ts        # search orchestration
โ”œโ”€โ”€ terminal-manager.ts      # command/session management
โ””โ”€โ”€ utils/
    โ””โ”€โ”€ ripgrep-resolver.ts  # cross-platform ripgrep discovery
```

## ๐ŸŒ Portability notes

For normal use, run `npm install` on the **same OS/architecture where the MCP server will run** so native dependencies are installed correctly.

The repository also contains an optional Linux x86-64 ripgrep binary under `tools/Linux/rg` for custom portable packaging workflows. It is **not required** for ordinary source installs. See [tools/README.md](tools/README.md).

## ๐Ÿค Upstream & attribution

This repository is derived from **Desktop Commander MCP** by Eduard Ruzga and contributors:

- Upstream: https://github.com/wonderwhy-er/DesktopCommanderMCP
- License: MIT

Portable packaging and ripgrep-resolution adjustments in this fork are maintained separately. Upstream trademarks, services, and release channels are not implied to endorse this fork.

See [LICENSE](LICENSE) and [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).

## ๐Ÿ“„ License

MIT License. See [LICENSE](LICENSE).

---

<div align="center">

Built for developers who want a straightforward, local-first MCP tool server.

</div>