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.7.tar.gz (33.1 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.7-py3-none-any.whl (56.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.7.tar.gz
Algorithm Hash digest
SHA256 c9395a285281859e6fa0017812ca2cad3f5e440ad6572944dc01c51061b03514
MD5 5c9d97ce38d8aea975fa5a8b0141c779
BLAKE2b-256 ae7081a1be78bf397271057aef48ac04d2086acdb66ac759ab359838d4f1dc10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c650b07c3c527d3e82579514560fbb632584ed6f45b66d5fe8c23edbc250cef4
MD5 fdc5eb71d64af873ccaeff14aa6d084a
BLAKE2b-256 594448e91af57fe39a2876f966bead5f53c8ac9a2c6a66cd6aab9ca699bda901

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