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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: iflow_mcp_ceilf6_wordmcp-1.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9cb74dd61b66f2602f44e2d9fe98898606fda08f698c97fa61dd32eef10ec4f5
MD5 df087800cb0f7b33d5a32bc6fcf3d671
BLAKE2b-256 3986b5f5c808dcc6486e5065c82828f3f7a4b747b86926eeaa17825d142c73ab

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