# doc-extract-mcp [Health: Active]

**Category:** 🔎 Search & Data Extraction  
**Repository:** https://github.com/koraynar/doc-extract-mcp  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/doc-extract-mcp

## Description
Document tooling for AI agents: PDF/text reading, chunking, schema-validated JSON output.

## Tools
Capabilities this server exposes over MCP:

- **list_documents** — List files under a directory inside the allowed root, with size and modified time. Supports recursive globs like `**/*.pdf`. Patterns must be relative and free of `..`; matches resolving outside the root are dropped.
- **read_document** — Return a document's text. `.pdf` via pypdf with `--- page N ---` markers and optional 1-indexed page selection (`'3'`, `'1-5'`, `'1-3,7'`); `.txt`/`.md`/`.json` read directly; `.csv` rendered as an aligned text table. Clear error for unsupported types.
- **document_info** — Metadata without full content: type, size, modified time; page count and PDF metadata for PDFs; line count for text files.
- **chunk_document** — Split a document into ordered overlapping chunks, each with an index, start offset, and (for PDFs) a page hint.
- **validate_json** — Validate a JSON string against a JSON Schema (Draft 2020-12). Returns every validation error with a JSON Pointer path via `Draft202012Validator.iter_errors`.
- **save_structured** — 'csv'

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/koraynar/doc-extract-mcp), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/koraynar/doc-extract-mcp.git
```

2. Run:

```sh
cd doc-extract-mcp
```

3. Configure:

```sh
uv venv
```

4. Install:

```sh
uv pip install -e .
```

5. Start the server:

```sh
DOC_EXTRACT_ROOT=/path/to/your/documents uv run doc-extract-mcp
```

6. Add to Claude Code:

```sh
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
```

## Documentation

## 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.

_Full upstream README: https://allmcps.com/mcp/doc-extract-mcp/readme_

