MCP Word Commander
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Word Commanderread images from report.docx"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
📄 MCP Word Commander
强大的 Word 文档处理 MCP 服务器,支持图片读取/插入、表格操作等功能
让 AI 助手直接读取、编辑和操作 Word 文档
📖 简介
MCP Word Commander 是一个基于 MCP (Model Context Protocol) 的 Word 文档处理服务,允许 AI 助手直接读取、编辑 Word 文档。
✨ 核心功能
功能模块 | 描述 |
🖼️ 图片处理 | 读取图片并直接展示给 AI、插入图片、删除/替换图片 |
📊 表格操作 | 读取表格、在指定位置插入表格、修改单元格、添加/删除行 |
📝 段落编辑 | 添加、替换、插入段落,支持完整的格式设置 |
🔍 搜索替换 | 在文档中搜索并替换文本 |
Related MCP server: Office Word MCP Server
📦 依赖
Python 3.10+
Docker(可选,用于容器化部署)
详见
requirements.txt
🚀 快速开始
方式一:本地运行
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
python server.py
# macOS / Linux
source venv/bin/activate
pip install -r requirements.txt
python server.py方式二:Docker 部署
🐳 使用 Docker Compose(推荐)
# 构建并启动
docker-compose up -d --build
# 查看日志
docker-compose logs -f
# 停止服务
docker-compose down🐳 使用 Docker 命令
# 构建镜像
docker build -t mcp-word-commander:latest .
# 运行容器(挂载本地 documents 目录)
docker run -it --rm \
-v $(pwd)/documents:/documents \
mcp-word-commander:latest
# Windows PowerShell
docker run -it --rm `
-v ${PWD}/documents:/documents `
mcp-word-commander:latest方式三:在 Claude Desktop / Cursor 中配置
本地运行配置
{
"mcpServers": {
"word-commander": {
"command": "python",
"args": ["D:/Program/mcp_word_edit/server.py"],
"env": {}
}
}
}Docker 配置
{
"mcpServers": {
"word-commander": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "D:/Documents:/documents",
"mcp-word-commander:latest"
],
"env": {}
}
}
}⚠️ 注意:使用 Docker 时,文档路径需要是容器内的路径(如
/documents/example.docx),而非宿主机路径。
🛠️ 功能列表
📄 文档基础操作
工具 | 功能描述 |
| 创建新的空白 Word 文档 |
| 获取文档基本信息(段落数、表格数等) |
| 分段读取文档内容和样式 |
📝 段落操作
工具 | 功能描述 |
| 在文档末尾添加带格式的段落 |
| 替换指定段落的内容 |
| 在指定段落后插入新段落 |
| 搜索并替换文本 |
🖼️ 图片操作
工具 | 功能描述 |
| 获取文档中所有图片的元信息 |
| 🌟 读取图片并直接返回给 AI 查看 |
| 在文档末尾添加图片 |
| 在指定段落后插入图片 |
| 删除指定索引的图片 |
| 替换指定索引的图片 |
📊 表格操作
工具 | 功能描述 |
| 读取表格内容 |
| 在文档末尾创建表格 |
| 在指定段落后插入表格 |
| 修改表格单元格内容 |
| 向表格添加新行 |
| 删除表格中的行 |
| 删除整个表格 |
💡 使用示例
🖼️ 读取文档中的图片
# AI 可以直接"看到"文档中的图片
read_images("document.docx")
# 只读取第一张图片
read_images("document.docx", image_index=0)📸 在指定位置插入图片
# 在第 3 段后插入图片,设置宽度为 4 英寸,居中对齐
insert_image_after_paragraph(
file_path="document.docx",
after_index=2,
image_path="image.png",
width_inches=4.0,
alignment="CENTER"
)📊 在指定位置插入表格
# 在第 5 段后插入 3x3 表格
insert_table_after_paragraph(
file_path="document.docx",
after_index=4,
rows=3,
cols=3,
data=[
["姓名", "年龄", "城市"],
["张三", "25", "北京"],
["李四", "30", "上海"]
],
header_bold=True
)✏️ 修改表格单元格
# 修改第一个表格的 (1, 2) 单元格
update_table_cell(
file_path="document.docx",
table_index=0,
row=1,
col=2,
new_text="新内容",
font_name="Microsoft YaHei",
font_size=12,
is_bold=True
)📁 项目结构
mcp_word_edit/
├── 📄 server.py # MCP 服务器主文件
├── 📋 requirements.txt # Python 依赖
├── 🐳 Dockerfile # Docker 镜像配置
├── 🐳 docker-compose.yml # Docker Compose 配置
├── 🚫 .dockerignore # Docker 构建忽略文件
├── 📖 README.md # 说明文档
└── 📂 documents/ # 文档目录(Docker 挂载点)🐳 Docker 相关
💾 数据持久化
使用 Docker 时,建议将本地目录挂载到容器的 /documents 目录:
docker run -it --rm -v /path/to/your/docs:/documents mcp-word-commander:latest📦 镜像信息
项目 | 详情 |
基础镜像 |
|
预计大小 | 约 200MB |
工作目录 |
|
⚡ 技术特点
特性 | 说明 |
🖼️ 图片直接展示 | 使用 MCP 的 |
🔤 支持中文字体 | 完整支持中文字体设置(宋体、黑体等) |
📍 灵活的位置插入 | 支持在任意段落后插入图片和表格 |
📊 完整的表格操作 | 支持增删改查表格及其内容 |
🐳 Docker 支持 | 提供完整的容器化部署方案 |
🤝 贡献
欢迎提交 Issue 或 Pull Request!
在提交前,请确保:
✅ 代码风格一致
✅ 包含必要的说明文档
✅ 通过相关测试
📜 许可证
本项目使用 MIT 许可证,详见 LICENSE 文件。
📄 MCP Word Commander (English)
A powerful Word document processing MCP server with image and table support
Enable AI assistants to directly read, edit, and manipulate Word documents
📖 Overview
MCP Word Commander is a Word document processing service based on MCP (Model Context Protocol), enabling AI assistants to directly read and edit Word documents.
✨ Core Features
Module | Description |
🖼️ Image Processing | Read images and display them directly to AI, insert/delete/replace images |
📊 Table Operations | Read tables, insert tables at specific positions, modify cells, add/delete rows |
📝 Paragraph Editing | Add, replace, insert paragraphs with full formatting support |
🔍 Search & Replace | Find and replace text in documents |
📦 Requirements
Python 3.10+
Docker (optional, for containerized deployment)
See
requirements.txtfor details
🚀 Quick Start
Option 1: Local Installation
# Windows
.venv\Scripts\activate
pip install -r requirements.txt
python server.py
# macOS / Linux
source venv/bin/activate
pip install -r requirements.txt
python server.pyOption 2: Docker Deployment
🐳 Using Docker Compose (Recommended)
# Build and start
docker-compose up -d --build
# View logs
docker-compose logs -f
# Stop service
docker-compose down🐳 Using Docker Command
# Build image
docker build -t mcp-word-commander:latest .
# Run container (mount local documents directory)
docker run -it --rm \
-v $(pwd)/documents:/documents \
mcp-word-commander:latest
# Windows PowerShell
docker run -it --rm `
-v ${PWD}/documents:/documents `
mcp-word-commander:latestOption 3: Configure in Claude Desktop / Cursor
Local Configuration
{
"mcpServers": {
"word-commander": {
"command": "python",
"args": ["/path/to/mcp_word_edit/server.py"],
"env": {}
}
}
}Docker Configuration
{
"mcpServers": {
"word-commander": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "/path/to/documents:/documents",
"mcp-word-commander:latest"
],
"env": {}
}
}
}⚠️ Note: When using Docker, document paths should be container paths (e.g.,
/documents/example.docx), not host paths.
🛠️ Feature List
📄 Basic Document Operations
Tool | Function |
| Create a new blank Word document |
| Get basic document information (paragraph count, table count, etc.) |
| Read document content and styles in segments |
📝 Paragraph Operations
Tool | Function |
| Add a formatted paragraph at the end of document |
| Replace content of a specific paragraph |
| Insert a new paragraph after a specific paragraph |
| Search and replace text |
🖼️ Image Operations
Tool | Function |
| Get metadata of all images in the document |
| 🌟 Read images and return them directly for AI to view |
| Add image at the end of document |
| Insert image after a specific paragraph |
| Delete image by index |
| Replace image by index |
📊 Table Operations
Tool | Function |
| Read table content |
| Create table at the end of document |
| Insert table after a specific paragraph |
| Modify table cell content |
| Add new row to table |
| Delete row from table |
| Delete entire table |
💡 Usage Examples
🖼️ Read Images from Document
# AI can directly "see" images in the document
read_images("document.docx")
# Read only the first image
read_images("document.docx", image_index=0)📸 Insert Image at Specific Position
# Insert image after paragraph 3, set width to 4 inches, center alignment
insert_image_after_paragraph(
file_path="document.docx",
after_index=2,
image_path="image.png",
width_inches=4.0,
alignment="CENTER"
)📊 Insert Table at Specific Position
# Insert a 3x3 table after paragraph 5
insert_table_after_paragraph(
file_path="document.docx",
after_index=4,
rows=3,
cols=3,
data=[
["Name", "Age", "City"],
["John", "25", "Beijing"],
["Jane", "30", "Shanghai"]
],
header_bold=True
)✏️ Modify Table Cell
# Modify cell (1, 2) of the first table
update_table_cell(
file_path="document.docx",
table_index=0,
row=1,
col=2,
new_text="New Content",
font_name="Microsoft YaHei",
font_size=12,
is_bold=True
)📁 Project Structure
mcp_word_edit/
├── 📄 server.py # MCP server main file
├── 📋 requirements.txt # Python dependencies
├── 🐳 Dockerfile # Docker image configuration
├── 🐳 docker-compose.yml # Docker Compose configuration
├── 🚫 .dockerignore # Docker build ignore file
├── 📖 README.md # Documentation
└── 📂 documents/ # Documents directory (Docker mount point)🐳 Docker Information
💾 Data Persistence
When using Docker, mount a local directory to /documents in the container:
docker run -it --rm -v /path/to/your/docs:/documents mcp-word-commander:latest📦 Image Details
Item | Details |
Base Image |
|
Estimated Size | ~200MB |
Working Directory |
|
⚡ Technical Features
Feature | Description |
🖼️ Direct Image Display | Uses MCP's |
🔤 Chinese Font Support | Full support for Chinese font settings (SimSun, SimHei, etc.) |
📍 Flexible Position Insertion | Support inserting images and tables after any paragraph |
📊 Complete Table Operations | Support CRUD operations for tables and their content |
🐳 Docker Support | Complete containerized deployment solution |
🤝 Contributing
Issues and PRs are welcome!
Before submitting, please ensure:
✅ Code style consistency
✅ Necessary documentation included
✅ Related tests passed
📜 License
This project is licensed under the MIT License. See LICENSE for details.
Made with ❤️ for the MCP community
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityFmaintenanceWord document reading and writing MCP implemented in Node.jsLast updated724011MIT
- -licenseBquality-maintenanceEnables AI assistants to create, read, and manipulate Microsoft Word documents with comprehensive formatting, table creation, content management, and document protection capabilities. Supports advanced operations like merging documents, PDF conversion, and rich text formatting through a standardized interface.Last updated32
- AlicenseBqualityDmaintenanceEnables AI assistants to create and manipulate Microsoft Word documents programmatically with support for rich text formatting, tables, lists, headings, and find-and-replace operations.Last updated1046MIT
- Alicense-qualityCmaintenanceEnables AI assistants to edit Microsoft Word documents live while they are open, with full support for tracked changes, comments, formatting, and 124 tools.Last updated174MIT
Related MCP Connectors
AI document editing for agents: draft, edit, export .docx/PDF. 37 MCP tools; agent self-signup.
Persistent docs and memory for AI agents — read, write, organize & search a shared workspace.
Use your own Word templates to convert Markdown → DOCX/PDF/HTML from any MCP-compatible AI.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/chyinan/MCP-Word-Commander'
If you have feedback or need assistance with the MCP directory API, please join our Discord server