Skip to main content

word_mcp: Word 文档 MCP 服务器

Overview 概述

一个模型上下文协议服务器,用于操作和处理 Word 文档
此服务器提供了一系列工具,用于创建、编辑、转换Word文档,支持格式转换、复杂文本查询替换、文档合并,提取数据,文档对比,文档质量评估功能 word_mcp

Example 示例

word_mcp1 word_mcp2

Tools 工具

  1. create_txt_file

    • 创建一个新的 TXT 文件
  2. create_word_document

    • 创建一个新的 Word 文档
  3. read_word_document

    • 从 Word 文档中读取内容
  4. get_word_document_info

    • 查询 Word 文档的基本信息
  5. add_text_to_word_document

    • 向 Word 文档添加文本内容
  6. set_paragraph_format

    • 设置 Word 文档中指定段落的文本格式
  7. set_paragraph_spacing

    • 设置 Word 文档中指定段落的间距
  8. insert_image_into_word_document

    • 在 Word 文档中插入图片
  9. insert_table_into_word_document

    • 在 Word 文档中插入表格
  10. edit_table_cell

    • 编辑 Word 文档中表格的单元格内容
  11. save_word_as_pdf

    • 将 Word 文档保存为 PDF 格式
  12. convert_word_to_format

    • 将 Word 文档转换为指定格式文件,支持格式包括 ["docx", "pdf", "txt", "html"]
  13. convert_to_word

    • 将指定格式文件转换为 Word 文档,支持格式包括 ["docx", "pdf", "txt", "html"]
  14. close_word_document

    • 关闭 Word 文档,可选是否保存更改
  15. edit_paragraph_text

    • 编辑 Word 文档中指定段落的文本内容
  16. find_and_replace_text

    • 在 Word 文档中查找并替换文本
  17. delete_paragraph

    • 删除 Word 文档中指定的段落
  18. insert_table_of_contents

    • 在 Word 文档中插入目录
  19. add_header_and_footer

    • 为 Word 文档添加页眉和页脚
  20. set_page_layout

    • 设置 Word 文档的页面布局
  21. merge_word_documents

    • 合并多个 Word 文档
  22. complex_query_document

    • 复杂查询 Word 文档(不限于文本)
  23. complex_replace_document

    • 复杂替换 Word 文档
  24. extract_document_info 文档提取函数

    • 辅助函数:save_to_json save_to_csv
    • 段落提取:提取文档中的各个段落,转换为结构化数据格式
    • 表格提取:提取文档中的表格,转换为结构化数据格式
    • 图片提取:提取文档中的图片,转换为结构化数据格式
    • 标题提取:提取文档中的各级标题
    • 文本提取:提取文档中的文本内容
    • 关键词提取:提取文档中的关键词
  25. compare_documents 文档对比函数

    • 文档对比:比较两个或多个文档的内容差异,识别新增、删除或修改的部分
    • 一致性检查:检查多个文档之间的一致性
  26. assess_document_quality 文档质量评估函数

    • 辅助函数: calculate_readability,count_syllables
    • 可读性评估:评估文档的可读性,识别复杂的句子和段落
    • 一致性评估:评估文档中格式和内容的一致性

Installation 安装

  1. 将 MCP 服务器的代码仓库克隆到您的本地机器:

    git clone https://github.com/M87shaonv/word_mcp.git
    cd word_mcp
    
  2. 安装依赖项 使用 pip/pip3 安装所需的 Python 包:

    pip install -e 项目路径 
    pip3 install -e 项目路径
    
  3. 配置环境变量(可选) 您可以配置以下环境变量来自定义服务器行为:

    变量名 描述 默认值
    WORD_MCP_PATH 文件操作的默认目录(例如:保存文档的位置) 用户的桌面

Linux/Mac

    # 永久设置环境变量
    nano ~/.bashrc
    # 文件末尾添加以下内容
    export WORD_MCP_PATH="/path/to/output"
    # 刷新环境变量
    source ~/.bashrc

Windows

    # 设置系统级别的环境变量
    set WORD_MCP_PATH="C:\path\to\output" /M
  1. 启动服务器 使用以下命令启动 MCP 服务器测试是否正常运行:
    # 启动服务器
    python word_mcp.py
    # 如果在启动服务器时出现模块导入错误,尝试使用以下命令更新依赖项:
    uv run word_mcp.py
    # 使用mcp命令启动服务器可在浏览器中访问 测试是否正常运行
    mcp dev word_mcp.py

注意:如果使用的是虚拟环境,请确保在启动服务器之前激活虚拟环境

使用mcp server配置,直接添加到cline_mcp_setting.json文件中

 # 
    "wordmcp": {
          "command": "uv",
          "args": [
            "--directory",
            "下载的word_mcp项目路径",
            "run",
            "word_mcp.py"
          ]
        }

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_m87shaonv_word_mcp-0.1.1.tar.gz (20.9 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_m87shaonv_word_mcp-0.1.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_m87shaonv_word_mcp-0.1.1.tar.gz.

File metadata

  • Download URL: iflow_mcp_m87shaonv_word_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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_m87shaonv_word_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 77a4d873e9718a58d558d2a1d26a881044c0ee9166bd695d5f22eff19c6c4c2e
MD5 57dd5fc15ced507689f8085e7e681b66
BLAKE2b-256 fbe4f6902d6c51ac2823cff7b350193a5818dffa3b8a329d17cabf7207fb3f4a

See more details on using hashes here.

File details

Details for the file iflow_mcp_m87shaonv_word_mcp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_m87shaonv_word_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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_m87shaonv_word_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 30baa57f45a77ce48fff41c2cbf3aae961df0ab9f6190f629cc6b803f8be8922
MD5 700ca8a0974d2eef346df2c83c8866e0
BLAKE2b-256 c9ccbd403faa71adb12d87b29c3af4c93546f81bf63f7455fb76c05ae3f79e7e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Supported by

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