Skip to main content
Safe Docx is an open-source TypeScript stack that lets coding agents edit existing Microsoft Word .docx files with full formatting preservation. Install it as an MCP server in seconds and start applying deterministic, reviewable edits to real documents.

Quickstart

Get the MCP server running in under two minutes.

Installation by client

Setup instructions for Claude, Gemini CLI, Cline, and more.

Core workflows

Edit text, insert paragraphs, and save tracked-changes output.

Tool reference

Full reference for all 20+ MCP tools.

Why Safe Docx

AI coding tools are great with code, but weak on brownfield .docx editing. Business and legal workflows still run on Word documents — NDAs, SOWs, financing forms, partnership agreements. Safe Docx bridges that gap:
  • Formatting-preserving editsreplace_text and insert_paragraph operate at the run level, never destroying paragraph structure or inline styles.
  • Tracked-changes output — every edit session can produce a clean copy and a redlined version for human review.
  • Local-first — runs as a local MCP server process; no document content is sent to external servers.
  • No Python or .NET — pure TypeScript runtime using jszip + @xmldom/xmldom.
  • Google Docs support — the same tool surface works on Google Docs via google_doc_id.

What it’s optimized for

Editing existing documents

Surgical text replacement and paragraph insertion on real Word files without formatting loss.

Document comparison

Compare original and revised DOCX files to produce a tracked-changes redline.

Comment & footnote workflows

Add, read, and delete comment threads and footnotes as first-class operations.

Multi-agent batch editing

Plan, merge, and apply batches of edits from multiple agents with conflict detection.

Get started

1

Install the MCP server

Run the server directly — no install required:
npx -y @usejunior/safe-docx
2

Add to your AI client

Configure your MCP client (Claude Desktop, Claude Code, Gemini CLI, Cline) to use the server. See the installation guide for client-specific instructions.
3

Start editing documents

Use natural language with your AI agent to read, edit, compare, and save .docx files. See golden prompts for reliable starting patterns.
Safe Docx is optimized for editing existing Word files. For creating new documents from scratch, use a generation-oriented library like docx.

Build docs developers (and LLMs) love