Skip to main content
Glama
Paper RAG MCP
by wyq24

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-http

The 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

list_papers

Find active papers and IDs

search

BM25 + hierarchical source-first evidence

fetch

Parent sections with provenance and hash validation

evidence_checklist

Explicit required fields and missing evidence

audit_answer

Field accounting, literal quote anchors, source integrity

source_page

Original PDF page text and optional image

citation_network

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 -v

Tests 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 tools
audit_answerA
Read-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_networkA
Read-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_checklistB
Read-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.

fetchA
Read-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_papersA
Read-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.

source_pageA
Read-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

    A3.7/5.0

    Scored across 7 tools

    Disambiguation5/5

    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.

    Naming Consistency3/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides read-only search and context-pack creation over a local source library, letting AI assistants retrieve relevant excerpts and audit cited quotations.
      20
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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
    • A
      license
      A
      quality
      C
      maintenance
      Enables 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.
      5
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables 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.
      7
      MIT