Skip to main content
Glama
Document Reader MCP Server

Document Reader MCP Server

by abdo544445

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.

npm license: MIT


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.


Related MCP server: MokuPDF

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

npx -y pdf-ppt-mcp

Or install globally

npm install -g pdf-ppt-mcp
mcp-document-server

Or clone and run locally

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

{
  "mcpServers": {
    "document-reader": {
      "command": "npx",
      "args": ["-y", "pdf-ppt-mcp"]
    }
  }
}

Cursor

Open Settings -> MCP and add:

{
  "mcpServers": {
    "document-reader": {
      "command": "npx",
      "args": ["-y", "pdf-ppt-mcp"]
    }
  }
}

Antigravity / Claude Desktop

In your claude_desktop_config.json:

{
  "mcpServers": {
    "document-reader": {
      "command": "npx",
      "args": ["-y", "pdf-ppt-mcp"]
    }
  }
}

Local path (if you cloned the repo)

{
  "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:

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


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.

[ 🤖 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

MCP server/client protocol

pdf-parse

PDF text extraction (v2, page-by-page)

mammoth

Word .docx text extraction

xlsx

Excel .xlsx/.xls reading

officeparser

PowerPoint .pptx/.ppt slide extraction


Development

# 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

  • Published to npm — install with npx -y pdf-ppt-mcp

  • VS Code Extension wrapper for GUI-based document selection

  • Support for .csv files (direct reading)

  • Support for password-protected PDFs

  • OCR for scanned/image-based PDFs


Contributing

Pull requests are welcome. For major changes, please open an issue first.


License

MIT (c) abdo544445

Available Tools

6 tools
get_document_infoA

Get metadata about a document: total pages (PDF), chunks (Word/PPT), or sheet names (Excel). ALWAYS call this first before reading to understand the document size.

Inputs: filePath (required), password.

list_directoryB

List all supported document files (.pdf, .docx, .xlsx, .xls, .pptx, .ppt, .csv) in a directory. Useful for discovering which files are available to read.

Inputs: directoryPath (required).

ocr_pdfA

OCR (Optical Character Recognition) for scanned or image-based PDF files. Use this ONLY when read_document_page returns empty or garbled text, which indicates the PDF contains scanned images instead of selectable text. WARNING: OCR is slow (3-10 seconds per page). Prefer read_document_page first.

Inputs: filePath (required), pageNumber.

read_document_pageA

Read a specific page, chunk, or sheet from a document. For PDF: provide the page number (e.g. '1'). For Word/PPT/CSV: provide the chunk number (e.g. '1'). For Excel: provide the exact sheet name (e.g. 'Sheet1'). Use get_document_info first to know valid ranges.

Inputs: filePath (required), pageOrSheet (required), password.

read_full_documentA

Read the ENTIRE content of a document at once. WARNING: Only use this for small documents (< 5 pages/chunks). For large documents, prefer read_document_page or search_document to preserve context.

Inputs: filePath (required), password, maxChunks.

search_documentA

Search for a query string across an entire document. Returns the matched pages/chunks with surrounding context snippets. Much more efficient than reading the whole document page by page.

Inputs: query (required), filePath (required), password.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 6 tools

    Disambiguation5/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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.

    Maintenance

    ActivityNo data
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI applications to read and process PDF files with intelligent file search, text extraction, image processing, and optional OCR support for scanned documents.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to parse and search documents including PDF, Word, Excel, PowerPoint, and images via OCR, with support for semantic search and batch processing.
      2
      MIT