Skip to main content
Glama

機能特性

  • 読み書き一体:ドキュメントの読み取りだけでなく、構造化されたパラメータに基づいてWord / PowerPointファイルの生成も可能

  • 幅広いフォーマット対応:TXT、CSV、Markdown、DOC、DOCX、PDF、PPT、PPTX、EPUB、XLSX、XLSをサポート

  • 構造化されたライティング:段落、テーブル、タイトルページ、箇条書きページ、プレゼンテーションテーブルの生成をサポート

  • 旧フォーマットへのエクスポート:LibreOfficeをインストールすることで、.doc および .ppt へのエクスポートが可能

  • MCPプロトコル:MCP標準に準拠しており、AIアシスタント(Trae IDEなど)のツールとして使用可能

  • 統合の容易さ:簡単な設定ですぐに使用可能

  • 信頼性の高いパフォーマンス:読み取り、生成、変換のフォールバック、ツールインターフェースを網羅する自動テスト

  • ファイルシステムサポート:ファイルシステムから直接ドキュメントの読み書きが可能


Related MCP server: MCP Documents

📚 ドキュメントセンター

ユーザーガイド · APIリファレンス · 貢献ガイド · 更新履歴 · ライセンス


アーキテクチャ

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

対応フォーマット

機能

フォーマット

拡張子

説明

読み取り

テキスト

.txt

マルチエンコーディングのテキスト抽出をサポート

読み取り

CSV

.csv

タブ区切りテキストとして正規化

読み取り

Markdown

.md, .markdown

Markdownテキストを直接抽出

読み取り

Word

.doc, .docx

.doc はコマンド / LibreOffice経由でフォールバック読み取り

読み取り

PDF

.pdf

テキスト抽出

読み取り

PowerPoint

.ppt, .pptx

.pptx はネイティブ解析、.ppt はフォールバック読み取り

読み取り

EPUB

.epub

spine順に基づいて章を抽出

読み取り

Excel

.xlsx, .xls

ワークシートとセル内容を抽出

生成

Word

.docx

ネイティブ生成、段落とテーブルをサポート

生成

Word

.doc

docx -> doc のLibreOffice変換経由で生成

生成

PowerPoint

.pptx

ネイティブ生成、タイトル、本文、箇条書き、テーブルをサポート

生成

PowerPoint

.ppt

pptx -> ppt のLibreOffice変換経由で生成

インストール

pipを使用 (推奨)

pip install mcp-documents-reader

PowerPoint生成機能が必要な場合は、実行環境で python-pptx が利用可能であることを確認してください。

旧フォーマット .doc または .ppt へのエクスポートが必要な場合は、LibreOfficeをインストールし、soffice または libreoffice が PATH に追加されていることを確認してください。

ソースからインストール

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

MCPツール

本サーバーは以下のツールを提供します:

read_document

統一されたインターフェースを使用して、サポートされているあらゆるドキュメントタイプを読み取ります。

パラメータ:

  • filename (string, 必須): ドキュメントファイルのパス。絶対パスまたは相対パスをサポート。

extract_document_images

DOCXファイル内の埋め込み画像を抽出し、構造化されたJSONメタデータを返します。

パラメータ:

  • filename (string, 必須): DOCXファイルのパス。

  • output_dir (string, オプション): 画像をエクスポートするディレクトリ。

write_word_document

.docx Wordドキュメントを生成するか、LibreOffice変換を通じて .doc をエクスポートします。

パラメータ:

  • filename (string, 必須): 出力パス。拡張子は .docx または .doc である必要があります。

  • title (string, オプション): ドキュメントタイトル。

  • paragraphs (string配列, オプション): 順次書き込まれる段落。

  • tables (object配列, オプション): テーブル定義。title、headers、rows をサポート。

write_presentation

.pptx プレゼンテーションを生成するか、LibreOffice変換を通じて .ppt をエクスポートします。

パラメータ:

  • filename (string, 必須): 出力パス。拡張子は .pptx または .ppt である必要があります。

  • title (string, オプション): タイトルページのタイトル。

  • subtitle (string, オプション): タイトルページのサブタイトル。

  • slides (object配列, オプション): スライド定義。title、paragraphs、bullets、table をサポート。

設定

Trae IDE / Claude Desktop での使用

MCP設定ファイルに以下を追加してください:

オプション 1:PyPIを使用 (推奨)

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

オプション 2:GitHubリポジトリを使用

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

オプション 3:Giteeリポジトリを使用 (中国国内からのアクセスが高速)

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

使用方法

MCPツールとして使用

設定完了後、AIアシスタントは以下のツールを直接呼び出すことができます:

# 读取 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"],
        }
    ],
)

Pythonライブラリとして使用

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")

ツールインターフェース詳細

read_document

サポートされているあらゆるドキュメントタイプを読み取ります。

パラメータ

型

必須

説明

filename

string

✅

ドキュメントファイルのパス。絶対パスまたは相対パスをサポート

extract_document_images

DOCXファイル内の埋め込み画像を抽出します。

パラメータ

型

必須

説明

filename

string

✅

DOCXファイルのパス

output_dir

string

❌

オプションの画像エクスポートディレクトリ

write_word_document

DOCXを直接生成するか、LibreOffice変換を通じてDOCをエクスポートします。

パラメータ

型

必須

説明

filename

string

✅

出力パス。拡張子は .docx または .doc である必要があります

title

string

❌

オプションのドキュメントタイトル

paragraphs

string[]

❌

順次書き込まれる段落

tables

object[]

❌

テーブル定義。title、headers、rows をサポート

write_presentation

PPTXを直接生成するか、LibreOffice変換を通じてPPTをエクスポートします。

パラメータ

型

必須

説明

filename

string

✅

出力パス。拡張子は .pptx または .ppt である必要があります

title

string

❌

タイトルページのタイトル

subtitle

string

❌

タイトルページのサブタイトル

slides

object[]

❌

スライド定義。title、paragraphs、bullets、table をサポート

依存関係

コア依存関係

  • mcp >= 1.26.0 - MCPプロトコル実装

  • python-docx >= 1.2.0 - DOCX読み取りおよびWordドキュメント生成

  • python-pptx >= 0.6.23 - PowerPointドキュメント生成

  • pypdf >= 6.8.0 - PDFファイル読み取り (PyPDF2の代替)

  • openpyxl >= 3.1.5 - Excelファイル読み取り

オプションのランタイム依存関係

  • LibreOffice - 旧フォーマット .doc または .ppt をエクスポートする場合に必須

  • antiword / catppt - 旧フォーマット .doc / .ppt 読み取り時のオプション補助コマンド

開発依存関係

  • pytest >= 8.0.0 - テストフレームワーク

  • pytest-asyncio >= 0.24.0 - 非同期テストサポート

  • pytest-cov >= 6.0.0 - カバレッジレポート

  • basedpyright >= 0.28.0 - 型チェック

  • ruff >= 0.8.0 - コードチェックおよびフォーマット

ライセンス

本プロジェクトはMITライセンスの下でオープンソース化されています。

本プロジェクトは、優れたオープンソースプロジェクト xt765/mcp_documents_reader をベースに二次開発を行い、さらに機能を強化したものです。

現在、主に以下の機能を追加・強化しています:

  • ドキュメント内の画像抽出機能

  • WordおよびPowerPointドキュメントのライティング・生成ワークフロー

  • MCPシナリオに向けた、より完全なドキュメント作成サポート

元のリポジトリの作者が提供した基礎的な機能とオープンソースの取り組みに深く感謝いたします。

貢献

IssueやPull Requestの提出を歓迎します!

関連プロジェクト

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
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers