/ 目录 / 演练场 / Office Word MCP
● 社区 GongRzhe ⚡ 即开即用

Office Word MCP

作者 GongRzhe · GongRzhe/Office-Word-MCP-Server

从 Claude 读取、编辑和创建真实的 .docx 文件——段落、表格、标题、批注,以及追踪修订级别的输出。

Office Word MCP 封装了 python-docx,让 Claude 获得对 Word 文档的完整读写权限。适用于报告生成、合同红线标注、批量文档创建,以及将结构化数据转换为正确格式的 Word 输出,供非技术人员使用。支持表格、标题、样式、图片和批注。

为什么要用

核心特性

实时演示

实际使用效果

office-word-mcp.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "office-word-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-server",
        "word_mcp_server"
      ]
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "office-word-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-server",
        "word_mcp_server"
      ]
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "office-word-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-server",
        "word_mcp_server"
      ]
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "office-word-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-server",
        "word_mcp_server"
      ]
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "office-word-mcp",
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-server",
        "word_mcp_server"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "office-word-mcp": {
      "command": {
        "path": "uvx",
        "args": [
          "--from",
          "office-word-mcp-server",
          "word_mcp_server"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add office-word-mcp -- uvx --from office-word-mcp-server word_mcp_server

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: Office Word MCP

将每周状态报告生成为精美的 Word 文档

👤 以 .docx 格式交付成果的项目经理、分析师和顾问 ⏱ ~25 min beginner

何时使用: 客户要求 Word 格式,而非 Markdown 或 PDF,且你不想每周都手动复制粘贴。

前置条件
  • 用于复制样式的模板文档 — 将你的标准报告保存为 ~/templates/status-report.docx
步骤
  1. 打开模板
    Use word-mcp. Open ~/templates/status-report.docx and tell me its structure (headings + table count).✓ 已复制
    → 返回大纲——H1、H2 列表,表格维度
  2. 填入本周数据
    Save a copy as week-of-2026-04-27.docx. Replace placeholder tables with this week's numbers (paste data). Leave the cover page intact.✓ 已复制
    → 副本已保存,表格已更新,封面页保持不变
  3. 添加摘要段落
    Under 'Executive Summary', insert 3 paragraphs covering top wins, blockers, and asks. Match the existing paragraph style.✓ 已复制
    → 段落以正确样式添加

结果: 每周无需手动排版,直接生成可交付的 Word 报告。

注意事项
  • 模板自定义字体未嵌入 — python-docx 写入字体引用;如果收件人缺少字体,通过 Word UI 嵌入,或坚持使用系统字体
搭配使用: filesystem

用批注对合同草案进行红线标注

👤 审查第三方草案的法务相关岗位 ⏱ ~30 min intermediate

何时使用: 你收到合同草案,希望 Claude 标出有风险的条款并添加锚定批注。

步骤
  1. 读取文档
    Read contract.docx. List the section headings and any clauses with payment terms or liability caps.✓ 已复制
    → 章节索引,加上高亮显示的条款
  2. 在风险点添加批注
    For each risky clause, add a comment from 'Claude' explaining the concern and a suggested redline.✓ 已复制
    → 在 Word 中打开时批注可见

结果: 标注好的草案,可直接转发给实际律师审查。

注意事项
  • 长段落中锚点出现偏移 — 按句而非按段锚定;在 Word 中重新打开以验证

邮件合并式:从 CSV 生成 50 封个性化信函

👤 发送个性化通信的运营/HR/行政人员 ⏱ ~20 min beginner

何时使用: 你有收件人列表和模板信函,需要为每个人生成一份 .docx 文件。

前置条件
  • CSV 格式的收件人列表 — 列:name、email、custom_field
步骤
  1. 映射字段
    Open template.docx. Show me every {{placeholder}} and ask which CSV column maps to each.✓ 已复制
    → 占位符列表,映射提示
  2. 执行合并
    For each row in recipients.csv, render template.docx into ./output/<lastname>.docx. Confirm count at the end.✓ 已复制
    → 已写入 N 个文件;报告行数与文件数匹配

结果: 按收件人生成的 .docx 文件,可直接作为邮件附件。

注意事项
  • 姓名中的特殊字符导致文件名出错 — 保存前先对文件名进行 slug 化处理
搭配使用: filesystem

组合

与其他 MCP 搭配,撬动十倍杠杆

office-word-mcp + office-powerpoint-mcp

从同一数据源生成 Word 报告和对应幻灯片

office-word-mcp + filesystem

读取 CSV 输入,按行输出 docx 文件

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
create_document filename, title?, author? 创建新文档 0
get_document_text filename 读取现有内容 0
add_paragraph filename, text, style? 追加正文内容 0
add_heading filename, text, level 构建章节结构 0
add_table filename, rows, cols, data? 表格内容 0
search_and_replace filename, find, replace 批量文本修改/模板填充 0
add_comment filename, paragraph_index, text, author 红线标注 0

成本与限制

运行它的成本

API 配额
不适用——本地运行
每次调用 Token 数
每次调用 100-500
费用
免费(MIT 协议)
提示
使用 search_and_replace 替代流式全文重写

安全

权限、密钥、影响范围

最小权限: filesystem-read filesystem-write
凭据存储:
数据出站:

故障排查

常见错误与修复

保存时 PermissionError

文件在 Word 中已打开——让 Claude 写入前先关闭它

样式未应用

python-docx 中样式名区分大小写;检查原始模板的样式名称

批注未显示

确保 Word 打开时批注面板可见;批注已正确保存在 .docx XML 中

替代方案

Office Word MCP 对比其他方案

替代方案何时用它替代权衡
Office PowerPoint MCP你需要的是幻灯片,不是文档不同的功能面,同一作者
Excel MCP Server你需要电子表格Excel 用于表格数据;Word 用于文字内容

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills