How hao-yicheng/macpdf-ocr-mcp works
macpdf-ocr-mcp is a local stdio MCP server that helps clients read PDFs and inspect image regions. The main workflow is a batched PDF read with PDFKit text extraction where available and Vision OCR when needed, plus optional previews and region hints; clients can then request a focused crop or save a region. The README documents four tools and their behavior. The excerpts show server and extraction paths but omit some implementations, so uncertain internal wiring is not expanded.
Main entry points: macpdf_ocr_mcp.swift PDF Read · MCPStdIOServer.swift Stdio Server
Components 15
MCP Interface
- CLI Entry
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Stdio Server
Sources/macpdf-ocr-mcp/MCPStdIOServer.swift
PDF Reading
- PDF Read
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Page Batching
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Text Extraction
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - PDFKit
- Vision OCR
- Page Rendering
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Region Hints
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Preview Files
Region Tools
- PDF Focus
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Save Region
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift - Image OCR Regions
Sources/macpdf-ocr-mcp/macpdf_ocr_mcp.swift
Other components
- MCP Client
- PDF or Image
Connections 21
- MCP Client → Stdio Server: sends MCP requests
- CLI Entry → Stdio Server: starts stdio
- Stdio Server → PDF Read: dispatches tool
- Stdio Server → PDF Focus: dispatches tool
- Stdio Server → Save Region: dispatches tool
- Stdio Server → Image OCR Regions: dispatches tool
- PDF Read → PDF or Image: opens PDF
- PDF Read → Page Batching: limits pages
- PDF Read → Text Extraction: extracts page text
- Text Extraction → PDFKit: reads text
- Text Extraction → Vision OCR: runs OCR
- PDF Read → Page Rendering: renders previews
- PDF Read → Region Hints: derives hints
- Page Rendering → Preview Files: writes previews
- PDF Focus → PDF or Image: opens PDF
- PDF Focus → Text Extraction: extracts region text
- PDF Focus → Page Rendering: renders crop
- Save Region → PDF or Image: reads source
- Save Region → Preview Files: writes crop
- Image OCR Regions → PDF or Image: reads image
- Image OCR Regions → Vision OCR: runs OCR