desktop-commander
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDesktop Commander
Desktop Commander
Quick start
快速开始
Goal: use Desktop Commander MCP to turn “files / processes / search / edits” into verifiable tool calls (small, safe steps) instead of treating the machine as a black box.
Most common entry points:
- Read content: (paging, negative offset tail, PDF/image/Excel/URL).
mcp__desktop-commander__read_file - Small edits: (targeted text replace / Excel range update).
mcp__desktop-commander__edit_block - Large edits: in chunks (respect
mcp__desktop-commander__write_file).fileWriteLineLimit - Interactive work: +
mcp__desktop-commander__start_process+mcp__desktop-commander__interact_with_process.mcp__desktop-commander__read_process_output
Official notes + tool list: .
skills/desktop-commander/references/desktop-commander.md目标:使用Desktop Commander MCP将「文件/进程/搜索/编辑」转化为可验证的工具调用(小型、安全的步骤),而非将机器视为黑箱。
最常用的入口:
- 读取内容:(支持分页、负偏移量尾部读取、PDF/图片/Excel/URL)。
mcp__desktop-commander__read_file - 小型编辑:(目标文本替换/Excel区域更新)。
mcp__desktop-commander__edit_block - 大型编辑:分块使用(需遵守
mcp__desktop-commander__write_file限制)。fileWriteLineLimit - 交互式操作:+
mcp__desktop-commander__start_process+mcp__desktop-commander__interact_with_process。mcp__desktop-commander__read_process_output
官方说明+工具列表:。
skills/desktop-commander/references/desktop-commander.mdWorkflow decision tree
工作流决策树
- Do I need to find something?
- File names/paths: (
mcp__desktop-commander__start_search) →searchType="files"mcp__desktop-commander__get_more_search_results - File contents: (
mcp__desktop-commander__start_search) → paginate →searchType="content"when donemcp__desktop-commander__stop_search
- Do I need to read or change content?
- Read: (use
mcp__desktop-commander__read_file; useoffset/lengthfor tail)offset=-N - Small change: (default replaces 1 occurrence; use
mcp__desktop-commander__edit_blockfor multiple)expected_replacements - Large change: (
mcp__desktop-commander__write_filethenmode="rewrite"chunked)mode="append"
- Do I need to run commands / keep sessions?
- One-off commands: (shell command) + read output
mcp__desktop-commander__start_process - REPL / SSH / DB / dev server: →
start_process→interact_with_processread_process_output
- Is this a high-risk operation (config changes, killing processes, bulk edits/moves, any data loss)?
- Explain impact + rollback first; require explicit user confirmation before executing.
- Prefer making config changes in a separate chat (official guidance).
- 是否需要查找内容?
- 文件名/路径:(
mcp__desktop-commander__start_search)→searchType="files"mcp__desktop-commander__get_more_search_results - 文件内容:(
mcp__desktop-commander__start_search)→ 分页读取 → 完成后调用searchType="content"mcp__desktop-commander__stop_search
- 是否需要读取或修改内容?
- 读取:(使用
mcp__desktop-commander__read_file参数;使用offset/length读取尾部内容)offset=-N - 小型修改:(默认替换1次;多替换需设置
mcp__desktop-commander__edit_block参数)expected_replacements - 大型修改:分块使用(先
mcp__desktop-commander__write_file再mode="rewrite")mode="append"
- 是否需要运行命令/保持会话?
- 一次性命令:(执行shell命令)+ 读取输出
mcp__desktop-commander__start_process - REPL / SSH / 数据库 / 开发服务器:→
start_process→interact_with_processread_process_output
- 是否属于高风险操作(配置修改、终止进程、批量编辑/移动、可能导致数据丢失的操作)?
- 先说明影响及回滚方案;执行前需获得用户明确确认。
- 建议在单独会话中进行配置修改(官方指导)。
Recipes
操作指南
Reading files
读取文件
- Text/code: with pagination; logs:
read_file(tail-like).offset=-200 - Multiple files: to reduce round trips.
read_multiple_files - URLs: with
read_filefor web content/images.isUrl: true
- 文本/代码:使用分页读取;日志文件:使用
read_file(类似tail命令)。offset=-200 - 多文件:使用减少往返次数。
read_multiple_files - URL:设置后使用
isUrl: true读取网页内容/图片。read_file
Editing files
编辑文件
- Targeted replace: with minimal unique context; for many occurrences set
edit_block.expected_replacements - Rewrites: in 25–30 line chunks (
write_filethenrewrite).append - Excel: read via ; edit via
read_filewithedit_block+ 2D array.range - PDFs: only via (do not use
write_pdffor PDFs).write_file
- 目标替换:使用并提供最少唯一上下文;多替换场景设置
edit_block参数。expected_replacements - 重写:分25-30行块使用(先
write_file再rewrite)。append - Excel:使用读取;使用
read_file并配合edit_block参数+二维数组进行编辑。range - PDF:仅通过操作(请勿使用
write_pdf处理PDF)。write_file
Search
搜索
- Prefer +
start_searchfor repo exploration; stop searches you no longer need.get_more_search_results - Use for patterns with special characters (parentheses, brackets, dots, etc.).
literalSearch: true
- 探索代码仓库时,优先使用+
start_search;不再需要时停止搜索。get_more_search_results - 搜索含特殊字符(括号、方括号、点号等)的模式时,设置。
literalSearch: true
Processes & interaction
进程与交互
- Data analysis: run , then use
python3 -ifor pandas/numpy workflows.interact_with_process - Observing long jobs: call periodically; to stop use
read_process_output/kill_process(high-risk).force_terminate - Status: /
list_sessions.list_processes
- 数据分析:运行,然后使用
python3 -i进行pandas/numpy工作流操作。interact_with_process - 监控长期任务:定期调用;终止任务使用
read_process_output/kill_process(高风险操作)。force_terminate - 状态查看:/
list_sessions。list_processes
Config & audit
配置与审计
- /
get_config: use carefully; directory restrictions are not a security boundary for terminal commands.set_config_value - : recover context and debug “what happened”.
get_recent_tool_calls - : usage/performance insight.
get_usage_stats
- /
get_config:谨慎使用;目录限制并非终端命令的安全边界。set_config_value - :恢复上下文并调试“操作历史”。
get_recent_tool_calls - :获取使用情况/性能洞察。
get_usage_stats
Guardrails (must follow)
约束规则(必须遵守)
- Prefer absolute paths; don’t assume OS-specific separators.
- For big changes: read first; keep edits small; chunk writes; keep rollback in mind.
- High-risk actions require explicit confirmation: config changes, killing sessions/processes, bulk file edits/moves, any destructive command.
- Security: limits filesystem tools, not terminal commands—don’t treat it as sandboxing.
allowedDirectories
- 优先使用绝对路径;不要假设特定操作系统的路径分隔符。
- 大型修改:先读取内容;保持编辑粒度小;分块写入;提前考虑回滚方案。
- 高风险操作需明确确认:配置修改、终止会话/进程、批量文件编辑/移动、任何破坏性命令。
- 安全提示:仅限制文件系统工具,不限制终端命令——请勿将其视为沙箱环境。
allowedDirectories
References
参考资料
- Official notes + tool list:
skills/desktop-commander/references/desktop-commander.md
- 官方说明+工具列表:
skills/desktop-commander/references/desktop-commander.md