docx-mcp

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.

Category
访问服务器

README

docx-mcp

PyPI Python License: MIT CI Coverage Sponsor

<a href="https://glama.ai/mcp/servers/h4x0r/docx-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/h4x0r/docx-mcp/badges/card.svg" alt="docx-mcp MCP server" /> </a>

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

The only cross-platform MCP server that combines track changes, comments, and footnotes in a single package — with OOXML-level structural validation that no other server offers.

Features

Capability Description
Track changes Insert/delete text with proper w:ins/w:del markup — shows as revisions in Word
Comments Add comments, reply to threads, read existing comments
Footnotes Add footnotes, list all footnotes, validate cross-references
ParaId validation Check uniqueness across all document parts (headers, footers, footnotes)
Watermark removal Detect and remove VML watermarks (e.g., DRAFT) from headers
Structural audit Validate footnotes, paraIds, heading levels, bookmarks, relationships, images
Text search Search across body, footnotes, and comments — plain text or regex
Heading extraction Get the full heading structure with levels and paragraph IDs

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"]
    }
  }
}

With pip install

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

Available Tools

Document Lifecycle

Tool Description
open_document Open a .docx file for reading and editing
close_document Close the current document and clean up
get_document_info Get overview stats (paragraphs, headings, footnotes, comments)
save_document Save changes back to .docx (can overwrite or save to new path)

Reading

Tool Description
get_headings Get heading structure with levels, text, styles, and paraIds
search_text Search across body, footnotes, and comments (text or regex)
get_paragraph Get full text and style of a paragraph by paraId

Track Changes

Tool Description
insert_text Insert text with tracked-change markup (w:ins)
delete_text Mark text as deleted with tracked-change markup (w:del)

Comments

Tool Description
get_comments List all comments with ID, author, date, and text
add_comment Add a comment anchored to a paragraph
reply_to_comment Reply to an existing comment (threaded)

Footnotes

Tool Description
get_footnotes List all footnotes with ID and text
add_footnote Add a footnote with superscript reference
validate_footnotes Cross-reference IDs between document body and footnotes.xml

Validation & Audit

Tool Description
validate_paraids Check paraId uniqueness and range validity across all parts
remove_watermark Remove VML watermarks from document headers
audit_document Comprehensive structural audit (footnotes, paraIds, headings, bookmarks, relationships, images, 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

<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=95beebbb-0f2e-46cc-9a68-a8e66f613180" />

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选