Word document operations MCP server with multi-agent support
Project description
Word MCP Server
一个支持 stdio 和 SSE 两种传输方式的 Word 文档 MCP 服务器。
功能
- 📄 创建 Word 文档
- 📖 读取文档内容
- ✏️ 更新文档(追加/插入/替换)
- 🗑️ 删除文档
- 📋 列出所有文档
- 📊 添加表格
- 🔍 搜索替换
快速开始
1. 安装依赖
cd agent/_MCP/wordMCP
# 创建虚拟环境
python3 -m venv .venv
source .venv/bin/activate
# 安装
python -m pip install -e .
2. 运行方式
方式 A: SSE 服务器(推荐,支持前端调用)
# 使用启动脚本
./start.sh
# 或手动运行
source .venv/bin/activate
python server.py
服务器启动后访问: http://localhost:8080
方式 B: stdio 方式(MCP 客户端)
source .venv/bin/activate
python main.py
SSE API 端点
| 端点 | 方法 | 说明 |
|---|---|---|
/ |
GET | 服务器状态 |
/tools |
GET | 获取工具列表 |
/documents |
GET | 获取文档列表 |
/call |
POST | 调用工具 |
/sse |
GET | SSE 连接 |
/sse/call |
POST | SSE 方式调用工具 |
调用示例
# 获取工具列表
curl http://localhost:8080/tools
# 创建文档
curl -X POST http://localhost:8080/call \
-H "Content-Type: application/json" \
-d '{"tool": "create_document", "params": {"title": "测试", "content": "内容"}}'
# 读取文档
curl -X POST http://localhost:8080/call \
-H "Content-Type: application/json" \
-d '{"tool": "read_document", "params": {"filename": "test.docx"}}'
前端集成
前端组件位于: sandboxs/wordMCP/index.tsx
// 连接 SSE
const es = new EventSource('http://localhost:8080/sse');
// 调用工具
const res = await fetch('http://localhost:8080/sse/call', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ tool: 'list_documents', params: {} })
});
项目结构
wordMCP/
├── main.py # stdio 方式服务器
├── server.py # SSE 方式服务器
├── start.sh # 启动脚本
├── pyproject.toml # 项目配置
├── mcpconfig.json # MCP 配置
├── README.md # 本文档
└── word/ # 文档存储目录
配置
mcpconfig.json (openMCP 用)
{
"mcpServers": {
"Word Document MCP Server": {
"type": "stdio",
"command": "mcp",
"args": ["run", "main.py"],
"cwd": "/path/to/wordMCP"
}
}
}
许可证
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iflow_mcp_ceilf6_wordmcp-1.1.2.tar.gz.
File metadata
- Download URL: iflow_mcp_ceilf6_wordmcp-1.1.2.tar.gz
- Upload date:
- Size: 48.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20e27269ce3f5883135e994fe06e82817a023184e7e9d88419258ef12c01a5fe
|
|
| MD5 |
1ce4eff4e347289b623432afdcb1547f
|
|
| BLAKE2b-256 |
e68d86389dc562d61c91697e25d2e0f746475e97eb111609ff749cfa72846431
|
File details
Details for the file iflow_mcp_ceilf6_wordmcp-1.1.2-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_ceilf6_wordmcp-1.1.2-py3-none-any.whl
- Upload date:
- Size: 48.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8d8d9ee38dde7d2b18efe989000b756b8e98812139d51b2f1072360a2da6657
|
|
| MD5 |
590f5dd43d49abdbfa34c2eef3374e46
|
|
| BLAKE2b-256 |
30b7919133f0d5c665df73edf88eb7aa50b4df4b4d94856929a47e9ab912a50d
|