Skip to main content

LuLab Convert MCP Server - A document conversion server supporting DOCX to multiple formats

Project description

LuLab Convert MCP Server

一个用于在 MCP 环境中进行 Word 文档转换的服务器,支持将 DOCX 转换为多种格式。

🚀 现已支持所有兼容MCP协议的AI客户端!

支持的AI客户端包括但不限于:

  • Claude Desktop
  • Cline (VS Code扩展)
  • 其他支持MCP协议的AI工具

快速开始

使用方法:本地使用

  1. 克隆或下载此项目
  2. 安装依赖:pip install -r requirements.txt
  3. 在您的AI客户端配置文件中添加MCP服务器配置(参考下方json配置示例)

功能特性

  • DOCX → PDF(使用 docx2pdf 或 LibreOffice)
  • DOCX → TXT(提取纯文本)
  • DOCX → HTML(使用 mammoth 进行语义化 HTML 转换)
  • DOCX → Markdown(先转 HTML,再用 markdownify 转为 Markdown)
  • DOCX → RTF(通过 LibreOffice 转换)
  • DOCX → ODT(通过 LibreOffice 转换)
  • DOCX → DOC(通过 LibreOffice 转换)
  • DOC → DOCX(通过 LibreOffice 转换)
  • TXT/ODT/RTF/DOC → PDF(通过 LibreOffice 转换)
  • HTML ↔ Markdown(markdownifymarkdown
  • HTML → PDF(通过 LibreOffice soffice --convert-to pdf
  • HTML → DOCX(通过 LibreOffice 转换)
  • Markdown → PDF(先转 HTML,再用 LibreOffice 转 PDF)
  • Markdown → DOCX(先转 HTML,再用 LibreOffice;无LibreOffice时回退为简易解析)
  • TXT → DOCX(使用 python-docx 生成文档)
  • ODT/RTF → DOCX(通过 LibreOffice 转换)

客户端配置示例:Claude Desktop

在Claude Desktop配置文件中添加:

{
  "mcpServers": {
    "office-word-mcp-server": {
      "command": "python",
      "args": [
        "-m",
        "word_document_server.main"
      ],
      "env": {
        "PYTHONPATH": "e\\mcp-sever",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

MCP 工具列表

  • convert_to_pdf(input_path, output_path=None)
  • convert_to_txt(input_path, output_path=None)
  • convert_to_html(input_path, output_path=None)
  • convert_to_markdown(input_path, output_path=None)
  • convert_to_rtf(input_path, output_path=None)
  • convert_to_odt(input_path, output_path=None)
  • convert_to_doc(input_path, output_path=None)
  • convert_doc_to_docx(input_path, output_path=None)
  • convert_html_to_markdown(input_path, output_path=None)
  • convert_markdown_to_html(input_path, output_path=None)
  • convert_html_to_pdf(input_path, output_path=None)
  • convert_markdown_to_pdf(input_path, output_path=None)
  • convert_txt_to_pdf(input_path, output_path=None)
  • convert_odt_to_pdf(input_path, output_path=None)
  • convert_rtf_to_pdf(input_path, output_path=None)
  • convert_html_to_docx(input_path, output_path=None)
  • convert_markdown_to_docx(input_path, output_path=None)
  • convert_txt_to_docx(input_path, output_path=None)
  • convert_odt_to_docx(input_path, output_path=None)
  • convert_rtf_to_docx(input_path, output_path=None)

说明:

  • input_path 为输入文件的绝对路径。(如 e\\mcp-sever\\docs\\sample.docx
  • output_path 可选;不提供时将自动生成与输入同名的目标文件(扩展名分别为 .pdf/.txt/.html/.md/.rtf/.odt/.doc/.docx)。
  • Windows/macOS/Linux:若需要 rtf/odt/dochtml/md/txt → docx/pdf 功能,请安装 LibreOffice;否则部分功能将降级或返回安装提示。

使用提示:

  • convert_to_doc(input_path) 将 DOCX 转为旧版 .doc 格式,建议仅在兼容旧系统时使用。
  • convert_doc_to_docx(input_path).doc 升级为现代 .docx,便于后续处理与版本控制。
  • convert_*_to_pdf(input_path) 系列统一通过 LibreOffice 生成 PDF,输出路径不提供时默认与输入同目录。

备注

  • 进行 PDF 转换时,若系统未安装 LibreOffice,HTML→PDFMarkdown→PDF 会提示安装需求。
  • 部分受保护/加密的文档可能需要额外处理;工具会尽力提取文本并给出错误信息。
  • 转换结果质量依赖源文档结构与样式;HTML/Markdown 转换倾向保持语义结构而非原始布局。

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

lulab_convert_mcp_server-1.1.10.tar.gz (39.7 MB view details)

Uploaded Source

Built Distribution

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

lulab_convert_mcp_server-1.1.10-py3-none-any.whl (62.9 kB view details)

Uploaded Python 3

File details

Details for the file lulab_convert_mcp_server-1.1.10.tar.gz.

File metadata

File hashes

Hashes for lulab_convert_mcp_server-1.1.10.tar.gz
Algorithm Hash digest
SHA256 5ca184d174122b35cbd5a821aa3aef6c696ad892f059338c3c7b255a74347633
MD5 c18f892e379c12159e00190d4f446a90
BLAKE2b-256 a2f67bd84c805bc9dedd0be476dfb2e9c25b11aa8b3fccbe3f84686188e6328c

See more details on using hashes here.

File details

Details for the file lulab_convert_mcp_server-1.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for lulab_convert_mcp_server-1.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 43fd7df43ebf1f51d97d8cd4a5351de5818fd015372d6d0992f796f40adcebd9
MD5 8c346014d49004f4b58af8f5bd58df73
BLAKE2b-256 3d999e87f516a7a292efb350d0687b84c76436448b638350ec660d2498b5f43a

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