Skip to main content
Glama

Features

  • Read & Write Integration: Capable of both reading documents and generating Word / PowerPoint files based on structured parameters.

  • Wide Format Support: Supports TXT, CSV, Markdown, DOC, DOCX, PDF, PPT, PPTX, EPUB, XLSX, XLS.

  • Structured Writing: Supports generation of paragraphs, tables, title pages, bullet point pages, and presentation tables.

  • Legacy Format Export: Can export .doc and .ppt when LibreOffice is installed.

  • MCP Protocol: Compliant with MCP standards, usable as a tool for AI assistants (e.g., Trae IDE).

  • Easy Integration: Ready to use with simple configuration.

  • Reliable Performance: Automated testing covers reading, generation, conversion fallbacks, and tool interfaces.

  • File System Support: Read and write documents directly from the file system.


Related MCP server: MCP Documents

📚 Documentation Center

User Guide · API Reference · Contribution Guide · Changelog · License


Architecture

graph TB
    A[AI Assistant / User<br/>AI 助手 / 用户] -->|Call MCP tools<br/>调用 MCP 工具| B[MCP Document Reader<br/>MCP 文档读取器]
    B -->|Read<br/>读取| C[Document Readers<br/>文档读取器]
    B -->|Generate<br/>生成| D[Document Writers<br/>文档生成器]
    C -->|TXT / CSV / MD| E[Text-based Readers<br/>文本类读取器]
    C -->|DOC / DOCX| F[Word Readers<br/>Word 读取器]
    C -->|PPT / PPTX| G[Presentation Readers<br/>演示读取器]
    C -->|PDF / EPUB / Excel| H[Structured Readers<br/>结构化读取器]
    D -->|write_word_document| I[DOCX Builder<br/>DOCX 生成器]
    D -->|write_presentation| J[PPTX Builder<br/>PPTX 生成器]
    I -->|Optional conversion<br/>可选转换| K[LibreOffice -> DOC]
    J -->|Optional conversion<br/>可选转换| L[LibreOffice -> PPT]
    E --> M[Return text / metadata<br/>返回文本 / 元数据]
    F --> M
    G --> M
    H --> M
    K --> M
    L --> M
    M --> A
    
    style A fill:#e1f5ff
    style B fill:#fff4e1
    style C fill:#f0f0f0
    style D fill:#e8f5e9
    style E fill:#e8f5e9
    style F fill:#e8f5e9
    style G fill:#e8f5e9
    style H fill:#fff9c4

Supported Formats

Capability

Format

Extension

Description

Read

Text

.txt

Supports multi-encoding text extraction

Read

CSV

.csv

Normalized to tab-separated text

Read

Markdown

.md, .markdown

Direct Markdown text extraction

Read

Word

.doc, .docx

.doc read via command / LibreOffice fallback

Read

PDF

.pdf

Text extraction

Read

PowerPoint

.ppt, .pptx

.pptx native parsing, .ppt fallback read

Read

EPUB

.epub

Chapter extraction based on spine order

Read

Excel

.xlsx, .xls

Extract worksheet and cell content

Generate

Word

.docx

Native generation, supports paragraphs and tables

Generate

Word

.doc

Generated via docx -> doc LibreOffice conversion

Generate

PowerPoint

.pptx

Native generation, supports titles, body, bullets, tables

Generate

PowerPoint

.ppt

Generated via pptx -> ppt LibreOffice conversion

Installation

pip install mcp-documents-reader

If you need PowerPoint generation functionality, ensure python-pptx is available in your environment.

If you need to export legacy formats like .doc or .ppt, please install LibreOffice and ensure soffice or libreoffice is added to your PATH.

Install from Source

git clone https://github.com/xt765/mcp_documents_reader.git
cd mcp_documents_reader
pip install -e .

MCP Tools

This server provides the following tools:

read_document

Read any supported document type using a unified interface.

Parameters:

  • filename (string, required): Document file path, supports absolute or relative paths.

extract_document_images

Extract embedded images from DOCX files and return structured JSON metadata.

Parameters:

  • filename (string, required): DOCX file path.

  • output_dir (string, optional): Directory to export images.

write_word_document

Generate .docx Word documents, or export .doc via LibreOffice conversion.

Parameters:

  • filename (string, required): Output path, suffix must be .docx or .doc.

  • title (string, optional): Document title.

  • paragraphs (array of strings, optional): Paragraphs to write in order.

  • tables (array of objects, optional): Table definitions, supports title, headers, rows.

write_presentation

Generate .pptx presentations, or export .ppt via LibreOffice conversion.

Parameters:

  • filename (string, required): Output path, suffix must be .pptx or .ppt.

  • title (string, optional): Title page title.

  • subtitle (string, optional): Title page subtitle.

  • slides (array of objects, optional): Slide definitions, supports title, paragraphs, bullets, table.

Configuration

Using in Trae IDE / Claude Desktop

Add the following to your MCP configuration file:

Option 1: Using PyPI (Recommended)

{
  "mcpServers": {
    "mcp-document-reader": {
      "command": "uvx",
      "args": [
        "mcp-documents-reader"
      ]
    }
  }
}

Option 2: Using GitHub Repository

{
  "mcpServers": {
    "mcp-document-reader": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/xt765/mcp_documents_reader",
        "mcp_documents_reader"
      ]
    }
  }
}

Option 3: Using Gitee Repository (Faster for domestic access)

{
  "mcpServers": {
    "mcp-document-reader": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://gitee.com/xt765/mcp_documents_reader",
        "mcp_documents_reader"
      ]
    }
  }
}

Usage

As an MCP Tool

Once configured, the AI assistant can directly call the following tools:

# 读取 DOCX 文件
read_document(filename="example.docx")

# 读取演示文稿
read_document(filename="example.pptx")

# 生成 DOCX 报告
write_word_document(
    filename="report.docx",
    title="周报",
    paragraphs=["本周总结", "下周计划"],
    tables=[
        {
            "title": "指标表",
            "headers": ["名称", "数值"],
            "rows": [["线索", 42], ["成交", 8]],
        }
    ],
)

# 生成 PPTX 汇报
write_presentation(
    filename="briefing.pptx",
    title="季度汇报",
    subtitle="Q2",
    slides=[
        {
            "title": "亮点",
            "paragraphs": ["概述段落"],
            "bullets": ["重点 A", "重点 B"],
        }
    ],
)

As a Python Library

from mcp_documents_reader import DocumentReaderFactory

# 使用工厂类(推荐)
reader = DocumentReaderFactory.get_reader("document.pdf")
content = reader.read("/path/to/document.pdf")

# 检查格式是否支持
if DocumentReaderFactory.is_supported("file.xlsx"):
    reader = DocumentReaderFactory.get_reader("file.xlsx")
    content = reader.read("/path/to/file.xlsx")

Tool Interface Details

read_document

Read any supported document type.

Parameter

Type

Required

Description

filename

string

✅

Document file path, supports absolute or relative paths

Available Tools

4 tools
extract_document_imagesB

Extracts embedded images from a DOCX file and returns structured JSON metadata.

:param filename: Path to the DOCX document :param output_dir: Optional directory to save extracted images :return: JSON payload containing extracted image metadata and saved file paths

Inputs: filename (required), output_dir. Returns: result

read_documentB

Reads and extracts text from a specified document file. Supports TXT, CSV, Markdown, DOC, DOCX, PDF, PPT, PPTX, EPUB, and Excel (XLSX, XLS) files.

:param filename: Path to the document file to read (supports absolute or relative paths) :return: Extracted text from the document

Inputs: filename (required). Returns: result

write_presentationC

Generates a PowerPoint presentation in PPTX format, or PPT via LibreOffice conversion.

:param filename: Target output path ending with .pptx or .ppt :param title: Optional title slide title :param subtitle: Optional title slide subtitle :param slides: Optional slide definitions containing title, paragraphs, bullets, and table :return: JSON payload describing the generated file path and format

Inputs: filename (required), title, subtitle, slides. Returns: result

write_word_documentB

Generates a Word document in DOCX format, or DOC via LibreOffice conversion.

:param filename: Target output path ending with .docx or .doc :param title: Optional document title :param paragraphs: Optional paragraph list written in order :param tables: Optional table definitions using title, headers, and rows :return: JSON payload describing the generated file path and format

Inputs: filename (required), title, paragraphs, tables. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: extract_document_images extracts images from DOCX, read_document reads text from various file types, write_presentation creates PowerPoint files, and write_word_document creates Word documents. There is no overlap in functionality, making tool selection straightforward for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (e.g., extract_document_images, read_document, write_presentation, write_word_document). The naming is uniform and predictable, with no deviations or mixed conventions.

    Tool Count4/5

    With 4 tools, the count is reasonable for a document reader server, covering reading, extraction, and writing for common document types. It is slightly lean but well-scoped, as each tool serves a distinct and useful function without redundancy.

    Completeness3/5

    The tool set covers reading and writing for key document formats (Word, PowerPoint, PDF, etc.) and image extraction, but there are notable gaps. For example, it lacks tools for updating or editing existing documents, converting between formats, or handling other common operations like document merging or metadata manipulation, which could limit agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers