Skip to main content

Word document operations MCP server with multi-agent support

Project description

Word MCP Server

一个支持 stdioSSE 两种传输方式的 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_ceilf6_wordmcp-1.1.0.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_ceilf6_wordmcp-1.1.0-py3-none-any.whl (48.9 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_ceilf6_wordmcp-1.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_ceilf6_wordmcp-1.1.0.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

Hashes for iflow_mcp_ceilf6_wordmcp-1.1.0.tar.gz
Algorithm Hash digest
SHA256 11ce6116b716e3305c0431f54947cff1c719736951ceb807d06a568ac3fbaad2
MD5 17bd1b00e19e0524a80465ffc146cb23
BLAKE2b-256 3fbaa1220d79657a98e9e05809a0479478fd083f4cb91262d829fd43f08eb996

See more details on using hashes here.

File details

Details for the file iflow_mcp_ceilf6_wordmcp-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_ceilf6_wordmcp-1.1.0-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

Hashes for iflow_mcp_ceilf6_wordmcp-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b3f14beb8613cec08ebb2baddb47c10544864757445f9997f5a9be859616ef
MD5 8754012ae8f086195ca2c0244511ed59
BLAKE2b-256 7f4021aeb7c3024d088771283d1cff021025842b02bb437868974b22508017e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page