Doc Extract MCP logo

Doc Extract MCP

Reads and chunks local documents, validates extracted JSON, and saves JSON or CSV within a confined root.

Install Doc Extract MCP

Run the project’s own setup commands, in order.

Setup steps from the project

doc-extract-mcp installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    git clone https://github.com/koraynar/doc-extract-mcp.git
    
  2. 2. Run
    cd doc-extract-mcp
    
  3. 3. Configure
    uv venv
    
  4. 4. Install
    uv pip install -e .
    
  5. 5. Start the server
    DOC_EXTRACT_ROOT=/path/to/your/documents uv run doc-extract-mcp
    
  6. 6. Add to Claude Code
    claude mcp add doc-extract --env DOC_EXTRACT_ROOT=/path/to/your/documents \
      -- uv run --directory /absolute/path/to/doc-extract-mcp doc-extract-mcp
    

Overview

The doc-extract-mcp MCP server gives AI agents controlled access to local PDFs and text-based files for document extraction workflows. It lists files, reads or chunks content, reports metadata, validates JSON against Draft 2020-12 schemas, and saves structured JSON or CSV output. File access is confined to DOC_EXTRACT_ROOT, with traversal checks on reads, listings, and writes. Reach for it when an agent needs deterministic document handling around its own extraction reasoning, especially for text-based PDFs and structured outputs.

Use cases

  • Extract fields from text-based invoices and purchase orders
  • Chunk long PDF reports for agent processing
  • Validate extracted JSON against a Draft 2020-12 schema
  • Save structured extraction results as JSON or CSV
  • Inspect local document metadata before reading content

Key features

  • Root-confined file access with traversal protection
  • PDF reading with page markers and page selection
  • Deterministic overlapping document chunking
  • Draft 2020-12 JSON Schema validation
  • JSON and CSV structured output
  • Recursive document listing with glob support

Tools6

What Doc Extract MCP lets your agent do. Expand a tool for its parameters.

Self-reported~236 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

12/12 checks healthy over the last 79d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

Last commit3mo agoMost recent push to the default branch.
Tools exposed6Callable tools this server registers over MCP.

How Doc Extract MCP works

What doc-extract-mcp does

The doc-extract-mcp MCP server provides file and document utilities for agents that extract structured data from local documents. It works within one configured root directory and supports PDF, plain text, Markdown, JSON, and CSV files. The server handles reading, metadata inspection, deterministic chunking, schema validation, and guarded output; the language model remains responsible for interpreting content and deciding which fields to extract.

PDF text is returned with page markers, while text files and JSON are read directly. CSV files are presented as aligned text. Output can be written as JSON or as CSV when the input data is a flat array of objects.

How it works

Set the document root with DOC_EXTRACT_ROOT; if unset, the working directory is used. Every path is resolved against that root, and traversal attempts are rejected. File listings also reject absolute patterns and patterns containing ..; matches that escape through mechanisms such as symlinks are excluded.

A typical workflow starts by finding candidate files with list_documents, checking metadata with document_info, and then reading selected pages or chunks. The model can form an extraction result, pass it to validate_json with a Draft 2020-12 schema, correct all reported errors, and save the result with save_structured. Validation returns every error with its JSON Pointer path rather than stopping at the first issue.

The doc-extract-mcp MCP server runs over stdio and can be launched with uv run doc-extract-mcp after installation. It is configured for Claude Code, Claude Desktop, and other MCP clients that support the stdio transport.

Setup and configuration

The project requires Python 3.11 or newer and uv. Installation uses an editable package install:

bash
uv venv
uv pip install -e .

Run it with a document directory such as:

bash
DOC_EXTRACT_ROOT=/path/to/documents uv run doc-extract-mcp

Claude Code can register the command with the root supplied as an environment variable. Claude Desktop uses the same command through its claude_desktop_config.json MCP server configuration. Keep the root limited to the files the agent should be able to read or write.

Tools and capabilities

  • list_documents searches a root-relative directory and supports recursive glob patterns such as **/*.pdf. Results include file size and modification time.
  • read_document reads supported formats, applies optional one-based PDF page selections, and adds page markers to PDF text.
  • document_info returns type, size, modification time, and format-specific metadata such as PDF page count or text line count.
  • chunk_document creates ordered, overlapping chunks with indexes, offsets, and PDF page hints.
  • validate_json checks a JSON string against a Draft 2020-12 schema and reports all validation failures.
  • save_structured writes JSON or flat-object CSV inside the root and reports the output path, row count, and byte count.

Limitations and notes

The doc-extract-mcp MCP server does not perform extraction reasoning or OCR. Scanned and image-only PDFs may produce empty text, and complex PDF layouts can have imperfect reading order. DOCX and XLSX files are not supported.

The project is described as new and not yet hardened beyond its tests and path-confinement protections. Review the implementation before using it with sensitive directories. The test suite covers the six tools, path and glob confinement, page-range errors, schema validation, CSV round trips, and MCP error propagation.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Doc Extract MCP

doc-extract-mcp is an MCP server that connects AI agents to a confined local document directory. Its main tools list, read, inspect, and chunk PDFs and text files, validate JSON against Draft 2020-12 schemas, and save structured results as JSON or CSV. It runs over stdio for Claude Code, Claude Desktop, and other MCP clients.

Install it with Python 3.11 or newer and uv by creating a virtual environment, then running `uv pip install -e .` from the cloned repository. Start it with `DOC_EXTRACT_ROOT=/path/to/documents uv run doc-extract-mcp`.

The README specifically documents Claude Code and Claude Desktop, and states that the server works with other MCP clients. It uses stdio transport, so configure it in a compatible client using the command and `DOC_EXTRACT_ROOT` environment variable.

No. It uses pypdf for PDF text extraction and does not include OCR, so scanned or image-only PDFs may return empty text. Complex layouts such as multi-column documents and heavy tables may also have imperfect reading order.

It accepts a JSON string and a Draft 2020-12 JSON Schema, then returns every validation error with its JSON Pointer path. An agent can use those paths to correct multiple schema problems before saving the result.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewDoc Extract MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/doc-extract-mcp?style=directory)](https://allmcps.com/mcp/doc-extract-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/doc-extract-mcp"><img src="https://allmcps.com/api/badge/doc-extract-mcp?style=directory" alt="Doc Extract MCP on AllMCPs" /></a>