Edit existing Word documents with coding agents
Open-source MCP server for editing existing Microsoft Word .docx files. Formatting-preserving, deterministic edits — replace text, add comments, compare versions, and extract tracked changes.
Claude Code:
claude mcp add safe-docx -- npx -y @usejunior/safe-docx
What safe-docx does
Formatting-preserving edits
Surgical text replacement and paragraph insertion that preserve document structure, styles, and review semantics.
Document comparison
Compare two versions of a document and produce tracked-changes output for human review.
Comments and footnotes
Add, delete, and update comments and footnotes programmatically while keeping formatting intact.
Revision extraction
Extract tracked changes as structured JSON for analysis, reporting, or downstream processing.
23 MCP tools across 7 categories
Each tool is typed with Zod schemas and designed for agent consumption.
Reading & Inspection (7)
read_file, grep, get_session_status, has_tracked_changes, get_comments, get_footnotes, extract_revisions
Planning & Batch (3)
init_plan, merge_plans, apply_plan
Text Editing (2)
replace_text, insert_paragraph
Comments & Footnotes (5)
add_comment, delete_comment, add_footnote, update_footnote, delete_footnote
Layout & Formatting (1)
format_layout
Tracked Changes (2)
accept_changes, compare_documents
File Operations (2)
save, clear_session
Trust & reliability
990+
Automated tests
100%
OpenSpec traceability
MIT
Open-source license
Used by lawyers in production
See how safe-docx is being used for real document work.
Am Law 100 Firm
per document translation with format preservation
Read case study →How safe-docx compares
Install options
Claude Code
claude mcp add safe-docx -- npx -y @usejunior/safe-docx
Gemini CLI
gemini extensions install https://github.com/UseJunior/safe-docx
MCP config (claude_desktop_config.json)
{
"mcpServers": {
"safe-docx": {
"command": "npx",
"args": ["-y", "@usejunior/safe-docx"]
}
}
}
npm (global)
npm install -g @usejunior/safe-docx
Need to generate new documents?
safe-docx edits existing Word documents. To generate new ones from contract templates, use Open Agreements.
Open Agreements — contract template filling