π¦
io.github.PyJudge/pdf4vllm
PDF reader for vision LLMs. Auto-detects text corruption and switches to image mode.
0 installs
Trust: 37 β Low
Content
Ask AI about io.github.PyJudge/pdf4vllm
Powered by Claude Β· Grounded in docs
I know everything about io.github.PyJudge/pdf4vllm. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Loading tools...
Reviews
Documentation
pdf4vllm
PDF reading MCP server optimized for vision LLMs.
νκ΅μ΄
λ¬Έμ
| λ°©μ | λ¬Έμ μ |
|---|---|
| ν μ€νΈ μΆμΆ | μΈμ½λ© κΉ¨μ§ β μ°λ κΈ° μΆλ ₯, μ΄λ―Έμ§-ν μ€νΈ μμ λ€μμ |
| μ΄λ―Έμ§ λ³ν | ν ν° νλ° (νΉν νμ΄μ§ λ§μ λ) |
ν΄κ²°
pdf4vllmμ PDFκ° μ§μ λΆνλ€κ³ κ°μ ν©λλ€.
- ν μ€νΈ μμ μλ κ°μ§ β μ΄λ―Έμ§λ‘ μλ μ ν
- μ½κΈ° μμ 보쑴 (ν μ€νΈ β ν β μ΄λ―Έμ§ λΈλ‘ μμλλ‘)
- νμ΄μ§ μ νμΌλ‘ 컨ν μ€νΈ μ€λ²νλ‘μ° λ°©μ§
- λΆνμν μ΄λ―Έμ§ μλ νν°λ§ (λ‘κ³ , μ , ν€λ/νΈν°)
μ€μΉ
pip install pdf4vllm-mcp
# λλ
uvx pdf4vllm-mcp
Claude Desktop μ€μ
git clone https://github.com/PyJudge/pdf4vllm-mcp.git
cd pdf4vllm-mcp
python scripts/install_mcp.py
λλ μ§μ μ€μ (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"pdf4vllm": {
"command": "/python/κ²½λ‘",
"args": ["/pdf4vllm-mcp/κ²½λ‘/src/server.py"]
}
}
}
λꡬ
| λꡬ | μ€λͺ |
|---|---|
list_pdfs | PDF νμΌ μ°ΎκΈ° (glob ν¨ν΄ name_pattern μ§μ) |
read_pdf | PDF λ΄μ© λΈλ‘μΌλ‘ μΆμΆ |
grep_pdf | PDF λ΄ ν
μ€νΈ κ²μ (pdfgrep μ€μΉ νμ) |
μΆμΆ λͺ¨λ
| λͺ¨λ | μ€λͺ |
|---|---|
auto (κΈ°λ³Έ) | ν μ€νΈ μΆμΆ μλ β μμ κ°μ§ μ μ΄λ―Έμ§λ‘ μ ν |
text_only | ν μ€νΈ/νλ§ μΆμΆ, μ΄λ―Έμ§ μμ |
image_only | νμ΄μ§λ₯Ό μ΄λ―Έμ§λ‘λ§ λ λλ§ |
Problem
| Approach | Issue |
|---|---|
| Text extraction | Encoding corruption β garbage output, mixed text-image ordering |
| Image conversion | Token explosion (especially with many pages) |
Solution
pdf4vllm assumes PDFs are messy.
- Auto-detects text corruption β switches to image automatically
- Preserves reading order (text β table β image blocks in sequence)
- Page limits prevent context overflow
- Filters unnecessary images (logos, lines, headers/footers)
PDF Input
β
Corruption Detection (pdfminer.six + pattern analysis)
β
βββββββββββββββ¬ββββββββββββββ
β Corrupted β Clean β
β β Image β β Text + β
β only β Tables + β
β β Images β
βββββββββββββββ΄ββββββββββββββ
β
Ordered Blocks (JSON)
Install
pip install pdf4vllm-mcp
# or run without installing
uvx pdf4vllm-mcp
Claude Desktop Setup
git clone https://github.com/PyJudge/pdf4vllm-mcp.git
cd pdf4vllm-mcp
python scripts/install_mcp.py
Or manually edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"pdf4vllm": {
"command": "/path/to/python",
"args": ["/path/to/pdf4vllm-mcp/src/server.py"]
}
}
}
Claude Code Setup
Create .mcp.json in your project:
{
"mcpServers": {
"pdf4vllm": {
"command": "uvx",
"args": ["pdf4vllm-mcp"]
}
}
}
Tools
| Tool | Description |
|---|---|
list_pdfs | Find PDF files with glob filtering (name_pattern) |
read_pdf | Extract PDF content as ordered blocks |
grep_pdf | Search text in PDFs using pdfgrep (requires pdfgrep installed) |
Extraction Modes
| Mode | Description |
|---|---|
auto (default) | Try text extraction β switch to image if corrupted |
text_only | Text/tables only, no images |
image_only | Render pages as images only |
Output Format
{
"pages": [
{
"page_number": 1,
"content_blocks": [
{"type": "text", "content": "..."},
{"type": "table", "content": "| A | B |"},
{"type": "image", "content": "[IMAGE_0]"}
]
}
]
}
When text is corrupted:
{
"page_number": 2,
"content_blocks": [],
"text_corrupted": true,
"page_image": "[IMAGE_1]"
}
Configuration
config.json or environment variables:
{
"max_pages_per_request": 10,
"max_image_dimension": 842,
"page_image_dpi": 100
}
export PDF_MAX_PAGES=20
export PDF_PAGE_IMAGE_DPI=150
Test Server
pip install pdf4vllm-mcp[test]
python test_server.py
# β http://localhost:8000
License
MIT
