# DocSlicer

Splits PDF, Word, HTML and PowerPoint files into sections so the agent reads only the part it needs instead of the whole file.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 36
- Author: DocSlicer
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/DocSlicer/DocSlicer
- Updated: 2026-09-01
- HTML: https://affpapa.org/en/nevibecode/mcp/docslicer

## What it does

DocSlicer is a deterministic document parser. It extracts the heading hierarchy, cuts text into non-overlapping chunks and returns tables as cells rather than flat text. There are no model weights to download and no GPU involved, so nothing waits on a cold start. Throughput is listed at 31 pages per second.

As an MCP server it does vectorless RAG: the agent asks for the outline, picks a section and reads just that. No embeddings, and a 500-page filing never lands in the context window whole. Supported inputs are `pdf`, `docx`, `pptx` and `html`; JS-rendered pages go through Playwright, scanned pages through Tesseract when that extra is present.

Set `DOCSLICER_MCP_ROOT` before starting, otherwise the server has no idea which directories it may touch. `DOCSLICER_MCP_ALLOW_CLAUDE_DIR` and `DOCSLICER_MCP_ALLOW_URLS` widen access to the Claude directory and to network addresses. HTML and OCR each need their own extra: `pip install 'docslicer[html]'` with `playwright install chromium`, or `pip install 'docslicer[ocr]'` plus the Tesseract engine carrying the language models.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `DOCSLICER_MCP_ROOT`, `DOCSLICER_MCP_ALLOW_CLAUDE_DIR`, `DOCSLICER_MCP_ALLOW_URLS` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env DOCSLICER_MCP_ROOT=<DOCSLICER_MCP_ROOT> --env DOCSLICER_MCP_ALLOW_CLAUDE_DIR=<DOCSLICER_MCP_ALLOW_CLAUDE_DIR> --env DOCSLICER_MCP_ALLOW_URLS=<DOCSLICER_MCP_ALLOW_URLS> --transport stdio docslicer -- uvx docslicer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from docslicer <command>

### Codex

**Platform CLI**
```bash
codex mcp add docslicer --env DOCSLICER_MCP_ROOT=<DOCSLICER_MCP_ROOT> --env DOCSLICER_MCP_ALLOW_CLAUDE_DIR=<DOCSLICER_MCP_ALLOW_CLAUDE_DIR> --env DOCSLICER_MCP_ALLOW_URLS=<DOCSLICER_MCP_ALLOW_URLS> -- uvx docslicer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from docslicer <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "docslicer": {
            "command": "uvx",
            "args": [
                "docslicer"
            ],
            "env": {
                "DOCSLICER_MCP_ROOT": "<DOCSLICER_MCP_ROOT>",
                "DOCSLICER_MCP_ALLOW_CLAUDE_DIR": "<DOCSLICER_MCP_ALLOW_CLAUDE_DIR>",
                "DOCSLICER_MCP_ALLOW_URLS": "<DOCSLICER_MCP_ALLOW_URLS>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from docslicer <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "docslicer": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "docslicer"
            ],
            "env": {
                "DOCSLICER_MCP_ROOT": "<DOCSLICER_MCP_ROOT>",
                "DOCSLICER_MCP_ALLOW_CLAUDE_DIR": "<DOCSLICER_MCP_ALLOW_CLAUDE_DIR>",
                "DOCSLICER_MCP_ALLOW_URLS": "<DOCSLICER_MCP_ALLOW_URLS>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from docslicer <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e DOCSLICER_MCP_ROOT=<DOCSLICER_MCP_ROOT> -e DOCSLICER_MCP_ALLOW_CLAUDE_DIR=<DOCSLICER_MCP_ALLOW_CLAUDE_DIR> -e DOCSLICER_MCP_ALLOW_URLS=<DOCSLICER_MCP_ALLOW_URLS> docslicer uvx docslicer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from docslicer <command>

## When to use it
- pull one section out of a 500-page report without flooding context
- get a PDF table back as cells instead of a text blob
- turn a JS-rendered page into clean chunks
- read text off a scanned PDF
- keep the heading hierarchy intact while chunking

## Example prompts
- Show me the outline of `annual_report.pdf` and find the risk section
- Extract the tables under “Financial Instruments” and print them as markdown
- Parse this HTML page and give me the chunks under the “Install” heading

## Similar
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872
- [AIHawk](https://affpapa.org/en/nevibecode/mcp/aihawk.md) — MCP server · ★ 32221

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
