Desktop Commander MCP

Desktop Commander MCP

一个服务器,它允许 Claude 桌面应用通过模型上下文协议在你的电脑上执行终端命令和编辑文件,具有命令执行、进程管理和高级文件操作等功能。

Category
访问服务器

README

Desktop Commander MCP

Desktop Commander MCP

npm downloads smithery badge Buy Me A Coffee Discord

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

<a href="https://glama.ai/mcp/servers/zempur9oh4"> <img width="380" height="200" src="https://glama.ai/mcp/servers/zempur9oh4/badge" alt="Claude Desktop Commander MCP server" /> </a>

目录

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

特性

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

安装

首先,请确保您已下载并安装了 Claude 桌面应用程序,并且您已 安装 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 正在运行,请重启

setup 命令将:

  • 安装依赖项
  • 构建服务器
  • 配置 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 - 远程服务器命令执行
  • 安装故障排除指南 - 针对安装问题的全面帮助

媒体

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

文章

Claude with MCPs replaced Cursor & Windsurf. How did that happen? - 详细探讨了具有模型上下文协议功能的 Claude 如何改变开发人员的工作流程。

视频

Claude Desktop Commander Video Tutorial - 观看如何有效设置和使用 Commander。

社区

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

用户评价

It's a life saver! I paid Claude + Cursor currently which I always feel it's kind of duplicated. This solves the problem ultimately. I am so happy. Thanks so much. Plus today Claude has added the web search support. With this MCP + Internet search, it writes the code with the latest updates. It's so good when Cursor doesn't work sometimes or all the fast requests are used. https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyyBt6_ShdDX_rIOad4AaABAg

This is the first comment I've ever left on a youtube video, THANK YOU! I've been struggling to update an old Flutter app in Cursor from an old pre null-safety version to a current version and implemented null-safety using Claude 3.7. I got most of the way but had critical BLE errors that I spent days trying to resolve with no luck. I tried Augment Code but it didn't get it either. I implemented your MCP in Claude desktop and was able to compare the old and new codebase fully, accounting for the updates in the code, and fix the issues in a couple of hours. A word of advice to people trying this, be sure to stage changes and commit when appropriate to be able to undo unwanted changes. Amazing! https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgztdHvDMqTb9jiqnf54AaABAg

Great! I just used Windsurf, bought license a week ago, for upgrading old fullstack socket project and it works many times good or ok but also many times runs away in cascade and have to revert all changes loosing hundereds of cascade tokens. In just a week down to less than 100 tokens and do not want to buy only 300 tokens for 10$. This Claude MCP ,bought claude Pro finally needed but wanted very good reason to also have next to ChatGPT, and now can code as much as I want not worrying about token cost.
Also this is much more than code editing it is much more thank you for great video! https://www.youtube.com/watch?v=ly3bed99Dy8&lc=UgyQFTmYLJ4VBwIlmql4AaABAg

it is a great tool, thank you, I like using it, as it gives claude an ability to do surgical edits, making it more like a human developer. https://www.youtube.com/watch?v=ly3bed99Dy8&lc=Ugy4-exy166_Ma7TH-h4AaABAg

You sir are my hero. You've pretty much summed up and described my experiences of late, much better than I could have. Cursor and Windsurf both had me frustrated to the point where I was almost yelling at my computer screen. Out of whimsy, I thought to myself why not just ask Claude directly, and haven't looked back since.
Claude first to keep my sanity in check, then if necessary, engage with other IDEs, frameworks, etc. I thought I was the only one, glad to see I'm not lol.
33
1 https://medium.com/@pharmx/you-sir-are-my-hero-62cff5836a3e

贡献

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

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

  • 发现错误?github.com/wonderwhy-er/ClaudeComputerCommander/issues 上打开一个 issue
  • 有功能想法? 在 issues 部分提交功能请求
  • 想贡献代码? Fork 存储库,创建一个分支,然后提交一个 pull request
  • 问题或讨论? 在 GitHub Discussions 选项卡中开始讨论

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

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

许可证

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选