Quick Start
Goal: Use Desktop Commander MCP to turn "files/processes/search/edit" into tool calls that are verifiable, replayable, and risk-controllable, rather than treating the whole machine as a black box.
The 4 most commonly used entry points:
- File reading: prefer
mcp__desktop-commander__read_file(supports pagination, negative offset tail-like behavior, PDF/images/Excel/URL). - Small-scope changes: prefer
mcp__desktop-commander__edit_block(precise text replacement/Excel range updates), avoid rewriting the entire file. - Large-scope changes: use
mcp__desktop-commander__write_fileto write in chunks (obeyfileWriteLineLimit)。 - Long commands/interaction: use
mcp__desktop-commander__start_process+mcp__desktop-commander__interact_with_process+mcp__desktop-commander__read_process_output。
For a more complete tool list and key points, see:skills/desktop-commander-mcp/references/desktop-commander-mcp-official.md。
Workflow Decision Tree
- Do I need to "find something"?
- File name/directory:
mcp__desktop-commander__start_search(searchType="files")→mcp__desktop-commander__get_more_search_results - File content/code keywords:
mcp__desktop-commander__start_search(searchType="content") → retrieve results in pages → if necessarymcp__desktop-commander__stop_search
- Do I need to "read content" or "modify content"?
- Read-only:
mcp__desktop-commander__read_file(for large files useoffset/length; to get the end useoffset=-N) - Small changes:
mcp__desktop-commander__edit_block(by default replaces only 1 occurrence; for multiple occurrences useexpected_replacementsto specify the count) - Large changes:
mcp__desktop-commander__write_file(mode="rewrite"+ subsequentmode="append"chunked writes)
- Do I need to "run commands/maintain sessions"?
- One-off commands (short output is acceptable): use
mcp__desktop-commander__start_processto runbashor a specific command - Interactive REPL/SSH/database/dev server:
start_processstart →interact_with_processsend input →read_process_outputpull output
- Do risky operations involve: configuration changes / terminating processes / bulk file changes / deleting data?
- First clarify the scope of impact and rollback plan; execute only after explicit user confirmation.
- Prefer to make configuration changes in a separate conversation (the official documentation emphasizes this), to avoid expanding access scope "just to solve permissions".
Common Recipes
File Reading
- Read text/code: use
mcp__desktop-commander__read_file, for large files useoffset/lengthpagination; to view the end of a log useoffset=-200(similar totail)。 - Read multiple files: use
mcp__desktop-commander__read_multiple_files, which saves interaction cost compared with reading in a loop. - Read URL:
mcp__desktop-commander__read_filepassisUrl: true(suitable for pulling web pages/images into context for analysis).
File Editing
- Precise replacement (recommended): use
mcp__desktop-commander__edit_block, writeold_string/new_stringas the smallest uniquely matching context; for multiple replacements be sure to setexpected_replacements。 - Rewrite file: use
mcp__desktop-commander__write_filein chunks of 25–30 lines, firstmode="rewrite", then multiplemode="append"; avoid writing more thanfileWriteLineLimit。 - Excel: for reading use
read_file, for modification useedit_block'srange+ two-dimensional array content. - PDF: for creation/modification use only
mcp__desktop-commander__write_pdf(do not usewrite_fileto write PDF).
Search
- For codebase exploration, prefer
mcp__desktop-commander__start_search; when pagination/long searches are needed, use it together withget_more_search_results, and after it is no longer neededstop_search。 - To find a filename:
searchType="files"; to find content:searchType="content"; when exact matching of special characters is needed, setliteralSearchtotrue。
Processes and interaction
- Data analysis (recommended):
mcp__desktop-commander__start_processrunpython3 -i→interact_with_processimport pandas/numpy → read the file → print the result. - Observe long tasks: periodically call
mcp__desktop-commander__read_process_outputto pull new output; when stuck/needing to stop, usemcp__desktop-commander__kill_processormcp__desktop-commander__force_terminate(high risk, confirm first). - Troubleshoot status:
mcp__desktop-commander__list_sessions/mcp__desktop-commander__list_processes。
Configuration and auditing
mcp__desktop-commander__get_config/mcp__desktop-commander__set_config_value: use with caution; the official documentation points out that directory restrictions do not constitute a security boundary for "terminal commands".mcp__desktop-commander__get_recent_tool_calls: restore context, debug "what did I do before".mcp__desktop-commander__get_usage_stats: understand usage and performance.
Constraints and red lines (must be followed)
- Paths: use absolute paths whenever possible; when cross-platform is involved, do not assume separators or drive letters.
- Major changes: first use
read_fileto confirm the current state; keep changes as local as possible; writes must be chunked and rollback-capable. - High-risk operations (only do after explicit confirmation): modifying configuration, terminating processes/sessions, batch changes/moving files, any terminal command that may cause data loss.
- Security: the official documentation clearly states that
allowedDirectoriesonly restricts file tools, not terminal commands; do not treat it as a "sandbox/isolation".
Reference materials
- Excerpts and tool list:
skills/desktop-commander-mcp/references/desktop-commander-mcp-official.md