PDF Inline Image RAG
FreeNot checkedBuilds searchable SQLite databases from PDFs, preserving inline image locations for AI agents to discover and caption visual content. Supports full-text search
About
Builds searchable SQLite databases from PDFs, preserving inline image locations for AI agents to discover and caption visual content. Supports full-text search over text, image placeholders, and saved captions.
README
An MCP server and CLI for building local, searchable SQLite databases from PDFs where important content appears inside inline images, figures, diagrams, or scanned image blocks.
The key rule is simple:
- Extract PDF text normally.
- Extract only actual PDF image blocks, not whole-page screenshots.
- Insert image placeholders into the page text stream at their page-flow location.
- Store every extracted image with its exact PDF bounding box.
Example text_with_images marker:
[[IMAGE page=72 index=1 bbox=80.6,76.0,535.7,645.7 size=1896x2373 file=mtp-2_assets/images/page_0072_image_01.png]]
This gives an AI agent enough context to search normal text, notice where an image appeared, fetch the image asset, caption/OCR it, and save the caption back into the searchable index.
Install
pip install git+https://github.com/Joncallim/pdf-inline-image-rag-mcp.git
For local development:
git clone https://github.com/Joncallim/pdf-inline-image-rag-mcp.git
cd pdf-inline-image-rag-mcp
python -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
MCP Usage
Add this server to your MCP client:
{
"mcpServers": {
"pdf-inline-image-rag": {
"command": "pdf-inline-image-rag-mcp"
}
}
}
Available tools:
build_pdf_ragsearch_pdf_ragget_pdf_pageget_pdf_imagelist_uncaptioned_pdf_imagessave_pdf_image_captioninspect_pdf_rag
Typical flow:
- Call
build_pdf_ragwith a PDF path and output directory. - Call
search_pdf_ragfor normal text queries. - When a result includes
[[IMAGE ...]], callget_pdf_pageorget_pdf_image. - Caption or OCR the image with your preferred model.
- Call
save_pdf_image_captionso the caption is added to page text and FTS.
CLI Usage
Build a database:
pdf-inline-image-rag build \
--input /path/to/file.pdf \
--output-dir outputs/pdf_rag \
--replace
Build only selected pages:
pdf-inline-image-rag build \
--input /path/to/file.pdf \
--output-dir outputs/pdf_rag \
--pages 1-10,42
Search:
pdf-inline-image-rag search \
--db outputs/pdf_rag/file_rag.sqlite \
"sector method"
Inspect:
pdf-inline-image-rag inspect \
--db outputs/pdf_rag/file_rag.sqlite
Output Layout
outputs/pdf_rag/
file_rag.sqlite
file_rag_export.md
file_assets/
images/page_0001_image_01.png
visual_json/page_0001.visual.json
Whole-page PNG rendering is disabled by default. Use --render-pages only for debugging.
SQLite Tables
pages:
text: normal embedded PDF texttext_with_images: text plus inline image placeholdersmarkdown: page-level retrieval documentimage_countneeds_ocr
images:
file_pathbbox_x0,bbox_y0,bbox_x1,bbox_y1width,heightblock_numberplaceholdercaptioncaption_model
pages_fts:
- FTS5 index over text, image placeholders, markdown, and saved captions.
Notes
This project does not invent image captions. It extracts image blocks and makes them discoverable. Use an OCR or vision model to caption the extracted images, then persist the caption with save_pdf_image_caption.
Installing PDF Inline Image RAG
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/Joncallim/pdf-inline-image-rag-mcpFAQ
Is PDF Inline Image RAG MCP free?
Yes, PDF Inline Image RAG MCP is free — one-click install via Unyly at no cost.
Does PDF Inline Image RAG need an API key?
No, PDF Inline Image RAG runs without API keys or environment variables.
Is PDF Inline Image RAG hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install PDF Inline Image RAG in Claude Desktop, Claude Code or Cursor?
Open PDF Inline Image RAG on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashPostgres
Query your database in natural language
by AnthropicPostgreSQL
Read-only database access with schema inspection.
by modelcontextprotocolCompare PDF Inline Image RAG with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs
