Desktop Commander MCP

by MrGNSS
Verified
MIT License
12,588
  • Linux
  • Apple

Integrations

  • Provides a way for users to support the project financially through the Buy Me A Coffee platform.

  • Allows users to join a Discord server for getting help, sharing feedback, and connecting with other users of the Desktop Commander MCP.

  • Facilitates project contribution, issue reporting, and discussions through GitHub's platform.

桌面指挥官 MCP

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

目录

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

特征

  • 使用输出流执行终端命令
  • 命令超时和后台执行支持
  • 进程管理(列出和终止进程)
  • 长时间运行命令的会话管理
  • 完整的文件系统操作:
    • 读/写文件
    • 创建/列出目录
    • 移动文件/目录
    • 搜索文件
    • 获取文件元数据
    • 代码编辑功能:
    • 外科手术文本替换的小改动
    • 针对重大变更进行完整文件重写
    • 多文件支持
    • 基于模式的替换

安装

首先,确保您已经下载并安装了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 服务器以获取帮助、分享反馈并与其他用户联系。

评价

https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyyBt6_ShdDX_rIOad4AaABAg

https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgztdHvDMqTb9jiqnf54AaABAg

https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyQFTmYLJ4VBwIlmql4AaABAg

https://www.youtube.com/watch?v=ly3bed99Dy8&lc=Ugy4-exy166_Ma7TH-h4AaABAg

https://medium.com/@pharmx/you-sir-are-my-hero-62cff5836a3e

贡献

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

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

  • **发现 bug 了?**请在github.com/wonderwhy-er/ClaudeComputerCommander/issues提交问题
  • **有功能创意?**请在问题版块提交功能请求
  • **想要贡献代码?**分叉代码库,创建分支,然后提交拉取请求
  • **有问题或想讨论?**请在 GitHub 讨论选项卡中发起讨论

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

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

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

一个服务器,让 Claude 桌面应用程序在您的计算机上执行终端命令并通过模型上下文协议编辑文件,具有命令执行、进程管理和高级文件操作功能。

  1. Table of Contents
    1. Features
      1. Installation
        1. Option 1: Installing via Smithery
        2. Option 2: Install trough npx
        3. Option 3: Add to claude_desktop_config by hand
        4. Option 4: Checkout locally
      2. Usage
        1. Terminal Tools
        2. Filesystem Tools
        3. Edit Tools
      3. Handling Long-Running Commands
        1. Model Context Protocol Integration
          1. Work in Progress and TODOs
            1. Media
              1. Article
              2. Video
              3. Community
            2. Testimonials
              1. Contributing
                1. License
                  ID: 7twwxtnbgd