Token导航 LogoToken导航TokenDH.com
Docx Comments MCP logo
文档知识stdio官方级别未说明来源级核验

Docx Comments MCP

MCP Server

一个为Claude Desktop提供的MCP服务器,支持对Word文档的全面读写访问,包括评论、跟踪更改和回复线程等功能。

工具数

7

提示词数

0

GitHub Stars

0

资源数

0
文档处理版本控制PythonClaude办公自动化Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

kosh-jelly

提供方

kosh-jelly

最后核验

2026/5/17 20:23

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run pytest -v

详细介绍

docx评论mcp

Claude Desktop的MCP服务器,提供对Word文档的全面读/写访问,包括注释、跟踪更改和回复线程——这些功能 python-docx 没有完全暴露。

特性

  • 阅读文档:提取文本、评论(带回复线程)并跟踪更改
  • 添加评论:将评论锚定到文档中的特定文本
  • 对评论的回复:对现有评论创建线程回复
  • 跟踪更改:进行编辑,并跟踪插入和删除
  • 解决评论:将评论标记为已完成
  • 接受/拒绝更改:应用或撤消跟踪的更改

安装

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

# Install with uv
uv sync

使用Claude Desktop

添加到您的 claude_desktop_config.json:

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

可用工具

read_document

阅读Word文档并提取内容、注释和跟踪更改。

参数:

  • path (必填):.docx文件的路径
  • include_text (默认值:true):包含完整文档文本
  • include_comments (默认值:true):包含带有锚点的评论
  • include_track_changes (默认值:true):包括插入/删除

退货:

{
  "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

在Word文档中添加锚定到特定文本的注释。

参数:

  • path (必填):.docx文件的路径
  • anchor_text (必填):用于锚定评论的文本(必须存在且唯一)
  • comment_text (必填):评论内容
  • author (默认:“Claude”):评论作者姓名
  • output_path (可选):保存到新文件;如果省略,则创建带时间戳的备份并覆盖

退货:

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

create_reply

为现有评论添加回复。

参数:

  • path (必填):.docx文件的路径
  • parent_comment_id (必填):要回复的评论ID
  • reply_text (必填):回复内容
  • author (默认:“Claude”):回复作者姓名
  • output_path (可选):保存到新文件;如果省略,则创建备份

create_track_change

在启用轨迹更改(插入、删除或替换)的情况下进行编辑。

参数:

  • path (必填):.docx文件的路径
  • find_text (必填):要查找和修改的文本
  • replace_with (必填):替换文本(删除时为空字符串)
  • author (默认:“Claude”):更改作者姓名
  • output_path (可选):保存到新文件;如果省略,则创建备份

mark_comment_resolved

将评论标记为已解决/已完成。

参数:

  • path (必填):.docx文件的路径
  • comment_id (必填):要解决的评论ID
  • output_path (可选):保存到新文件;如果省略,则创建备份

accept_change

接受跟踪更改(永久应用)。

参数:

  • path (必填):.docx文件的路径
  • change_id (必填):要接受的轨道更改的ID
  • output_path (可选):保存到新文件;如果省略,则创建备份

reject_change

拒绝跟踪的更改(撤消更改)。

参数:

  • path (必填):.docx文件的路径
  • change_id (必填):要拒绝的轨道更改的ID
  • output_path (可选):保存到新文件;如果省略,则创建备份

安全特性

  • 自动备份:在未指定的情况下修改文件时 output_path创建带时间戳的备份(例如。, document.backup_20250119_143022.docx)
  • 原子写入:使用临时文件和原子移动来防止损坏
  • 独特的锚匹配:评论需要独特的锚文本以防止歧义

发展

# 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

建筑

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

许可证

麻省理工学院

目录标签

目录标签

文档处理版本控制PythonClaude办公自动化本地部署Word批注协作编辑

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

7

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP