Skip to main content

模型上下文协议(MCP)服务器,允许您在无需安装Microsoft Word 的情况下操作 Word 文件。使用您的AI代理创建、阅读和修改 Word 工作簿。

Project description

项目说明

技术参数

  • python 3.11
  • 框架使用 FastMCP
  • 操作文件必须使用绝对路径,保证文件操作的准确性。

目录说明

  • test/ 测试目录 python 用 unittest 写单元测试,文件格式 test_<测试功能>.py
    • 测试用 docx 文件:test/office_files/模版/QN-QR-24-01-003 进料检验单(结构件).docx
  • src/ 源代码目录
    • 下面的文件是一个功能对应一个 py 文件
  • demo/ 示例代码目录
  • pyproject.toml 项目配置文件
  • VERSION 版本号文件
  • build_and_publish_uv.sh 打包命令

功能

  • get_paragraph_text_from_document: 【已实现】从 Word 文档的特定段落获取文本。

  • find_text_in_document: 【已实现】在 Word 文档中查找特定文本的出现。

  • get_document_xml: 获取 Word 文档的原始 XML 结构。

  • search_and_replace: 【已实现】搜索文本并替换所有出现的地方。

  • create_document: 【已实现】创建一个带有可选元数据的新 Word 文档。

  • get_document_info: 【已实现】获取有关 Word 文档的信息。

  • get_document_text: 【已实现】从 Word 文档中提取所有文本。

  • get_document_outline: 【已实现】获取 Word 文档的结构。

  • insert_header_near_text: 【已实现】在包含目标文本的第一个段落之前或之后插入页眉(使用指定样式)。

  • insert_line_or_paragraph_near_text: 【已实现】在包含的第一个段落之前或之后插入一个新行或段落(使用指定或匹配的样式)。

  • add_paragraph: 【已实现】向 Word 文档中添加一个段落。

  • add_heading: 【已实现】向 Word 文档中添加一个标题。

  • add_picture: 【已实现】向 Word 文档中添加一张图片。

  • add_table: 【已实现】向 Word 文档中添加一个表格。

  • add_page_break: 【已实现】向文档中添加一个分页符。

  • delete_paragraph: 【已实现】从文档中删除一个段落。

  • create_custom_style: 【已实现】在文档中创建一个自定义样式。

  • format_text: 【已实现】在段落内格式化特定范围的文本。

  • format_table: 【已实现】使用边框、底纹和结构格式化表格。

  • protect_document: 【已实现】为 Word 文档添加密码保护(无 msoffcrypto 实现,和 office 加密有所区别)。

  • unprotect_document: 【已实现】从 Word 文档中删除密码保护。

  • add_footnote_to_document: 【已实现】向 Word 文档的特定段落添加脚注。

  • add_endnote_to_document: 【已实现】向 Word 文档的特定段落添加尾注。

  • customize_footnote_style: 【已实现】自定义脚注编号和格式。

  • convert_to_pdf: 【不制作,直接用打印到pdf 功能最还原】将 Word 文档转换为 PDF 格式。

  • copy_document: 【不制作,直接用shell cp 就行了】创建一个 Word 文档的副本。

  • list_available_documents: 列出指定目录中的所有 .docx 文件。

使用方法

uvx --from office-word-mcp-uvx-server word-mcp-server --help
{
  "mcpServers": {
    "word-mcp-nexus": {
      "command": "uvx",
      "args": [
        "--from",
        "office-word-mcp-uvx-server",
        "word-mcp-server"
      ]
    }
  }
}

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

office_word_mcp_uvx_server-0.2.9.tar.gz (34.9 kB view details)

Uploaded Source

Built Distribution

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

office_word_mcp_uvx_server-0.2.9-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file office_word_mcp_uvx_server-0.2.9.tar.gz.

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.9.tar.gz
Algorithm Hash digest
SHA256 62c2bc9d544b8b16ce54de666f0950fafd09e81f7b3b652cad2b336ccf94b777
MD5 11b84de51b54d95b3cb112c317b84f4a
BLAKE2b-256 cf3b57c97bc7ad1b49212603c28edbac2a2445ebc4d1a75c71953f2d755fe3c2

See more details on using hashes here.

File details

Details for the file office_word_mcp_uvx_server-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 c58f89c1bf3432e90e631821929d13040d84e731cd8d15318dd2d97bb8535f3f
MD5 774ee236968a23a2892cba8e20b9033d
BLAKE2b-256 baef2c727cf450c2362da58253634bb0a226bc87f97e0f9ea076e29eed89c91b

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