docx-comments

docx-comments

Provides comprehensive read/write access to Word documents, including comments, track changes, and reply threads.

Category
访问服务器

README

docx-comments-mcp

An MCP server for Claude Desktop that provides comprehensive read/write access to Word documents, including comments, track changes, and reply threads — features that python-docx doesn't fully expose.

<!-- mcp-name: io.github.kosh-jelly/docx-comments -->

Features

  • Read documents: Extract text, comments (with reply threads), and track changes
  • Add comments: Anchor comments to specific text in the document
  • Reply to comments: Create threaded replies on existing comments
  • Track changes: Make edits with insertions and deletions tracked
  • Resolve comments: Mark comments as done
  • Accept/reject changes: Apply or undo tracked changes

Installation

# Clone the repository
git clone https://github.com/your-username/docx-comments-mcp.git
cd docx-comments-mcp

# Install with uv
uv sync

Usage with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "docx-comments": {
      "command": "uv",
      "args": ["--directory", "/path/to/docx-comments-mcp", "run", "docx-comments-mcp"]
    }
  }
}

Available Tools

read_document

Read a Word document and extract content, comments, and track changes.

Parameters:

  • path (required): Path to the .docx file
  • include_text (default: true): Include full document text
  • include_comments (default: true): Include comments with anchors
  • include_track_changes (default: true): Include insertions/deletions

Returns:

{
  "metadata": {
    "path": "/path/to/file.docx",
    "author": "Original Author",
    "created": "2025-01-15T10:30:00Z",
    "modified": "2025-01-18T14:22:00Z",
    "word_count": 4523
  },
  "paragraphs": [
    {"index": 0, "text": "The paragraph content...", "style": "Heading 1"}
  ],
  "comments": [
    {
      "id": 0,
      "author": "Dr. Smith",
      "date": "2025-01-16T09:15:00Z",
      "text": "Consider citing Main & Hesse here",
      "anchor_text": "disorganized attachment patterns",
      "anchor_paragraph": 12,
      "resolved": false,
      "replies": [
        {
          "id": 1,
          "parent_id": 0,
          "author": "Josh",
          "date": "2025-01-17T11:00:00Z",
          "text": "Added citation — see revision"
        }
      ]
    }
  ],
  "track_changes": [
    {
      "id": 5,
      "type": "deletion",
      "author": "Dr. Smith",
      "date": "2025-01-16T09:20:00Z",
      "text": "invariably",
      "paragraph": 8
    }
  ]
}

create_comment

Add a comment anchored to specific text in a Word document.

Parameters:

  • path (required): Path to the .docx file
  • anchor_text (required): Text to anchor the comment to (must exist and be unique)
  • comment_text (required): The comment content
  • author (default: "Claude"): Comment author name
  • output_path (optional): Save to new file; if omitted, creates timestamped backup and overwrites

Returns:

{
  "success": true,
  "comment_id": 3,
  "anchored_to": "the exact text that was matched",
  "paragraph": 15,
  "output_path": "/path/to/output.docx"
}

create_reply

Add a reply to an existing comment.

Parameters:

  • path (required): Path to the .docx file
  • parent_comment_id (required): ID of comment to reply to
  • reply_text (required): The reply content
  • author (default: "Claude"): Reply author name
  • output_path (optional): Save to new file; if omitted, creates backup

create_track_change

Make an edit with track changes enabled (insertion, deletion, or replacement).

Parameters:

  • path (required): Path to the .docx file
  • find_text (required): Text to find and modify
  • replace_with (required): Replacement text (empty string for deletion)
  • author (default: "Claude"): Change author name
  • output_path (optional): Save to new file; if omitted, creates backup

mark_comment_resolved

Mark a comment as resolved/done.

Parameters:

  • path (required): Path to the .docx file
  • comment_id (required): ID of comment to resolve
  • output_path (optional): Save to new file; if omitted, creates backup

accept_change

Accept a tracked change (apply permanently).

Parameters:

  • path (required): Path to the .docx file
  • change_id (required): ID of the track change to accept
  • output_path (optional): Save to new file; if omitted, creates backup

reject_change

Reject a tracked change (undo the change).

Parameters:

  • path (required): Path to the .docx file
  • change_id (required): ID of the track change to reject
  • output_path (optional): Save to new file; if omitted, creates backup

Safety Features

  • Automatic backups: When modifying a file without specifying output_path, a timestamped backup is created (e.g., document.backup_20250119_143022.docx)
  • Atomic writes: Uses temporary files and atomic moves to prevent corruption
  • Unique anchor matching: Comments require unique anchor text to prevent ambiguity

Development

# Install dev dependencies
uv sync
uv pip install pytest pytest-asyncio

# Run tests
uv run pytest -v

# Run specific test file
uv run pytest tests/test_reader.py -v

Architecture

src/docx_comments_mcp/
├── __init__.py
├── server.py          # MCP server with tool definitions
├── reader.py          # Read operations (document, comments, track changes)
├── writer.py          # Write operations (add comments, track changes)
└── xml_helpers.py     # Low-level OOXML parsing utilities

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选