# Scholar RAG MCP

Turns a folder of academic PDFs into a searchable knowledge base: semantic chunk search, section-by-section reading, and per-paper add or remove.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 5
- Author: notwhiteblank
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/notwhiteblank/scholar-rag-mcp
- Updated: 2026-09-04
- HTML: https://affpapa.org/en/nevibecode/mcp/scholar-rag-mcp

## What it does

Scholar RAG MCP ingests a directory of papers through MinerU, pulls out metadata, marks up section structure, splits the text into chunks and embeds them. Storage is Qdrant, either launched for you or pointed at an existing instance. An agent can then search chunks, narrow results by `doc_id`, `section`, `year` or `journal`, and page through full text.

Eleven tools are exposed over stdio: `list_kbs`, `create_kb`, `delete_kb`, `add_document`, `remove_document`, `get_document`, `get_document_text`, `list_documents`, `search_documents`, `search_chunks`, `get_job`. Creating a knowledge base and adding papers run as background jobs, so progress comes back through `get_job`, and a job interrupted by a restart is picked up again. Reading returns the outline first and pages on demand, which keeps the context window from filling up.

Three OpenAI-compatible endpoints are required up front: chat, embed and rerank. `SCHOLAR_RAG_CHAT_MODEL`, `SCHOLAR_RAG_EMBED_MODEL` and `SCHOLAR_RAG_RERANK_MODEL` are mandatory — the model-serving script exits and lists whichever ones are missing. The bundled `scripts/serve_models.sh` drives vLLM and runs only on Linux with CUDA; on Windows or macOS you supply your own server, such as Ollama or LM Studio. The rerank endpoint has to answer on `/v1/rerank`, otherwise you are left with the embed-only fallback.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `SCHOLAR_RAG_DATA_DIR`, `SCHOLAR_RAG_CHAT_BASE_URL`, `SCHOLAR_RAG_EMBED_BASE_URL`, `SCHOLAR_RAG_RERANK_BASE_URL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env SCHOLAR_RAG_DATA_DIR=<SCHOLAR_RAG_DATA_DIR> --env SCHOLAR_RAG_CHAT_BASE_URL=<SCHOLAR_RAG_CHAT_BASE_URL> --env SCHOLAR_RAG_EMBED_BASE_URL=<SCHOLAR_RAG_EMBED_BASE_URL> --env SCHOLAR_RAG_RERANK_BASE_URL=<SCHOLAR_RAG_RERANK_BASE_URL> --transport stdio scholar-rag-mcp -- uvx scholar-rag-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scholar-rag-mcp <command>

### Codex

**Platform CLI**
```bash
codex mcp add scholar-rag-mcp --env SCHOLAR_RAG_DATA_DIR=<SCHOLAR_RAG_DATA_DIR> --env SCHOLAR_RAG_CHAT_BASE_URL=<SCHOLAR_RAG_CHAT_BASE_URL> --env SCHOLAR_RAG_EMBED_BASE_URL=<SCHOLAR_RAG_EMBED_BASE_URL> --env SCHOLAR_RAG_RERANK_BASE_URL=<SCHOLAR_RAG_RERANK_BASE_URL> -- uvx scholar-rag-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scholar-rag-mcp <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "scholar-rag-mcp": {
            "command": "uvx",
            "args": [
                "scholar-rag-mcp"
            ],
            "env": {
                "SCHOLAR_RAG_DATA_DIR": "<SCHOLAR_RAG_DATA_DIR>",
                "SCHOLAR_RAG_CHAT_BASE_URL": "<SCHOLAR_RAG_CHAT_BASE_URL>",
                "SCHOLAR_RAG_EMBED_BASE_URL": "<SCHOLAR_RAG_EMBED_BASE_URL>",
                "SCHOLAR_RAG_RERANK_BASE_URL": "<SCHOLAR_RAG_RERANK_BASE_URL>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scholar-rag-mcp <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "scholar-rag-mcp": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "scholar-rag-mcp"
            ],
            "env": {
                "SCHOLAR_RAG_DATA_DIR": "<SCHOLAR_RAG_DATA_DIR>",
                "SCHOLAR_RAG_CHAT_BASE_URL": "<SCHOLAR_RAG_CHAT_BASE_URL>",
                "SCHOLAR_RAG_EMBED_BASE_URL": "<SCHOLAR_RAG_EMBED_BASE_URL>",
                "SCHOLAR_RAG_RERANK_BASE_URL": "<SCHOLAR_RAG_RERANK_BASE_URL>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scholar-rag-mcp <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e SCHOLAR_RAG_DATA_DIR=<SCHOLAR_RAG_DATA_DIR> -e SCHOLAR_RAG_CHAT_BASE_URL=<SCHOLAR_RAG_CHAT_BASE_URL> -e SCHOLAR_RAG_EMBED_BASE_URL=<SCHOLAR_RAG_EMBED_BASE_URL> -e SCHOLAR_RAG_RERANK_BASE_URL=<SCHOLAR_RAG_RERANK_BASE_URL> scholar-rag-mcp uvx scholar-rag-mcp
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from scholar-rag-mcp <command>

## When to use it
- build a local knowledge base from a folder of paper PDFs
- find the relevant passage by meaning rather than keywords
- read one section of a paper without loading the whole file
- add or drop a single paper from an existing knowledge base
- filter search results by year, journal or section

## Example prompts
- Create a knowledge base called `papers` and ingest every PDF in `./articles`
- Search `papers` for chunks about evaluation methods and tell me which papers they came from
- Show the outline of `doc_id=42`, then open the experiments section

## Similar
- [rag-architect](https://affpapa.org/en/nevibecode/skills/httpsgithubcomjeffallan-rag-architect.md) — skill · 4700 installs
- [rag-infrastructure](https://affpapa.org/en/nevibecode/skills/rag-infrastructure.md) — skill · 325 installs
- [langchain-rag](https://affpapa.org/en/nevibecode/skills/langchain-rag.md) — skill · 17500 installs
- [rag](https://affpapa.org/en/nevibecode/skills/rag.md) — skill · 3700 installs
- [rag-retrieval](https://affpapa.org/en/nevibecode/skills/rag-retrieval.md) — skill · 1500 installs
- [rag-engineer](https://affpapa.org/en/nevibecode/skills/sickn33-rag-engineer.md) — skill · 1000 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
