safe-docx
safe-docx is a TypeScript-based MCP server for surgically editing, comparing, and analyzing existing Microsoft Word .docx files and Google Docs in agent workflows, with a focus on formatting preservation and deterministic edits.
Reading & Searching
read_file– Read document content in various formats (toon,json,simple) with paginationgrep– Search paragraphs using regex across one or multiple files, with optional XML-level searchget_file_status– Retrieve file/session metadata (edit count, normalization stats, cache info)
Editing
replace_text– Replace text within a paragraph by ID, preserving formattinginsert_paragraph– Insert a new paragraph before/after an anchor, with optional style cloningformat_layout– Apply paragraph spacing, table row height, and cell padding controlsclear_formatting– Remove specific run-level formatting (bold, italic, underline, highlight, color, font)
Batch & Multi-Agent Planning
init_plan– Initialize revision-bound context for coordinated multi-agent planningmerge_plans– Deterministically merge sub-agent plans and detect conflicts before applyingapply_plan– Validate and apply a batch of edit steps atomically
Saving & Comparing
save– Save as clean output, tracked-changes output, or both; supports Google Docs checkpointingcompare_documents– Compare two DOCX files and produce a tracked-changes output document
Tracked Changes
has_tracked_changes– Check whether a document contains tracked-change markersaccept_changes– Accept all tracked changes to produce a clean documentextract_revisions– Extract tracked changes as structured JSON with before/after text and comments (paginated)
Comments
add_comment/get_comments/delete_comment– Add, retrieve, and delete comments and threaded replies anchored to paragraphs or specific text
Footnotes
add_footnote/get_footnotes/update_footnote/delete_footnote– Full CRUD for footnotes anchored to paragraphs
Session Management
close_file– Close an open file session or clear all sessions
The server runs entirely locally with no external server dependencies, supporting both DOCX files and Google Docs integration.
Allows editing of Google Docs documents alongside DOCX files, supporting operations such as reading, searching, replacing text, inserting paragraphs, adding comments and footnotes, and applying layout formatting controls to documents stored in Google Drive.
Safe Docx
Edit Word and OpenDocument files with coding agents.
English · Español · 简体中文 · Português · Deutsch
Safe Docx is a local MCP server and CLI for reading, searching, editing, comparing, converting, and saving document files. It preserves DOCX structure and can produce clean or tracked-changes output.
Example
Ask your coding agent:
Edit NDA.docx. Change the governing law from New York to Delaware.
Save a clean copy and a tracked-changes copy. Do not change anything else.Safe Docx finds the clause, applies the targeted edit, and writes both files for review. The rest of the document stays outside the requested edit.
Follow the complete editing walkthrough.
Related MCP server: DOCX MCP Server
Comparisons
Install
npm install --global @usejunior/safe-docxThen configure your MCP client with the installed executable's absolute path. For Claude Code:
claude mcp add safe-docx -- /absolute/path/to/safe-docxSee Installation and verification for locating the executable, pinning a version, and configuring clients.
Documentation
Standards Conformance
See the generated ECMA-376 conformance report for targeted sections, explicit non-goals, and verification references.
What Safe Docx Is Not Optimized For
Safe Docx is not a visual editor or layout engine. It does not provide browser rendering, real-time collaboration, or pixel-level pagination guarantees. .dotx templates must be converted to .docx before use.
Maintenance
Appeared in Searches
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/UseJunior/safe-docx'
If you have feedback or need assistance with the MCP directory API, please join our Discord server