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 / PowerPointClaude Desktop、Claude Code、Cursorは同じMCPサーバーと同じフォルダリストに接続します。
クイックスタート
LiteLLMプロキシを実行します。
start.batをダブルクリックします。http://127.0.0.1:7860 を開きます。
設定 → LiteLLM: ベースURL(例:
http://localhost:4000)、APIキーを貼り付け、モデルを読み込むまたはモデルを追加をクリックしてから保存します。設定 → フォルダ: Windowsのフォルダパスを貼り付けます。初回実行時に
sample_docsが登録されます。それらのファイルが答えられることを何でも質問します。
マニュアル
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
python -m appRelated MCP server: file-analysis-mcp
設定
タブ | 説明 |
LiteLLM | ベースURL、キー、 |
フォルダ | MCPルート(許可リスト)。Model Councilの |
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ループから引用:
ホストがMCPの
tools/listを呼び出し、スキーマをOpenAIツールに変換します。ホストがそれらのツールを含む
chat/completionsをLiteLLMにPOSTします(tool_choice: auto)。モデルが
tool_callsを返した場合、ホストがMCPのtools/call(stdio)を実行します。ツールJSONが
role: toolとして追加され、通常の回答が返るまでループが繰り返されます。
モデルはツールを呼び出さない限りファイルを参照しません。ルートは許可リストに登録されています。OfficeファイルはCOMを優先するため、Windowsでロック解除されたファイルやIRMファイルも読み取れます。
MCPツール
ツール | 目的 |
| ヘルス、エンジン、フォルダ数 |
| 登録されたルート |
| ルートの変更 |
| 一覧 |
| 名前+抽出テキスト |
| 抽出(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/.docxExcel.Application→.xls/.xlsx/.xlsmPowerPoint.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)This server cannot be deployed
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Securely search and manage workspace context files for AI agents and teams.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables natural language interaction with local .docx files, allowing users to find, read, search, and summarize Word documents using friendly names and location hints.53-
- FlicenseAqualityCmaintenanceEnables 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-
- FlicenseAqualityCmaintenanceEnables local Windows file management with allowlisted folder access and integration with Outlook Classic or Microsoft 365 email for AI assistants like Claude Desktop.38-
- AlicenseNot gradedqualityBmaintenanceEnables 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.1MIT