MCP Hub
Back to servers

docx-mcp

An MCP server for reading, editing, and validating Microsoft Word documents with specialized support for track changes, comments, and footnotes. It enables structural auditing, heading extraction, and precise OOXML-level document manipulation through natural language tools.

glama
Stars
1
Updated
Mar 23, 2026
Validated
May 7, 2026

docx-mcp

PyPI Python License: MIT CI Coverage Sponsor

docx-mcp MCP server

MCP server for reading and editing Word (.docx) documents with track changes, comments, footnotes, tables, images, sections, and structural validation.

The only cross-platform MCP server that combines track changes, comments, footnotes, tables, formatting, images, sections, cross-references, document merge, and protection in a single package — with OOXML-level structural validation that no other server offers.

Features

CapabilityDescription
Track changesInsert/delete text with proper w:ins/w:del markup — shows as revisions in Word
Accept/reject changesAccept or reject tracked changes (all or by author)
Character formattingBold, italic, underline, color — with tracked-change markup
CommentsAdd comments, reply to threads, read existing comments
Footnotes & endnotesAdd, list, and validate cross-references for both
TablesCreate tables, modify cells, add/delete rows — all with tracked changes
ListsApply bullet or numbered list formatting to paragraphs
ImagesList embedded images, insert new images with dimensions
Headers/footersRead and edit header/footer content with tracked changes
Styles & propertiesRead styles, get/set document properties (title, creator, etc.)
Sections & page breaksInsert page/section breaks, set page size/orientation/margins
Cross-referencesAdd internal hyperlinks between paragraphs with bookmarks
Document mergeMerge content from another DOCX with automatic paraId remapping
Document protectionSet tracked-changes/read-only/comments protection with SHA-512 passwords
Structural auditValidate footnotes, endnotes, paraIds, headings, bookmarks, tables, images, protection
Watermark removalDetect and remove VML watermarks (e.g., DRAFT) from headers

Installation

# Claude Code (recommended)
claude mcp add docx-mcp -- uvx docx-mcp-server

# With pip
pip install docx-mcp-server

# With uvx
uvx docx-mcp-server

Optional: Install the companion skill for Claude Code — it teaches Claude when and how to use the tools automatically:

curl -sSL https://raw.githubusercontent.com/SecurityRonin/docx-mcp/main/install.sh | bash

Configuration

Claude Desktop / Claude Code

Add to your MCP settings:

{
  "mcpServers": {
    "docx-mcp": {
      "command": "uvx",
      "args": ["docx-mcp-server"]
    }
  }
}

Cursor / Windsurf / VS Code

Add to your MCP configuration file:

{
  "mcpServers": {
    "docx-mcp": {
      "command": "uvx",
      "args": ["docx-mcp-server"]
    }
  }
}

OpenClaw

Add to your openclaw.yaml:

mcpServers:
  docx-mcp:
    command: uvx
    args:
      - docx-mcp-server

Or via the CLI:

openclaw config set mcpServers.docx-mcp.command "uvx"
openclaw config set mcpServers.docx-mcp.args '["docx-mcp-server"]'

With pip install

{
  "mcpServers": {
    "docx-mcp": {
      "command": "docx-mcp"
    }
  }
}

Available Tools (37)

Document Lifecycle

ToolDescription
open_documentOpen a .docx file for reading and editing
close_documentClose the current document and clean up
get_document_infoGet overview stats (paragraphs, headings, footnotes, comments)
save_documentSave changes back to .docx (can overwrite or save to new path)

Reading

ToolDescription
get_headingsGet heading structure with levels, text, styles, and paraIds
search_textSearch across body, footnotes, and comments (text or regex)
get_paragraphGet full text and style of a paragraph by paraId

Track Changes

ToolDescription
insert_textInsert text with tracked-change markup (w:ins)
delete_textMark text as deleted with tracked-change markup (w:del)
accept_changesAccept tracked changes (all or by author)
reject_changesReject tracked changes (all or by author)
set_formattingApply bold/italic/underline/color with tracked-change markup

Tables

ToolDescription
get_tablesGet all tables with row/column counts and cell content
add_tableInsert a new table after a paragraph with tracked insertion
modify_cellModify a table cell with tracked changes
add_table_rowAdd a row to a table with tracked insertion
delete_table_rowDelete a table row with tracked changes

Lists

ToolDescription
add_listApply bullet or numbered list formatting to paragraphs

Comments

ToolDescription
get_commentsList all comments with ID, author, date, and text
add_commentAdd a comment anchored to a paragraph
reply_to_commentReply to an existing comment (threaded)

Footnotes & Endnotes

ToolDescription
get_footnotesList all footnotes with ID and text
add_footnoteAdd a footnote with superscript reference
validate_footnotesCross-reference footnote IDs between body and footnotes.xml
get_endnotesList all endnotes with ID and text
add_endnoteAdd an endnote with superscript reference
validate_endnotesCross-reference endnote IDs between body and endnotes.xml

Headers, Footers & Styles

ToolDescription
get_headers_footersGet all headers and footers with text content
edit_header_footerEdit header/footer text with tracked changes
get_stylesGet all defined styles with ID, name, type, and base style

Properties & Images

ToolDescription
get_propertiesGet core document properties (title, creator, dates, revision)
set_propertiesSet core document properties (title, creator, subject, description)
get_imagesGet all embedded images with rId, filename, content type, dimensions
insert_imageInsert an image after a paragraph with specified dimensions

Sections & Cross-References

ToolDescription
add_page_breakInsert a page break after a paragraph
add_section_breakAdd a section break (nextPage, continuous, evenPage, oddPage)
set_section_propertiesSet page size, orientation, and margins for a section
add_cross_referenceAdd a cross-reference link between paragraphs with bookmarks

Protection & Merge

ToolDescription
set_document_protectionSet document protection (trackedChanges, readOnly, comments, forms)
merge_documentsMerge content from another DOCX with paraId remapping

Validation & Audit

ToolDescription
validate_paraidsCheck paraId uniqueness and range validity across all parts
remove_watermarkRemove VML watermarks from document headers
audit_documentComprehensive structural audit (footnotes, endnotes, paraIds, headings, bookmarks, tables, relationships, images, protection, artifacts)

Example Workflow

1. open_document("/path/to/contract.docx")
2. get_headings()                          → see document structure
3. search_text("30 days")                  → find the clause
4. delete_text(para_id, "30 days")         → tracked deletion
5. insert_text(para_id, "60 days")         → tracked insertion
6. add_comment(para_id, "Extended per client request")
7. audit_document()                        → verify structural integrity
8. save_document("/path/to/contract_revised.docx")

The resulting document opens in Microsoft Word with proper revision marks — deletions shown as red strikethrough, insertions as green underline, comments in the sidebar.

How It Works

A .docx file is a ZIP archive of XML files. This server:

  1. Unpacks the archive to a temporary directory
  2. Parses all XML parts with lxml and caches them in memory
  3. Edits the cached DOM trees directly (no intermediate abstraction layer)
  4. Repacks modified XML back into a valid .docx archive

This approach gives full control over OOXML markup — essential for track changes (w:ins/w:del), comments (w:comment + range markers), and structural validation that higher-level libraries like python-docx don't expose.

Requirements

  • Python 3.10+
  • lxml

License

MIT

Reviews

No reviews yet

Sign in to write a review