Skip to main content
Glama

dsh-read-pdf — MCP server + CLI tool that lets DSH read PDFs

A PDF-reading server built on Model Context Protocol: text extraction, Chinese OCR (scanned pages), page rendering, file search, drag-and-drop inbox, ready to use out of the box. Compatible with any MCP client: DSH, Claude Desktop, Codex, Cursor, or your own app. Repo: https://github.com/xiaoxuPekingUniversity/dsh-read-pdf

English · 中文


中文

Features

Tool

Description

pdf_info

Page count / scanned or not / file size

pdf_text

Extract text from specified pages (pages like 1-3,5)

pdf_ocr

Chinese OCR for scanned PDFs (RapidOCR, runs locally, no network needed)

pdf_render

Render pages to PNG (for manual review of formula/diagram pages)

pdf_find

Find PDFs in a directory by keyword (newest first by modification time)

The CLI version pdf_tools.py provides the same capabilities without depending on any MCP client.

PDF Drop inbox (drag-and-drop upload): pdf_drop_server.py is a zero-dependency local web service. Drag PDFs into the drop zone in your browser and they are saved to a local folder — great for "feeding materials to AI" without host-side attachment upload support.

Install

pip install -r requirements.txt

Usage

Command line (CLI)

python pdf_tools.py info    exam.pdf
python pdf_tools.py text    exam.pdf --pages 1-3
python pdf_tools.py ocr     scanned.pdf            # 扫描版中文识别
python pdf_tools.py render  exam.pdf --pages 1-3
python pdf_tools.py find --dir ~/Downloads "期末"

PDF Drop inbox (drag-and-drop upload)

python pdf_drop_server.py --port 8765   # 浏览器打开 http://127.0.0.1:8765

As an MCP server

DSH (append to profiles/web/cordis.patch.yml):

- insert:
    - id: mcp-pdf
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        transport: stdio
        serverName: pdf
        command: python
        args:
          - /绝对路径/mcp_pdf_server.py
        failOnStartupError: false

As a native DSH plugin (with a Web settings-page toggle, recommended)

ds-plugin/ provides a zero-build host plugin with a "PDF Reading" toggle on the settings page (start/stop tools at runtime); see ds-plugin/README.md.

Claude Desktop (claude_desktop_config.json): see examples/claude_desktop_config.json.

Typical use cases

  • Drop scanned exam papers into an MCP-capable AI client → text is recognized automatically → generate solutions/handouts;

  • Pair with a local AI workspace: the AI directly calls pdf_text/pdf_ocr to read PDFs in a materials folder.

Roadmap

  • Support more file types (docx / xlsx)

  • Drag-and-drop upload (drag PDFs directly into the chat box) — requires host client support for non-image attachments; contributions welcome in this repo

  • PDF merge / split / batch conversion to images

Related MCP server: MCP Server Knowledge Engine

English

Features

Tool

Description

pdf_info

Page count / scanned detection / size

pdf_text

Extract text from selected pages (pages like 1-3,5)

pdf_ocr

Chinese OCR for scanned PDFs (RapidOCR, fully local)

pdf_render

Render pages to PNG (for formula/diagram pages)

pdf_find

Find PDFs in a directory by keyword (newest first)

A CLI (pdf_tools.py) provides the same capabilities without any MCP client. pdf_drop_server.py adds a zero-dependency local drag-and-drop inbox web page for feeding PDFs into an AI workspace (no host-side attachment support needed).

Install

pip install -r requirements.txt

Usage

CLI

python pdf_tools.py info    exam.pdf
python pdf_tools.py text    exam.pdf --pages 1-3
python pdf_tools.py ocr     scanned.pdf
python pdf_tools.py render  exam.pdf --pages 1-3
python pdf_tools.py find --dir ~/Downloads "final"

As an MCP server — register with any MCP-capable client (DSH, Claude Desktop, Codex…). See examples/ for config snippets.

Roadmap

  • Support more file types (docx / xlsx)

  • Drag-and-drop upload into chat UIs (requires host-side non-image attachment support — contributions welcome)

  • PDF merge / split / batch conversion

License

MIT

Related MCP Connectors

Related MCP Servers