Paper RAG MCP
This is a read-only, source-first scientific literature MCP server offering seven tools for paper discovery, evidence retrieval, verification, PDF page inspection, and bounded citation exploration—without generating answers itself.
List papers: Find active papers by title substring, exact DOI, or paper ID; list up to 50 with an empty query.
Search evidence: Run BM25 + hierarchical retrieval, optionally scoped to up to 10 paper IDs, returning exact source spans, PDF pages, section headings, and fetchable result IDs.
Fetch sections: Read the full parent section for a search result with hash validation and page provenance, using offsets for long sections.
Build evidence checklists: Start a scientific question with explicit required evidence fields, plus question-specific extras.
Audit answers: Check each checklist field’s status, citations, exact quote anchors, source hashes, and field accounting—not semantic entailment.
Inspect original PDF pages: Read a 1-based original PDF page after hash validation, optionally with a rendered image, for tables, footnotes, figures, formulas, and missing conditions.
Explore citations: Read a configured frozen citation snapshot by paper ID or OpenAlex W ID in references, citing, or relations modes; coverage is sampled, not exhaustive.
Stay bounded and private: No arbitrary file access, live citation expansion, external supplement fetching, or model calls; all tools are marked read-only.
Supports DOI-based paper identification and lookup: papers can be ingested with a DOI, and the library can be queried by exact DOI.
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., "@Paper RAG MCP search my library for evidence about label definitions and exclusion criteria"
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.
Paper RAG · Scientific Library
Build your own source-first scientific literature library with Codex. Incrementally ingest your PDFs, retrieve complete source sections, inspect original PDF pages, audit citation anchors, and explore bounded citation networks through seven MCP tools.
Research Preview. This is a reusable implementation, not a certified scientific QA system. Literal quotation checks do not establish semantic entailment or correct method ownership. No personal papers, databases, credentials, or historical evaluation records are distributed.
Quick start
Requires Python 3.11–3.13 on macOS or Linux (Windows: WSL), disk space for parser models, and internet for initial dependency/model downloads. No paid LLM API is required.
git clone https://github.com/wyq24/Paper_RAG.git
cd Paper_RAG
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e .
paper-rag init
paper-rag ingest /absolute/path/paper.pdf --title 'Verified paper title' --doi '10.xxxx/example'
paper-rag retrieve 'What are the label definitions and exclusion criteria?'The default private library is ~/.local/share/paper-rag; configuration is ~/.config/paper-rag/config.json. Keep data outside this checkout. PAPER_RAG_CONFIG selects a different configuration. init never replaces an existing configuration. Parsing may download Docling model weights on first use. Image-only PDFs and undecoded formulas can remain inaccessible: current ingestion disables OCR and table reconstruction.
Related MCP server: evidence-rag
Use with Codex
Open this repository in Codex. Its repository skill lives at .agents/skills/scientific-library/SKILL.md. Ask:
Use the scientific-library skill. Initialize my own private library and add these PDFs. Preserve originals and show ingestion receipts.
Search my library for evidence about this question. Fetch full parent sections, distinguish author methods from comparators, show missing evidence, and audit citations.
The skill is an agent workflow, not a background watcher. Supplied papers are ingested when you ask the agent; paper-rag sync-inbox processes PDFs placed in the configured library's inbox when invoked. Discovery candidates require explicit import instructions.
Use GitHub Use this template to create your own repository, or fork it to maintain your own code, or clone it and ask Codex to configure your preferred new repository. Your library remains private and separate from the Git repository.
MCP: connect your existing chat model
# STDIO, for a local MCP client
paper-rag-mcp
# Streamable HTTP, loopback only
paper-rag-mcp --transport streamable-httpThe HTTP URL is http://127.0.0.1:8765/mcp. Set PAPER_RAG_PORT to change it. MCP and private tunnel setup explains ChatGPT access. GitHub hosts code, not the running server. Your computer must run the service/tunnel. The chat application's selected model composes the answer; these MCP tools do not invoke another model.
Tool | Purpose |
| Find active papers and IDs |
| BM25 + hierarchical source-first evidence |
| Parent sections with provenance and hash validation |
| Explicit required fields and missing evidence |
| Field accounting, literal quote anchors, source integrity |
| Original PDF page text and optional image |
| Read a configured frozen citation snapshot |
Manually supplied papers carry a manual label and receive a modest 10% boost within retrieved candidates. Citation-discovery imports retain a separate label. These preferences never raise scientific verification status.
Other workflows
python -m unittest discover -s tests -vTests use synthetic papers and mocked citation providers. They do not ingest a research corpus or run a scientific benchmark. Parsing tests use actual Docling/LlamaIndex; initial model download may be needed.
中文说明
这是最新版科研文献工作流的可复用代码版本:增量入库、全文获取与去重、父章节检索、证据完整性检查、原始 PDF 页面取证、引用网络,以及七个 MCP 接口。新用户从空库建立自己的知识库,不依赖作者的 87 篇历史语料。
使用 Codex 打开仓库并调用仓库中的 scientific-library skill 即可按需执行。论文全文、数据库、问题记录和引文快照存放在私有数据目录,不能提交到 GitHub。审计通过只说明字段和原文锚点检查通过,不代表科学结论、方法归属或整体准确率得到认证。原项目的未完成金标准与未运行 benchmark 状态没有被这次软件打包改变。
License: MIT for this repository's code. Dependencies and downloaded documents retain their respective licenses.
Available Tools
7 toolsaudit_answerARead-only
Before final answer, audit each checklist field. Each item: field, status (supported/missing/not_applicable), statement, reason for missing/not_applicable, citations=[{id: search result ID, quote: exact original text, offset: fetch offset}]. Checks source hashes, literal anchors and field accounting, NOT semantic entailment. Explicitly disclose missing evidence and unverified attribution.
Inputs: items (required), checklist_id (required).
citation_networkARead-only
Read a configured frozen citation snapshot by library paper_id or OpenAlex W ID. Modes: references, citing, relations (shared references/co-citers and normalized similarities). Follow next_offset. Coverage is sampled, not exhaustive. No live expansion.
Inputs: identifier (required), mode, offset.
evidence_checklistBRead-only
Start scientific questions with an explicit evidence checklist. Add question-specific requirements; later submit every field to audit_answer. No scientific completeness guarantee.
Inputs: question (required), extra_fields.
fetchARead-only
Read the original parent section for a search result ID, with hash validation and page provenance. Follow next_offset to read a long section. Never infer ownership from terminology alone. IDs must come from search; no arbitrary file access.
Inputs: id (required), offset.
list_papersARead-only
Find active papers by title substring, exact DOI or paper ID. Empty query lists up to 50. Use IDs to scope search. No model call.
Inputs: query.
searchARead-only
Retrieve source-first scientific evidence. Use faithful English scientific terms for Chinese questions; do not insert assumed answers. Optional paper_ids limits scope (maximum 10). Returns exact source spans, PDF pages, section headings, and result IDs for fetch. No answer generation.
Inputs: query (required), paper_ids.
source_pageARead-only
Read a 1-based ORIGINAL PDF page after source hash validation, optionally return its image. Use for table column alignment, footnotes, figures, formulas and missing experimental conditions. Does not fetch external supplements or certify interpretation.
Inputs: page (required), paper_id (required), render.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct role: listing papers, evidence search, section fetch, checklist creation, answer audit, citation graph lookup, and original page inspection. The main possible overlaps—search vs. fetch and fetch vs. source_page—are explicitly differentiated by result-ID scoping and page-level provenance. An agent can reliably select the right tool for each step.
Names are all snake_case and readable, but they mix bare verbs (search, fetch) with noun phrases (evidence_checklist, audit_answer, citation_network, source_page) and one verb_noun form (list_papers). The conventions are understandable but not predictably patterned across the set.
Seven tools is well-scoped for a retrieval-and-audit workflow over a paper corpus. Each tool maps to a distinct stage—discovery, search, reading, checklist, audit, citation exploration, and page inspection—without obvious redundancy.
The surface covers the core evidence workflow from paper discovery through source reading, citation exploration, and answer auditing. Minor gaps exist around library/ingestion operations or richer paper metadata retrieval, but these may be intentionally out of scope for a read-only RAG server.
Maintenance
Related MCP Connectors
Exact source text, not summaries: check citations and quotes in one call; read pages and PDFs.
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
Extract, ask, compare and parse PDFs/images with source evidence. OAuth sign-in or API keys.
Your personal library, readable by AI agents: durable snapshots, hybrid search, 46 MCP tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides read-only search and context-pack creation over a local source library, letting AI assistants retrieve relevant excerpts and audit cited quotations.20MIT
- AlicenseNot gradedqualityCmaintenanceEnables local read-only search and retrieval of approved, current evidence via hybrid lexical and dense methods, with tools to get exact source spans, answer from cited passages, and create and verify recheckable evidence packets.MIT
- AlicenseAqualityCmaintenanceEnables local-first, versioned evidence retrieval from papers without loading the whole library into a conversation, with optional Zotero, writing, fixed-commit code, and experiment record integration returning bounded excerpts and page images.51MIT
- AlicenseAqualityBmaintenanceEnables scientists and their AI agents to check quoted passages against pinned open-access PubMed Central full texts, look up retraction status from PMC and Crossref, and run recorded literature searches. Every quote check, search and annotation is written to an append-only, hash-chained log that can be verified, giving a dated record of what was searched and found.7MIT