Skip to main content
safe-docx for Claude

safe-docx for Claude Code

Edit existing Word documents from Claude without losing formatting, tracked changes, or comments.

One-command install for Claude Code

Add safe-docx as a local stdio MCP server. Claude Code will launch it with npx when the server is needed.

claude mcp add safe-docx -- npx -y @usejunior/safe-docx

This follows Claude Code's local stdio MCP syntax: claude mcp add [options] <name> -- <command> [args...].

What Claude can do once installed

safe-docx exposes typed MCP tools that let Claude inspect, edit, compare, and save existing Microsoft Word files.

Reading & Inspection (7)

Inspect document text, comments, footnotes, and revision state before Claude edits anything.

read_file, grep, get_session_status, has_tracked_changes, get_comments, get_footnotes, extract_revisions

Planning & Batch (3)

Plan multi-step document edits and apply them as a controlled batch.

init_plan, merge_plans, apply_plan

Text Editing (2)

Make surgical in-place text changes while preserving the surrounding Word formatting.

replace_text, insert_paragraph

Comments & Footnotes (5)

Add reviewer notes and citation footnotes without opening Word manually.

add_comment, delete_comment, add_footnote, update_footnote, delete_footnote

Layout & Formatting (1)

Normalize supported layout and formatting details after edits.

format_layout

Tracked Changes (2)

Accept revisions or generate a redline from two document versions.

accept_changes, compare_documents

File Operations (2)

Save the edited .docx output and reset the document session when finished.

save, clear_session

How safe-docx differs from Claude's native file editing

Claude can work directly with DOCX internals, and that built-in capability is useful for custom one-off edits. safe-docx adds a deterministic tool layer for repeated document workflows, so Claude can call the same typed operations instead of improvising XML changes in each session. That makes document reading more consistent, preserves edit semantics, and keeps the workflow portable to other MCP-compatible agents when you need it.

Read the full safe-docx vs Claude file editing comparison →

Claude Code FAQ

Can Claude Code read DOCX files with safe-docx?

Yes. After safe-docx is installed, Claude Code can inspect .docx content through MCP tools such as read_file, grep, get_comments, get_footnotes, and extract_revisions.

Can Claude Code edit DOCX files in place?

Yes. safe-docx gives Claude Code typed tools for replacing text, inserting paragraphs, adding comments, updating footnotes, comparing versions, and saving the edited Word document without rebuilding the file from scratch.

Why use safe-docx instead of Claude's built-in DOCX editing?

Three reasons: (1) Platform independence - safe-docx works with Claude, Gemini, Codex, Goose, and any MCP-compatible agent. (2) Self-contained edit operations - every safe-docx call produces valid .docx output, so there is no risk of half-applied markup when context windows fill up. (3) Consistent behavior - the same tool call follows the same rules every time. See the full comparison.

Does safe-docx preserve formatting when Claude edits a document?

Yes. Edits inherit formatting from the surrounding document context automatically, including styles, numbering, headers, and list levels. That is the main reason safe-docx exists as a separate tool: naive edits to .docx XML often break formatting in ways that only show up when the document is opened in Word.

Can Claude Code produce tracked-changes redlines?

Yes. safe-docx can compare two .docx versions and emit a tracked-changes document, the standard redline format lawyers use to review edits. Tracked changes are visible in Microsoft Word and survive round-trips through other Office editors.

Does safe-docx run locally with Claude Code?

Yes. The Claude Code install command runs safe-docx as a local stdio MCP server through npx -y @usejunior/safe-docx. Your .docx files are handled by the local MCP process.

Give Claude Code a DOCX editing toolbelt

Install safe-docx, open a Word document in your project, and ask Claude to make formatting-preserving edits.