Zotero Chunk RAG
The Zotero Chunk RAG server enables semantic search and retrieval over a Zotero research library using AI embeddings and configurable reranking. Key capabilities include:
search_papers— Passage-level semantic search across indexed PDF chunks, returning matched text with surrounding context (0–3 adjacent chunks) and bibliographic metadata (authors, year, citation keys), with optional year filtering.search_topic— Find the most relevant papers (deduplicated by document) for a broad topic, scoring each by average and best chunk relevance, with optional year filtering and up to 50 results.get_passage_context— Expand the context window around a specific passage from a prior search, retrieving 1–5 surrounding chunks for deeper reading.search_tables— Find tables within indexed PDFs by content using natural language, returning results in markdown format with captions and bibliographic details.get_reranking_config— View current reranking settings (section weights, journal quartile weights, alpha exponent) to understand result ordering.get_index_stats— Check index status: total documents, total chunks, and average chunks per document.
Results are reranked using a composite score combining semantic similarity with document metadata (e.g., paper section like 'Results'/'Methods' and journal impact quartile). The system also supports OCR for scanned PDFs and customizable ranking weights.
Enables passage-level semantic search and retrieval across a Zotero library, allowing users to find relevant papers by topic, extract bibliographic metadata, and access specific text passages with surrounding context from PDF attachments.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Zotero Chunk RAG Find passages in my papers about transformer architecture."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
DeepZotero
Semantic search over a Zotero library. PDFs are extracted (text, tables, figures), chunked, embedded, and stored in ChromaDB. An MCP server exposes the index to Claude Code (or any MCP client) as 10 tools for semantic and exact-word search over text, tables and figures, context expansion, citation graph lookup, indexing, and cost tracking.
What it extracts
Text — section-aware chunks with overlap, classified by document section (abstract, methods, results, etc.)
Tables — vision-based extraction via Claude Haiku 4.5. Each table is rendered to PNG and transcribed to structured markdown (headers, rows, footnotes). Table extraction is vision-only: with vision disabled, or without an Anthropic key, no tables are extracted.
Figures — detected with captions, extracted as PNGs, searchable by caption text.
Related MCP server: zotero-kb
Requirements
Python 3.10+
A Gemini API key for embeddings (unless using
embedding_provider: "local")An Anthropic API key for vision-based table extraction (optional but recommended)
Zotero 8 with PDFs in
storage/. Citation keys are read from Zotero's nativecitationKeyfield, which earlier versions do not have — on Zotero 7 every citation key comes back empty.Tesseract-OCR — only needed to OCR scanned / image-only PDF pages. Install Tesseract with the language data you need, then set the
TESSDATA_PREFIXenvironment variable to itstessdatadirectory (e.g.C:\Program Files\Tesseract-OCR\tessdata). PyMuPDF locates the OCR data via that variable; without it, scanned pages are skipped ("OCR disabled because Tesseract language data not found."). Text-based PDFs do not need Tesseract.
Install as a Claude Code plugin
Requires uv on PATH. The repo is its own marketplace:
/plugin marketplace add ccam80/deep-zotero
/plugin install deep-zoteroThe server launches through uvx, which fetches the pinned deep-zotero wheel from PyPI and caches it.
In the environment Claude Code starts from, set DEEP_ZOTERO_DATA_DIR (the Zotero data directory holding zotero.sqlite and storage/), DEEP_ZOTERO_CHROMA_PATH (where the index lives), GEMINI_API_KEY (embeddings) and ANTHROPIC_API_KEY (vision table extraction during indexing).
Index the library once before searching: deep-zotero-index -v.
/deep-zotero:install walks a coding agent through the whole setup: variables, Tesseract, and the first index.
Setup
1. Configuration
The four environment variables above are the whole configuration. Every other setting has a sensible default.
To override more than those four, write a JSON config and point DEEP_ZOTERO_CONFIG at it (or pass --config PATH to the CLI):
{
"zotero_data_dir": "~/Zotero",
"chroma_db_path": "~/.local/share/deep-zotero/chroma",
"gemini_api_key": "YOUR_GEMINI_KEY",
"anthropic_api_key": "YOUR_ANTHROPIC_KEY"
}A config file takes precedence over the environment wherever both supply a setting. See Configuration reference for every field.
2. API keys
Gemini (required for default embeddings):
Get a key at aistudio.google.com/app/apikey. Set it as gemini_api_key in config or GEMINI_API_KEY env var. If you don't want to use Gemini, set "embedding_provider": "local" to use ChromaDB's built-in all-MiniLM-L6-v2 model (no API key needed, lower quality).
Anthropic (required for vision table extraction):
Get a key at console.anthropic.com. Set it as anthropic_api_key in config or ANTHROPIC_API_KEY env var. Table extraction is vision-only — without this key, text and figures are still indexed but no tables are extracted. Vision extraction uses the Anthropic Batch API with Claude Haiku 4.5 — cost is roughly $0.016 per table, with prompt caching reducing cost on large batches.
To disable vision extraction entirely:
{
"vision_enabled": false
}3. Index your library
deep-zotero-index -vTo test with a subset first:
deep-zotero-index --limit 10 -vThis reads the Zotero SQLite database (read-only, safe while Zotero is open), extracts text/tables/figures from each PDF, chunks the text, embeds via Gemini, and stores everything in ChromaDB.
CLI options:
Flag | Description |
| Delete and rebuild index for all matching items |
| Only index N items |
| Index a single Zotero item |
| Regex filter on title (case-insensitive) |
| Skip vision table extraction for this run |
| Use a different config file |
| Debug logging |
The indexer is incremental — it only processes items not already in the index. Use --force after changing chunk_size, embedding_dimensions, or ocr_language.
You can also trigger indexing from the MCP client via the index_library tool.
4. Check it works
Call get_index_stats from Claude Code. It should report the documents and chunks just indexed.
If the tools are missing, the server did not start: confirm uv is on PATH and that the environment variables are visible to Claude Code's process.
For scanned-page OCR, TESSDATA_PREFIX (see Requirements) must be set in that same environment.
Configuration reference
Zotero
Field | Default | Description |
|
| Path to Zotero's data directory (contains |
|
| Where the ChromaDB index is stored on disk. Falls back to |
Embedding
Field | Default | Description |
|
|
|
|
| Gemini model name (only used when provider is |
|
| Output vector dimensions. |
|
| Falls back to |
|
| Timeout in seconds for embedding API calls |
|
| Max retries for failed embedding calls |
|
| Seconds to wait before retrying after an HTTP 429 (per-minute quota) |
Chunking
Field | Default | Description |
|
| Target chunk size in tokens (~4 chars/token). Changing requires |
|
| Overlap between consecutive chunks in tokens |
Vision
Field | Default | Description |
|
| Enable vision table extraction during indexing |
|
| Anthropic model for table transcription |
|
| Falls back to |
Reranking
Field | Default | Description |
|
| Enable composite score reranking |
|
| Similarity exponent (0-1). Lower = more metadata influence |
|
| Override default section weights |
|
| Override default journal quartile weights |
|
| Oversample factor before reranking |
|
| Additional factor for |
OCR
Field | Default | Description |
|
| Tesseract language code for scanned pages ( |
OpenAlex
Field | Default | Description |
|
| Email for OpenAlex polite pool (10 req/s vs 1 req/s). Falls back to |
MCP tools
Semantic search
search_papers — Passage-level semantic search. Returns matching text with surrounding context, reranked by composite score (similarity × section weight × journal weight). Supports required_terms for combining semantic search with exact word matching — each term must appear as a whole word in the passage.
Parameters: query (optional when required_terms is given), top_k (1-50), context_chunks (0-3), year_min, year_max, author, tag, collection, chunk_types (text/figure/table), sections, journal_quartiles, section_weights, journal_weights, required_terms (words that must appear as whole words), terms_operator (AND/OR).
search_topic — Paper-level topic search, deduplicated by document. Groups chunks by paper, scores by average and best composite relevance.
Parameters: query, num_papers (1-50), year_min, year_max, author, tag, collection, chunk_types, sections, journal_quartiles, section_weights, journal_weights.
Filtering
search_papers(query="baroreflex sensitivity", author="Olufsen", journal_quartiles=["Q1"])
search_papers(required_terms=["SDNN"], sections=["results"], year_min=1991, year_max=1995)Parameter | Applied | Match |
| during retrieval | exact |
| after retrieval | case-insensitive substring |
| during reranking, so only with | reorders, excludes nothing |
Valid sections: abstract, introduction, background, methods, results, discussion, conclusion, references, appendix, preamble, table, figure, unknown.
Valid journal_quartiles: Q1, Q2, Q3, Q4, and unknown for journals with no quartile.
Tables and figures
search_papers covers text, tables and figures. Every result names its
chunk_type; narrow with chunk_types:
search_papers("impedance measurement", chunk_types=["table"])Table results add table_index, caption, num_rows and num_cols, with the
table markdown in passage. Figure results add figure_index, caption and
image_path (the extracted PNG), with the caption in passage.
Table and figure chunks carry section values of table and figure rather
than the section they appeared in. Both weigh 1.0 in reranking.
Exact word matching
required_terms lists words that must appear in the passage as whole words,
case-insensitively — heart matches Heart but not hearth. terms_operator
is AND (default) or OR.
Terms constrain the search itself, so a passage containing a rare acronym is found even when semantic similarity would not rank it:
search_papers("autonomic regulation", required_terms=["SDNN"])Omit query to retrieve every matching passage in the index, unranked, with no
embedding call:
search_papers(required_terms=["propranolol", "SDNN"], terms_operator="AND")At least one of query or required_terms is required. section_weights and
journal_weights affect ranking only and are ignored when query is omitted.
No phrase search, no stemming.
Context expansion
get_passage_context — Expand context around a passage from search_papers. For table results, pass table_page and table_index to find body text citing the table.
Parameters: doc_id, chunk_index, window (1-5), table_page, table_index.
Citation graph (OpenAlex)
Requires the document to have a DOI in Zotero.
find_citing_papers — Papers that cite a given document. Parameters: doc_id, limit (1-100).
find_references — Papers a document cites. Parameters: doc_id, limit (1-100).
get_citation_count — Citation and reference counts. Parameters: doc_id.
Index management
index_library — Trigger indexing from the MCP client. Parameters: force_reindex, limit, item_key, title_pattern, no_vision.
get_index_stats — Document/chunk/table/figure counts, section coverage, journal coverage. Counts cover the entire collection. The result is cached in index_stats.sqlite next to the Chroma database and refreshed at the end of every indexing run; pass refresh: true to force a recount.
get_reranking_config — Current reranking weights and valid override values.
get_vision_costs — Vision API batch usage and cost summary. Parameters: last_n (recent entries to show).
Reranking
Search results are scored:
composite_score = similarity^alpha * section_weight * journal_weightDefault section weights:
Section | Weight |
results | 1.0 |
conclusion | 1.0 |
table | 0.9 |
methods | 0.85 |
abstract | 0.75 |
background | 0.7 |
unknown | 0.7 |
discussion | 0.65 |
introduction | 0.5 |
preamble | 0.3 |
appendix | 0.3 |
references | 0.1 |
Default journal weights: Q1=1.0, Q2=0.85, Q3=0.65, Q4=0.45.
Override per-call via section_weights and journal_weights parameters. Set a section to 0 to exclude it. Disable reranking entirely with "rerank_enabled": false.
Shared filter parameters
Parameter | Type | Description |
| string | Case-insensitive substring match against author names |
| string | Case-insensitive substring match against Zotero tags |
| string | Case-insensitive substring match against collection names |
| int | Publication year range |
| dict | Override section weights for this call |
| dict | Override journal quartile weights |
| list | Exact whole-word matches required in passage ( |
Research agent skill
examples/zotero-research/SKILL.md is a ready-made Claude Code skill that wraps these
tools into a spawnable research agent — it takes a high-level research question, runs
the appropriate searches, and returns consolidated findings with citation keys. Copy it
into .claude/skills/ (or your global skills directory) to use it.
Development
Debug viewer
tools/debug_viewer.py is a PyQt6 browser for inspecting the ChromaDB index — view papers, tables (rendered markdown vs PDF), figures, and individual chunks.
.venv/Scripts/python.exe tools/debug_viewer.pyTests
.venv/Scripts/python.exe -m pytestTests that make real Anthropic API calls are marked vision_api and excluded by
default; run them with -m vision_api.
tests/stress_test_real_library.py is the end-to-end quality gate: it pulls 10 papers
from the live Zotero library, runs the full extraction → index → search pipeline into a
temp ChromaDB, and asserts on extraction and retrieval quality. It writes
STRESS_TEST_REPORT.md and _stress_test_debug.db.
.venv/Scripts/python.exe tests/stress_test_real_library.py--vision-only re-runs just the vision extraction against an existing
_stress_test_debug.db, optionally narrowed to one paper with --paper KEY.
Releasing
python tools/release.py --bump patch (or an explicit X.Y.Z) rewrites the version in pyproject.toml and plugin/.claude-plugin/plugin.json, including the pinned package the plugin launches, then commits and tags. It refuses a dirty tree, a non-main branch, and an existing tag.
Pushing the tag runs .github/workflows/publish.yml, which re-checks that tag, both manifests and the pin agree before publishing to PyPI.
Available Tools
4 toolsget_index_statsB
Get statistics about the indexed collection.
Inputs: no named parameters. Returns: object
get_passage_contextA
Expand context around a specific passage.
Use after search_papers to get more context.
Args: doc_id: Document ID from search results chunk_index: Chunk index from search results window: Chunks before/after to include (1-5)
Inputs: doc_id (required), chunk_index (required), window. Returns: object
search_papersA
Semantic search over research paper chunks.
Returns relevant passages with surrounding context.
Args: query: Natural language search query top_k: Number of results (1-50) context_chunks: Adjacent chunks to include (0-3) year_min: Minimum publication year filter year_max: Maximum publication year filter
Returns: List of results with passage text, context, and metadata
Inputs: query (required), top_k, context_chunks, year_min, +1 more. Returns: result
search_topicA
Find the most relevant papers for a topic, deduplicated by document.
Searches across all chunks, then groups by paper. Each paper is scored by both its average chunk relevance (overall topical fit) and its best single chunk (strongest individual passage). Results are sorted by average score.
Args: query: Natural language topic description num_papers: Number of distinct papers to return (1-50) year_min: Minimum publication year filter year_max: Maximum publication year filter
Returns: List of per-paper results with scores and best passage
Inputs: query (required), num_papers, year_min, year_max. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The tools are mostly distinct in purpose: get_index_stats provides collection statistics, search_papers finds specific passages, search_topic finds relevant papers by topic, and get_passage_context expands context around a passage. However, search_papers and search_topic both involve semantic search over paper content, which could cause some confusion about when to use each, though their descriptions clarify the difference (passage-level vs. paper-level results).
All tool names follow a consistent snake_case pattern with clear verb_noun structures: get_index_stats, get_passage_context, search_papers, and search_topic. The naming is predictable and readable, with no mixing of conventions or stylistic deviations.
With 4 tools, the count is reasonable for a RAG-focused server, covering key operations like searching, context expansion, and statistics. It might be slightly thin for broader document management tasks (e.g., no indexing or update tools), but it's well-scoped for its apparent purpose of querying and exploring a research paper collection.
The toolset covers core retrieval and exploration functions (search, context expansion, stats) but has notable gaps for a full RAG or document management system. There are no tools for indexing, updating, or deleting documents, and operations like filtering by metadata beyond year are limited. This could lead to dead ends for agents needing to modify or fully manage the collection.
Maintenance
Related MCP Connectors
Zotero MCP server for Claude and ChatGPT: search, citations, safe writes, PDF passages and pages.
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
Private persistent memory for Claude, ChatGPT & Gemini via MCP - semantic search, zero-code setup.
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables interaction with Zotero libraries for searching, managing collections, items, tags, and attachments, plus optional semantic search across PDFs via local embeddings.3818 PyPI2MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP-compatible AI clients to search a local Zotero library using hybrid keyword and semantic retrieval, read specific pages and figure/table captions, and feed back experience so verified references rank higher over time.3MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to search a Zotero library, retrieve item metadata, and access full-text PDF contents through MCP tools.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to search a Zotero library and retrieve complete item metadata or full-text PDF contents through MCP tools. Connects to either the local Zotero desktop API or the Zotero Web API for user and group libraries.-