Revise without rebuilding
Replace text and insert paragraphs in existing Word files while preserving their structure and formatting.
The open-source, standards-grounded DOCX engine for AI agents.
Edit existing Word files with Claude Code, Gemini CLI, Cursor, or another MCP-compatible agent. SafeDocx helps preserve document structure while producing tracked changes and comments people can review in Word.
Representative edit
Section 8. Limitation of liability
In no event will either party's aggregate liability exceed the fees paid during the three months preceding the claim.
Section 8. Limitation of liability
In no event will either party's aggregate liability exceed the fees paid during the three months twelve months preceding the claim.
Replacement recorded as a tracked change
Illustrative states backed by editing operations SafeDocx exposes—not a live benchmark run.
Built for document review
Replace text and insert paragraphs in existing Word files while preserving their structure and formatting.
Produce tracked replacements or compare versions so reviewers can see what changed before accepting it.
Add and update comments so questions and explanations stay attached to the passage under review.
Keep mechanics out of the prompt
Splitting runs and chasing numbering references competes for the same context window as the work users actually care about.
Agent context
Intent, clause meaning, business constraints, reviewer instructions.
Engine boundary
Runs, relationships, numbering, revision markup, comments, and package integrity.
Inspectable evidence
The existing open benchmark runs shared task fixtures through small adapters and checks the resulting document. Scenario outcomes do not imply that every adapter implements the benchmark's full operation surface.
See the compatibility resultsStart locally
The MCP server runs on your machine. Your AI client and model provider remain separate parts of the data path.
Common questions
Yes, with safe-docx as the bridge. Claude can read text from .docx files natively and generate new ones via its file-creation tool. For surgical edits to an existing document that preserve formatting, tracked changes, and comments, safe-docx is the open-source MCP server that adds that capability. After claude mcp add safe-docx -- npx -y @usejunior/safe-docx, your Claude agent has typed tool calls for replacing text, adding comments, comparing versions, and extracting tracked changes.
Yes - safe-docx is an Apache-2.0-licensed Model Context Protocol server specifically for editing existing Microsoft Word .docx files. It exposes 26 typed tools across 8 categories (structural inspection, text editing, controlled batches, comment and footnote management, tracked-change controls, comparison, and export). It runs locally via npx and works with any MCP-compatible client (Claude Code, Gemini CLI, Cursor).
Yes. safe-docx round-trips OOXML <w:ins> and <w:del> elements, the associated <w:rPr> formatting on revision marks, and comment ranges (<w:commentRangeStart> / <w:commentRangeEnd>). When the agent makes an edit, you can choose to wrap that edit in a tracked-change marker so Word's Track Changes view shows the agent's revisions alongside any human ones already in the document.
python-docx is a Python library focused on generating new .docx files programmatically. safe-docx is a TypeScript-native MCP server purpose-built for editing existing documents AI agents need to work with - surgical text replacement, comment manipulation, comparison, and revision extraction, all preserving the original formatting. See the feature-by-feature comparison for specifics on tracked-change handling, OOXML coverage, and round-trip fidelity.
safe-docx runs entirely on your local machine as an MCP server process started by your AI client (Claude Code, Gemini CLI, etc.). It reads and writes .docx files on your local filesystem. safe-docx does not send document content to any UseJunior server, third-party server, or cloud service. Network access is required only for the initial npm install and for updates.
Important nuance: safe-docx itself is local-only, but your AI client may upload prompt content (including text extracted from the document) to its own model provider as part of how it processes your request. That data flow is governed by your AI client's terms (Anthropic, Google, etc.), not by safe-docx. If you need a fully air-gapped workflow, pair safe-docx with a local model.
Yes. safe-docx is an MCP server, so any MCP-compatible client can use it. For Gemini CLI: gemini extensions install https://github.com/UseJunior/safe-docx. See Quick install for Claude Code and Cursor.
Apache-2.0. Source on GitHub at UseJunior/safe-docx, npm package @usejunior/safe-docx. Contributions welcome.
SafeDocx is free and Apache-2.0 licensed; no SafeDocx account or subscription is required. Install Node.js/npm and use an MCP-compatible agent, then follow Quick install. Your AI client or model provider may charge separately. Start with a copy of a document and review the output in Word.
SafeDocx targets a subset of the Word document standard. Check the compatibility results for the scenarios you need, try a copy of your document, and inspect the output in Word.
Your first edit
Start with a copy, ask for a tracked replacement or reviewer comment, and inspect the output in Word.
Section 8. Limitation of liability
In no event will either party's aggregate liability exceed the fees paid during the three months preceding the claim.