Skip to main content

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

Metadata

Release files for iflow-mcp_ceilf6_wordmcp 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iflow-mcp_ceilf6_wordmcp 1.1.2
File Size Uploaded
iflow_mcp_ceilf6_wordmcp-1.1.2.tar.gz 48.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iflow-mcp_ceilf6_wordmcp 1.1.2
File Interpreter ABI Platform
iflow_mcp_ceilf6_wordmcp-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 97.1 kB

Release files / iflow_mcp_ceilf6_wordmcp-1.1.2.tar.gz

Download URL iflow_mcp_ceilf6_wordmcp-1.1.2.tar.gz
Size 48.1 kB
Tags Source
SHA-256 checksum
How to use checksums
20e27269ce3f5883135e994fe06e82817a023184e7e9d88419258ef12c01a5fe
BLAKE2b-256 checksum
How to use checksums
e68d86389dc562d61c91697e25d2e0f746475e97eb111609ff749cfa72846431
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / iflow_mcp_ceilf6_wordmcp-1.1.2-py3-none-any.whl

Download URL iflow_mcp_ceilf6_wordmcp-1.1.2-py3-none-any.whl
Size 48.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8d8d9ee38dde7d2b18efe989000b756b8e98812139d51b2f1072360a2da6657
BLAKE2b-256 checksum
How to use checksums
30b7919133f0d5c665df73edf88eb7aa50b4df4b4d94856929a47e9ab912a50d
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

1 release file

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page