Open Research KB

Open Research KB

A local-first MCP server for building and querying PDF knowledge bases. It indexes PDFs into DuckDB and exposes evidence-grounded retrieval tools to separate corpus-backed answers from independent reasoning.

Category
Visit Server

README

OpenShelf

简体中文 · Codex plugin · Claude Code plugin · Quick start · Concepts · Search and evidence · Tool reference

OpenShelf is a local-first MCP server for building searchable knowledge bases from local folders. It indexes text-layer PDFs into DuckDB, exposes evidence-grounded retrieval tools to agents, and separates corpus-backed answers from answers that require additional reasoning.

OpenShelf is designed for research papers, textbooks, technical documents, and local document libraries. It does not require a cloud vector database by default, does not upload source files, and keeps generated DuckDB files, PDF caches, and rendered page images out of the repository.

Why OpenShelf

Many RAG tools blur the line between "retrieved related text" and "the corpus supports this answer." OpenShelf keeps that boundary explicit:

  • Build reusable DuckDB knowledge bases from local files.
  • Use explainable DuckDB-backed BM25 text retrieval by default.
  • Preserve page chunks, technical-result chunks, and source-page evidence.
  • Distinguish closed corpus and open research corpus boundaries.
  • Label results as supported, related_only, or not_found.
  • Share a knowledge base directly by sharing its .duckdb file.

Features

Capability Description
Local ingestion Index searchable PDFs into DuckDB.
Multiple databases Manage isolated knowledge bases with db_name.
Existing DB registration Register an existing OpenShelf DuckDB file with create_db_from_exist.
Text retrieval Default mode: "text" uses BM25 text search.
Evidence labels Return supported, related_only, or not_found.
Corpus boundary Use profiles to distinguish closed corpus and open research corpus behavior.
Source inspection Fetch chunks, page text, and rendered page images.
Technical index Let users decide after ingestion whether to build theorem, lemma, definition, and proposition-oriented indexes.

Quick Start

npm install
npm run openshelf-mcp

Add the server to your Codex MCP config:

[mcp_servers.openshelf]
command = "npm"
args = ["--prefix", "/path/to/OpenShelf", "run", "--silent", "openshelf-mcp"]

Add a searchable PDF:

npm run create-document -- '{"pdf_path":"<path-to-book.pdf>","title":"Book Title","authors":["Author"],"tags":["book"]}'

See Quick start for the full flow.

Codex Plugin

This repository is also a Codex plugin root. It contains:

.codex-plugin/plugin.json  plugin manifest
.mcp.json                  OpenShelf MCP server config
skills/openshelf/          agent guidance for using OpenShelf
.agents/plugins/           local marketplace config

Local installation:

codex plugin marketplace add /path/to/OpenShelf
codex plugin add openshelf@openshelf-local

Start a new Codex thread after installation so Codex loads the OpenShelf MCP tools from the plugin.

In plugin mode, OpenShelf stores knowledge-base data under ~/.openshelf/data by default, not inside the Codex plugin cache. Existing .duckdb files can be registered into that catalog with create_db_from_exist.

Claude Code Plugin

This repository also supports the Claude Code plugin layout:

.claude-plugin/plugin.json       Claude Code plugin manifest
.claude-plugin/marketplace.json  Claude Code local marketplace
.mcp.json                        OpenShelf MCP server loaded by Claude Code

Local installation:

claude plugin marketplace add /path/to/OpenShelf
claude plugin install openshelf@openshelf-local

Restart Claude Code or start a new session after installation. Claude Code imports the MCP server named openshelf. Plugin data is stored under Claude's ${CLAUDE_PLUGIN_DATA}/data by default; existing .duckdb files can be registered with create_db_from_exist.

Recommended Workflow

OpenShelf is designed for an LLM agent with MCP tools, not for users to manually execute every retrieval step. A typical flow is:

  1. The user names a knowledge base and asks a question in natural language, such as "Use research_corpus to answer this."
  2. The agent chooses search, search_terms, or search_technical_results based on the question.
  3. If the result is supported, the agent answers directly from cited evidence.
  4. If the result is related_only or not_found, the agent explains that corpus evidence is insufficient and asks whether the user allows further reasoning.
  5. If the user allows further reasoning and the corpus is closed, the agent uses check_reasonable to audit whether the reasoning exceeds the corpus boundary. If the corpus is open research, the agent may continue, but must label what comes from the knowledge base and what is independent reasoning.
  6. If theorem, definition, or proposition-level retrieval is needed, the agent can suggest calling build_technical_index on already ingested documents to generate technical-result chunks.

PDF Requirements

By default, OpenShelf only accepts PDFs whose text can be extracted directly. LaTeX-generated papers and ebooks with embedded text usually work. Scanned PDFs, image-only PDFs, and PDFs whose text cannot be copied and pasted are rejected.

Default settings:

ocr: "never"
require_searchable: true

OCR must be explicitly enabled for scanned documents. It depends on local Tesseract and may be unreliable for formulas, tables, and complex layouts.

See Quick start: PDF requirements.

Core Tools

Tool Purpose
create_db Create a named DuckDB knowledge base, optionally ingesting PDFs.
create_db_from_exist Register an existing OpenShelf DuckDB file without copying or re-ingesting it.
list_db List available databases and profiles.
create_document Add one searchable PDF, rejecting image-only PDFs by default.
search Search chunks and return answerability metadata.
search_terms Two-stage retrieval for technical or domain questions.
build_technical_index Build theorem, lemma, definition, and related technical-result indexes.
search_technical_results Search structured technical results.
get_chunk / get_page_text / get_page_image Inspect chunks, page text, and rendered pages.

See Tool reference for complete schemas.

Documentation

Page Content
Quick start Installation, MCP setup, ingestion, smoke tests, and PDF requirements.
Concepts Knowledge bases, DuckDB files, closed/open profiles, page chunks, and technical-result chunks.
Search and evidence BM25, search modes, answerability, and technical-result indexing.
Tool reference MCP tool input and output schemas.
Development Local data, tests, and Git ignore policy.

Development

npm run typecheck
npm run test:unit

Runtime data stays local and is ignored by Git:

data/index/        DuckDB databases and catalog
data/pdfs/         optional PDF staging area
data/rendered/     rendered page cache
data/test_outputs/ test outputs

Next: Quick start

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured