Skip to main content
Glama
MENARHQ-cloud

Document MCP

Document MCP

ChatGPTスタイルのチャットボットにDocument MCPサーバーを追加。設定でフォルダパスとローカルのLiteLLMモデルを登録します。質問はMCPツールと共にLiteLLMに送信され、サーバーは指定されたフォルダのみを読み取り、pywin32 COMを使用してWord / Excel / PowerPoint(Model Councilと同じOfficeパス)を処理します。

Chat UI  →  LiteLLM /v1/chat/completions (+ tools)
              ↑ tool_calls (search_documents, read_document, …)
MCP host     →  Document MCP (stdio JSON-RPC)
                    →  allowlisted folders
                    →  win32com Word / Excel / PowerPoint

Claude Desktop、Claude Code、Cursorは同じMCPサーバーと同じフォルダリストに接続します。

クイックスタート

  1. LiteLLMプロキシを実行します。

  2. start.batをダブルクリックします。

  3. http://127.0.0.1:7860 を開きます。

  4. 設定 → LiteLLM: ベースURL(例:http://localhost:4000)、APIキーを貼り付け、モデルを読み込むまたはモデルを追加をクリックしてから保存します。

  5. 設定 → フォルダ: Windowsのフォルダパスを貼り付けます。初回実行時にsample_docsが登録されます。

  6. それらのファイルが答えられることを何でも質問します。

マニュアル

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
python -m app

Related MCP server: file-analysis-mcp

設定

タブ

説明

LiteLLM

ベースURL、キー、/v1/modelsの読み込み、リストにないローカルモデル名の追加、接続テスト

フォルダ

MCPルート(許可リスト)。Model CouncilのOFFICE_ALLOWED_ROOTSと同じ考え方

Claude MCP

Claude Desktop / Claude Code / Cursorのスニペットをコピー、またはClaude Desktop設定を書き込み

URLはhttp://host:4000、http://host:4000/v1、.../v1/chat/completionsとして貼り付け可能です。これらはModel Councilと同様に正規化されます。

LiteLLM + MCPの動作方法

Model Councilのアプリ内MCPループから引用:

  1. ホストがMCPのtools/listを呼び出し、スキーマをOpenAIツールに変換します。

  2. ホストがそれらのツールを含むchat/completionsをLiteLLMにPOSTします(tool_choice: auto)。

  3. モデルがtool_callsを返した場合、ホストがMCPのtools/call(stdio)を実行します。

  4. ツールJSONがrole: toolとして追加され、通常の回答が返るまでループが繰り返されます。

モデルはツールを呼び出さない限りファイルを参照しません。ルートは許可リストに登録されています。OfficeファイルはCOMを優先するため、Windowsでロック解除されたファイルやIRMファイルも読み取れます。

MCPツール

ツール

目的

ping

ヘルス、エンジン、フォルダ数

list_folders

登録されたルート

add_folder / remove_folder

ルートの変更

list_documents

一覧

search_documents

名前+抽出テキスト

read_document

抽出(COM優先、ライブラリフォールバック)

プロンプト: ask_documents。

Claude Desktop / Claude Code / Cursor

チャットボット内: 設定 → Claude MCP → Claude Desktopに追加(%APPDATA%\Claude\claude_desktop_config.jsonに書き込み)。Claudeを再起動し、ping Document MCPを依頼します。

または以下の形状をコピー(パスは設定で入力されます):

{
  "mcpServers": {
    "document-mcp": {
      "command": "D:\\\\AntigravityCodes\\\\Document-MCP\\\\.venv\\\\Scripts\\\\python.exe",
      "args": ["-m", "document_mcp"],
      "cwd": "D:\\\\AntigravityCodes\\\\Document-MCP",
      "env": {
        "PYTHONUTF8": "1",
        "DOCUMENT_MCP_ROOTS": "D:\\\\AntigravityCodes\\\\Document-MCP\\\\data\\\\folders.json"
      }
    }
  }
}

Claude Code:

claude mcp add-json document-mcp "{...stdio server json from Settings...}"

Cursor: リポジトリのmcp.json、または設定 → Claude MCPでCursorスニペットをコピー。

HTTP(LiteLLM MCPゲートウェイ):

start_mcp_http.bat

次にhttp://127.0.0.1:8765/mcpを追加します。

pywin32 / Office

  • Word.Application → .doc / .docx

  • Excel.Application → .xls / .xlsx / .xlsm

  • PowerPoint.Application → .ppt / .pptx

フォールバック: python-docx / openpyxl / python-pptx。PDF: PyMuPDF。レガシーバイナリOfficeにはMicrosoft Officeが必要です。

python -m document_mcp.reader sample_docs\mena_rhq_overview.md

レイアウト

app/                 FastAPI chat host (MCP client + UI)
document_mcp/        FastMCP server, COM readers, Claude install helper
sample_docs/         Starter files
data/                folders.json, settings, extract cache (local)

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    C
    maintenance
    Enables read-only scanning and text extraction from PDF, DOCX, PPTX, SVG, and PNG files in a local folder, providing the raw text to AI models for summarization or analysis without an external LLM API.
    5
    -
  • F
    license
    A
    quality
    C
    maintenance
    Enables local Windows file management with allowlisted folder access and integration with Outlook Classic or Microsoft 365 email for AI assistants like Claude Desktop.
    38
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents on Windows to drive real Microsoft Word and WPS Office applications through COM, automating legacy .doc/.docx batch conversion, bookmark and placeholder template filling, print-fidelity PDF export, extraction from legacy binaries, editing of documents currently open on screen, and mail-merge batch generation. It hardens these operations with CJK font preservation, password and corruption pre-checks, structured self-correcting errors, path allowlisting, read-only mode, and automatic Word-to-WPS failover.
    1
    MIT