Desktop Commander MCP

Desktop Commander MCP

site icon
2025.03.24 1
命令行工具代码编辑进程管理文件操作开发效率
ClaudeDesktopCommander 是一个基于 Model Context Protocol (MCP) 的桌面命令行工具,旨在为 Claude 桌面应用提供执行终端命令、管理系统进程和文件操作的能力。它扩展了 MCP Filesystem Server 的功能,支持代码编辑、文件搜索和替换等操作,显著提升了开发效率。
View on GitHub

Overview

基本能力

产品定位

ClaudeDesktopCommander 是一个为 Claude 桌面应用设计的命令行工具,通过 MCP 协议提供终端命令执行、进程管理和文件操作功能,特别适合开发者进行代码编辑和系统管理。

核心功能

  • 终端命令执行:支持执行长时间运行的命令,并提供输出流式传输。
  • 进程管理:列出和终止系统进程。
  • 文件系统操作:包括文件读写、目录创建和列表、文件移动、文件搜索和获取文件元数据。
  • 代码编辑:支持精确的文本替换和完整的文件重写。

适用场景

  • 开发者需要快速执行终端命令并查看实时输出。
  • 需要管理系统进程或进行文件操作。
  • 进行代码编辑,特别是需要精确替换或大规模修改代码时。

工具列表

  • 终端工具execute_commandread_outputforce_terminatelist_sessionslist_processeskill_processblock_commandunblock_command
  • 文件系统工具read_filewrite_filecreate_directorylist_directorymove_filesearch_filesget_file_info
  • 编辑工具edit_blockwrite_file

常见问题解答

  • 长时间运行命令:使用 execute_command 启动命令,read_output 获取输出,force_terminate 终止命令。
  • 代码编辑:小规模修改使用 edit_block,大规模修改使用 write_file

使用教程

使用依赖

  1. 确保已安装 Claude Desktop 应用npm

安装教程

选项1:通过 Smithery 安装

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

选项2:通过 npx 安装

npx @wonderwhy-er/desktop-commander setup

重启 Claude。

选项3:手动添加到 claude_desktop_config

~/Library/Application Support/Claude/claude_desktop_config.json 中添加:

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

重启 Claude。

选项4:本地克隆

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

重启 Claude。

调试方式

  • 使用 list_sessions 查看活动命令会话。
  • 使用 read_output 获取命令输出。
  • 使用 force_terminate 终止命令。

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。