Document Reader MCP Server
# Document Reader MCP Server
> An MCP (Model Context Protocol) server that lets AI assistants read PDF, Word, Excel, and PowerPoint files without blowing up the context window.
[](https://npmjs.com/package/pdf-ppt-mcp)
[](LICENSE)
---
## Why this exists
Most AI tools try to dump an entire document into the prompt at once. This server solves that with **context-efficient reading** by exposing tools that:
- Get document **metadata first** (page count, sheet names)
- Read **one page / slide / sheet at a time**
- **Search** across the entire document and return only relevant snippets
This keeps your context window clean while still giving the AI access to large documents.
---
## Supported File Types
| Format | Extension(s) | How it's read |
|--------|-------------|---------------|
| PDF | `.pdf` | Page-by-page (native PDF pagination) |
| Word | `.docx` | Paragraph-aware chunking |
| Excel | `.xlsx`, `.xls` | Sheet-by-sheet (full CSV per sheet) |
| PowerPoint | `.pptx`, `.ppt` | Slide-by-slide (true slide extraction) |
---
## Quick Start
### Run instantly with npx (recommended)
```bash
npx -y pdf-ppt-mcp
```
### Or install globally
```bash
npm install -g pdf-ppt-mcp
mcp-document-server
```
### Or clone and run locally
```bash
git clone https://github.com/abdo544445/pdf-ppt-mcp.git
cd pdf-ppt-mcp
npm install
npm run build
npm start
```
---
## Integration Guide
### VS Code (Cline / RooCode / Copilot MCP)
Add to your MCP config file (usually `~/.cline/mcp_settings.json` or `.vscode/mcp.json`):
```json
{
"mcpServers": {
"document-reader": {
"command": "npx",
"args": ["-y", "pdf-ppt-mcp"]
}
}
}
```
### Cursor
Open **Settings -> MCP** and add:
```json
{
"mcpServers": {
"document-reader": {
"command": "npx",
"args": ["-y", "pdf-ppt-mcp"]
}
}
}
```
### Antigravity / Claude Desktop
In your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"document-reader": {
"command": "npx",
"args": ["-y", "pdf-ppt-mcp"]
}
}
}
```
### Local path (if you cloned the repo)
```json
{
"mcpServers": {
"document-reader": {
"command": "node",
"args": ["/absolute/path/to/pdf-ppt-mcp/build/index.js"]
}
}
}
```
---
## Available MCP Tools
### 1. `get_document_info`
Always call this first. Returns metadata so the AI knows the document's size before trying to read it.
**Input:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `filePath` | `string` | Absolute path to the document |
**Example output:**
```
report.pdf ā PDF document
Total pages: 42
data.xlsx ā Excel workbook
Sheets (3): "Summary", "Q1 Data", "Q2 Data"
slides.pptx ā PowerPoint presentation
Total slides: 12
```
---
### 2. `read_document_page`
Read one specific page, chunk, or sheet at a time to avoid loading the whole document.
**Input:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `filePath` | `string` | Absolute path to the document |
| `pageOrSheet` | `string` | **PDF/Word/PPT**: page/chunk/slide number (e.g. `"3"`). **Excel**: sheet name (e.g. `"Sheet1"`) |
**Example calls:**
```json
// Read page 5 of a PDF
{ "filePath": "/docs/report.pdf", "pageOrSheet": "5" }
// Read slide 2 of a PPTX
{ "filePath": "/docs/deck.pptx", "pageOrSheet": "2" }
// Read the "Sales" sheet of an Excel file
{ "filePath": "/docs/data.xlsx", "pageOrSheet": "Sales" }
// Read chunk 3 of a Word document
{ "filePath": "/docs/contract.docx", "pageOrSheet": "3" }
```
---
### 3. `search_document`
Search the entire document for a keyword. Returns matching pages/slides/chunks with surrounding context snippets.
**Input:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `filePath` | `string` | Absolute path to the document |
| `query` | `string` | Search term (case-insensitive) |
**Example output:**
```
Found 2 match(es) for "revenue":
[Page 7]:
...total revenue for Q3 was $4.2M, representing a 12% increase over...
[Page 23]:
...projected revenue targets were exceeded in all regions except...
```
---
### 4. `list_directory`
List all supported document files in a folder. Useful for discovering what documents are available.
**Input:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `directoryPath` | `string` | Absolute path to the directory |
**Example output:**
```
Found 4 document(s):
annual_report.pdf (2,341.2 KB)
budget_2025.xlsx (128.5 KB)
proposal.docx (54.8 KB)
presentation.pptx (8,902.1 KB)
```
---
### 5. `read_full_document`
Read the entire document at once. Best for small documents only.
> **Warning:** Use `read_document_page` or `search_document` for large documents to avoid filling the context window.
**Input:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `filePath` | `string` | Absolute path to the document |
| `maxChunks` | `number` | Max pages/chunks to read (default: `10`, max: `50`) |
---
## Recommended Usage Pattern for AI Assistants
When an AI assistant uses this server, the recommended flow is:
```
1. list_directory("/path/to/folder") -> discover available documents
2. get_document_info("/path/to/doc.pdf") -> learn total pages
3. search_document("/path/to/doc.pdf", "key term") -> find relevant pages
4. read_document_page("/path/to/doc.pdf", "7") -> read specific page
```
This approach typically uses less than 5% of context compared to loading the whole document.
---
## VS Code Extension (PDF/PPT MCP Explorer)
This project includes an official Visual Studio Code extension that acts as a graphical wrapper. It makes it seamless to find, manage, and process supported documents visually, and automatically connects them to your AI assistants.
### Extension Features
- **Document Explorer:** Instantly find all supported documents (.pdf, .docx, .xlsx, .pptx, .csv) cleanly categorized in a new sidebar tree view.
- **Auto-Configure Assistant:** Single-click configuration to inject the MCP Server directly into Cline or RooCode JSON configurations globally across VS Code and Cursor.
- **Copy Path for AI:** Copy well-crafted prompts with absolute paths for your AI assistant in one click.
- **Ask AI about Document:** Right-click to automatically generate a customized prompt with your specific question regarding the document.
- **Open Externally:** Launch native applications (Word, Excel, Acrobat) directly from the VS Code sidebar.
- **Add External Files:** Browse your operating system and instantly copy external documents into your active workspace so the AI can read them.
- **Workspace Management:** Delete documents or reveal them in your OS file explorer directly from the extension.
- **Live Updating:** Filesystem watchers automatically keep your sidebar in sync with your actual project directory.
---
## Architecture
The server connects to your AI assistant (via MCP protocol) and routes requests to specialized parsing services under the hood.
```text
[ š¤ AI Assistant ] <āā MCP Protocol āā> [ š Document Reader Server ]
(Claude, Cursor) ā
ā (routes commands)
ā¼
[ MCP Tools ]
ā
āāāāāāāāāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāāā
ā¼ ā¼ ā¼ ā¼
[ read_page ] [ search_doc ] [ get_info ] [ read_full ]
ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāā“āāāāāāāāā¬āāāāāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
[ āļø Parsing Services ]
ā
āāāāāāāāāāāāāāāā¬āāāāāāāāāāāā“āāāā¬āāāāāāāāāāāāāāā
ā¼ ā¼ ā¼ ā¼
PDFService WordService ExcelService PptService
(pdf-parse) (mammoth) (xlsx) (officeparser)
ā ā ā ā
āāāāāāāāāāāāāāāā“āāāāāāāā¬āāāāāāāā“āāāāāāāāāāāāāāā
ā
ā¼
[ š Local File System ]
```
### Folder Structure
```
pdf-ppt-mcp/
āāā src/
ā āāā index.ts # MCP Server - tool definitions and routing
ā āāā services/
ā āāā pdf.service.ts # PDF parsing (pdf-parse v2)
ā āāā word.service.ts # Word parsing (mammoth)
ā āāā excel.service.ts # Excel parsing (xlsx)
ā āāā ppt.service.ts # PPT parsing (officeparser)
āāā build/ # Compiled output (auto-generated)
āāā package.json
āāā tsconfig.json
āāā README.md
```
### Libraries Used
| Library | Purpose |
|---------|---------|
| [`@modelcontextprotocol/sdk`](https://npmjs.com/package/@modelcontextprotocol/sdk) | MCP server/client protocol |
| [`pdf-parse`](https://npmjs.com/package/pdf-parse) | PDF text extraction (v2, page-by-page) |
| [`mammoth`](https://npmjs.com/package/mammoth) | Word `.docx` text extraction |
| [`xlsx`](https://npmjs.com/package/xlsx) | Excel `.xlsx`/`.xls` reading |
| [`officeparser`](https://npmjs.com/package/officeparser) | PowerPoint `.pptx`/`.ppt` slide extraction |
---
## Development
```bash
# Clone the repo
git clone https://github.com/abdo544445/pdf-ppt-mcp.git
cd pdf-ppt-mcp
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start the server (stdio mode for MCP clients)
npm start
```
---
## Requirements
- **Node.js** >= 20.16.0
- An MCP-compatible client (VS Code with Cline/RooCode, Cursor, Antigravity, Claude Desktop, etc.)
---
## Roadmap
- [x] Published to npm ā install with `npx -y pdf-ppt-mcp`
- [x] VS Code Extension wrapper for GUI-based document selection
- [x] Support for `.csv` files (direct reading)
- [x] Support for password-protected PDFs
- [x] OCR for scanned/image-based PDFs
---
## Contributing
Pull requests are welcome. For major changes, please open an issue first.
---
## License
MIT (c) [abdo544445](https://github.com/abdo544445)
TDQS
Scored across 6 tools
Each tool has a clearly bounded role: discovery (list_directory), sizing (get_document_info), targeted reading (read_document_page), bulk reading (read_full_document), full-text lookup (search_document), and a fallback OCR path (ocr_pdf). The descriptions explicitly resolve the only plausible overlap by directing agents to try read_document_page before ocr_pdf, and to prefer paging over read_full_document for large files.
Five of six names follow a clean snake_case verb_noun pattern (get_document_info, read_document_page, search_document, list_directory, read_full_document). ocr_pdf is the sole deviation, reading as a tool/format label rather than a verb_noun action, but it remains unambiguous.
Six tools is a tight, well-scoped set for a read-only document reader, with no redundant entries. Each tool covers a distinct access strategy (metadata, paging, bulk read, search, OCR, discovery) and none feels like filler.
The read lifecycle is well covered end to end: find files, inspect structure, page through, full read, search, and OCR fallback for scanned content. Minor gaps exist, such as searching across an entire directory rather than a single document, but agents can work around this by iterating list_directory results.