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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.6.tar.gz
Algorithm Hash digest
SHA256 fb98787ac46d5a3df5ad507615b756ab525cabd7f1f43e2edac3ead74cce1b04
MD5 6141bfbbec773f47ce1ee473cd8b5005
BLAKE2b-256 c4011afaf8999dbd2ff9ee49eb93b432566b00e5953be68684207ba38638683f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for office_word_mcp_uvx_server-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b1acdf0fc4831e08b51d8c526e2da30d141a94f1ef1d39442b492245c1ccd3d3
MD5 684ddfe0c1ba972647c47fccfd399933
BLAKE2b-256 397026a6604bfdff90530ad872e50e88f1af2a993480c10b3cf2d3ae0600e717

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