Skip to main content
Glama
Desktop Commander MCP

Desktop Commander MCP

by MrGNSS

桌面指挥官 MCP

桌面指挥官 MCP

npm 下载 铁匠徽章 给我买杯咖啡 不和谐

简短版本。关键两点:终端命令和基于 diff 的文件编辑。

目录

这是允许 Claude 桌面应用程序在您的计算机上执行长时间运行的终端命令并通过模型上下文协议 (MCP) 管理进程的服务器 + 建立在MCP 文件系统服务器之上,以提供额外的搜索和替换文件编辑功能。

Related MCP server: MCP Tools

特征

  • 使用输出流执行终端命令

  • 命令超时和后台执行支持

  • 进程管理(列出和终止进程)

  • 长时间运行命令的会话管理

  • 完整的文件系统操作:

    • 读/写文件

    • 创建/列出目录

    • 移动文件/目录

    • 搜索文件

    • 获取文件元数据

    • 代码编辑功能:

    • 外科手术文本替换的小改动

    • 针对重大变更进行完整文件重写

    • 多文件支持

    • 基于模式的替换

安装

首先,确保您已经下载并安装了Claude Desktop 应用程序,并且已经安装了 npm 。

选项 1:通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Desktop Commander:

npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude

选项 2:通过 npx 安装

只需在终端中运行此命令

npx @wonderwhy-er/desktop-commander setup

如果正在运行,请重新启动 Claude

选项 3:手动添加到 claude_desktop_config

将此条目添加到您的 claude_desktop_config.json 中(在 Mac 上,位于 ~/Library/Application\ Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "desktop-commander": {
      "command": "npx",
      "args": [
        "-y",
        "@wonderwhy-er/desktop-commander"
      ]
    }
  }
}

如果正在运行,请重新启动 Claude

选项 4:本地结账

  1. 克隆并构建:

git clone https://github.com/wonderwhy-er/ClaudeComputerCommander.git
cd ClaudeComputerCommander
npm run setup

如果正在运行,请重新启动 Claude

安装命令将:

  • 安装依赖项

  • 构建服务器

  • 配置 Claude 的桌面应用程序

  • 如果需要,将 MCP 服务器添加到 Claude 的配置中

用法

服务器提供以下工具类别:

终端工具

  • execute_command命令并配置超时时间

  • read_output :获取长时间运行的命令的输出

  • force_terminate :停止正在运行的命令会话

  • list_sessions :查看活动的命令会话

  • list_processes :查看系统进程

  • kill_process :通过 PID 终止进程

  • block_command / unblock_command :管理命令黑名单

文件系统工具

  • read_file / write_file :文件操作

  • create_directory / list_directory :目录管理

  • move_file :移动/重命名文件

  • search_files :基于模式的文件搜索

  • get_file_info :文件元数据

编辑工具

  • edit_block :应用外科文本替换(最适合文件大小<20%的更改)

  • write_file :完成文件重写(最适合大于 20% 的较大更改或 edit_block 失败时)

搜索/替换块格式:

filepath.ext
<<<<<<< SEARCH
existing code to replace
=======
new code to insert
>>>>>>> REPLACE

例子:

src/main.js
<<<<<<< SEARCH
console.log("old message");
=======
console.log("new message");
>>>>>>> REPLACE

处理长时间运行的命令

对于可能需要一段时间的命令:

  1. 超时后, execute_command返回初始输出

  2. 命令在后台继续

  3. 使用read_output和 PID 来获取新的输出

  4. 如果需要,使用force_terminate停止

模型上下文协议集成

该项目扩展了 MCP 文件系统服务器以实现:

  • Claude Desktop 中的本地服务器支持

  • 完整系统命令执行

  • 流程管理

  • 文件操作

  • 使用搜索/替换块进行代码编辑

作为探索 Claude MCP 的一部分而创建: https://youtube.com/live/TlbjFDbl5Us

正在进行的工作和待办事项

目前正在开发或计划的功能如下:

  • 更好的代码搜索(正在进行中)——通过上下文感知结果增强代码探索

  • 更好的配置(正在进行中) - 改进允许路径、命令和 shell 环境的设置

  • Windows 环境修复(正在进行中) - 解决特定于 Windows 平台的问题

  • Linux 改进(正在进行中)——增强与各种 Linux 发行版的兼容性

  • 支持 WSL - Windows Subsystem for Linux 集成

  • 支持 SSH - 远程服务器命令执行

  • 安装故障排除指南- 针对安装问题的全面帮助

媒体

通过以下资源了解有关该项目的更多信息:

文章

带有 MCP 的 Claude 取代了 Cursor 和 Windsurf。这是怎么发生的? ——详细探讨了带有模型上下文协议功能的 Claude 如何改变开发人员的工作流程。

视频

Claude Desktop Commander 视频教程- 观看如何有效设置和使用 Commander。

社区

加入我们的Discord 服务器以获取帮助、分享反馈并与其他用户联系。

评价

这真是个救星!我之前一直用 Claude + Cursor,总觉得有点重复。现在终于解决了问题。我太开心了,非常感谢。而且今天 Claude 还添加了网页搜索支持。有了 MCP + 网页搜索,它就能用最新的更新来编写代码。当 Cursor 偶尔不工作或者所有快速请求都用完的时候,这个功能就派上用场了。 https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyyBt6_ShdDX_rIOad4AaABAg

这是我在 YouTube 视频上留下的第一条评论,谢谢!我一直在努力将 Cursor 中的一个旧 Flutter 应用从空值安全之前的旧版本更新到当前版本,并使用 Claude 3.7 实现了空值安全。我完成了大部分工作,但遇到了严重的 BLE 错误,我花了好几天时间才解决,但毫无进展。我尝试了 Augment Code,但也没能解决问题。我在 Claude 桌面版中实现了您的 MCP,并能够完整地比较新旧代码库,考虑到代码中的更新,并在几个小时内修复了问题。给正在尝试此方法的人一个建议:务必将更改暂存起来,并在适当的时候提交,以便能够撤消不需要的更改。太棒了! https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgztdHvDMqTb9jiqnf54AaABAg

太棒了!我刚用Windsurf升级了旧的全栈套接字项目,一周前买了许可证,它运行良好,但很多时候会崩溃,不得不恢复所有更改,损失了数百个级联代币。短短一周内,代币就降到不足100个,我可不想花10美元买300个代币。我终于买了Claude MCP,但又想买Claude Pro,理由很充分,除了ChatGPT之外,现在我可以随心所欲地写代码,不用担心代币成本了。 这不仅仅是代码编辑,更是感谢你精彩的视频! https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyQFTmYLJ4VBwIlmql4AaABAg

这是一个很棒的工具,谢谢,我喜欢使用它,因为它让克劳德能够进行外科手术编辑,使其更像人类开发人员。 https://www.youtube.com/watch?v=ly3bed99Dy8&lc=Ugy4-exy166_Ma7TH-h4AaABAg

先生,您是我的英雄。您几乎总结并描述了我最近的经历,比我自己能说的要好得多。Cursor 和 Windsurf 都让我沮丧到几乎对着电脑屏幕大喊大叫。我一时兴起,心想为什么不直接问 Claude,从那以后就再也没有回头。 首先,我会先咨询 Claude,让他保持理智,然后如果有必要,再尝试其他 IDE、框架等等。我以为只有我一个人这样,很高兴发现我不是,哈哈。 33 1 https://medium.com/@pharmx/you-sir-are-my-hero-62cff5836a3e

贡献

如果您觉得这个项目有用,请考虑在 GitHub 上点个⭐!这有助于其他人发现这个项目,并鼓励进一步开发。

我们欢迎社区的贡献!无论您是发现了错误、提出了功能请求,还是想贡献代码,都可以通过以下方式提供帮助:

  • **发现 bug 了?**请在github.com/wonderwhy-er/ClaudeComputerCommander/issues提交问题

  • **有功能创意?**请在问题版块提交功能请求

  • **想要贡献代码?**分叉代码库,创建分支,然后提交拉取请求

  • **有问题或想讨论?**请在 GitHub 讨论选项卡中发起讨论

所有的贡献,无论大小,都非常感谢!

如果您发现此工具对您的工作流程有价值,请考虑支持该项目。

执照

麻省理工学院

Available Tools

19 tools
block_commandB

Add a command to the blacklist. Once blocked, the command cannot be executed until unblocked.

Inputs: command (required).

create_directoryA

Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. Only works within allowed directories.

Inputs: path (required).

edit_blockA

Apply surgical text replacements to files. Best for small changes (<20% of file size). Multiple blocks can be used for separate changes. Will verify changes after application. Format: filepath, then <<<<<<< SEARCH, content to find, =======, new content, >>>>>>> REPLACE.

Inputs: blockContent (required).

execute_commandB

Execute a terminal command with timeout. Command will continue running in background if it doesn't complete within timeout.

Inputs: command (required), timeout_ms.

force_terminateC

Force terminate a running terminal session.

Inputs: pid (required).

get_file_infoA

Retrieve detailed metadata about a file or directory including size, creation time, last modified time, permissions, and type. Only works within allowed directories.

Inputs: path (required).

kill_processA

Terminate a running process by PID. Use with caution as this will forcefully terminate the specified process.

Inputs: pid (required).

list_allowed_directoriesB

Returns the list of directories that this server is allowed to access.

Inputs: no named parameters.

list_blocked_commandsB

List all currently blocked commands.

Inputs: no named parameters.

list_directoryA

Get a detailed listing of all files and directories in a specified path. Results distinguish between files and directories with [FILE] and [DIR] prefixes. Only works within allowed directories.

Inputs: path (required).

list_processesA

List all running processes. Returns process information including PID, command name, CPU usage, and memory usage.

Inputs: no named parameters.

list_sessionsB

List all active terminal sessions.

Inputs: no named parameters.

move_fileA

Move or rename files and directories. Can move files between directories and rename them in a single operation. Both source and destination must be within allowed directories.

Inputs: source (required), destination (required).

read_fileA

Read the complete contents of a file from the file system. Handles various text encodings and provides detailed error messages if the file cannot be read. Only works within allowed directories.

Inputs: path (required).

read_multiple_filesA

Read the contents of multiple files simultaneously. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.

Inputs: paths (required).

read_outputC

Read new output from a running terminal session.

Inputs: pid (required).

search_filesC

Recursively search for files and directories matching a pattern. Searches through all subdirectories from the starting path. Only searches within allowed directories.

Inputs: path (required), pattern (required).

unblock_commandB

Remove a command from the blacklist. Once unblocked, the command can be executed normally.

Inputs: command (required).

write_fileA

Completely replace file contents. Best for large changes (>20% of file) or when edit_block fails. Use with caution as it will overwrite existing files. Only works within allowed directories.

Inputs: path (required), content (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists between 'execute_command' and 'force_terminate'/'kill_process' in managing processes, and 'edit_block' and 'write_file' in file modification. However, descriptions clarify their specific use cases (e.g., 'edit_block' for small changes, 'write_file' for large replacements), reducing confusion.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun pattern throughout, such as 'create_directory', 'list_directory', 'read_file', and 'move_file'. This uniformity makes the toolset predictable and easy for agents to navigate without naming conflicts.

    Tool Count4/5

    With 19 tools, the count is slightly high but reasonable for a desktop management server covering file operations, process control, and command execution. It provides comprehensive functionality without being overwhelmingly large, though it could be streamlined by merging some related tools.

    Completeness5/5

    The toolset offers complete coverage for desktop management, including CRUD operations for files and directories, process lifecycle management, command execution with safety features (blocking/unblocking), and session handling. No obvious gaps are present, supporting a wide range of agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A custom Model Context Protocol server that gives Claude Desktop and other LLMs access to file system operations and command execution capabilities through standardized tool interfaces.
      23
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that extends AI capabilities by providing file system access and management functionalities to Claude or other AI assistants.
      5
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A server implementation for the Model Context Protocol (MCP) that allows Claude AI to execute commands through a command-line interface, enabling direct system interactions from within Claude.
      -