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.
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, ornot_found. - Share a knowledge base directly by sharing its
.duckdbfile.
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:
- The user names a knowledge base and asks a question in natural language, such as "Use
research_corpusto answer this." - The agent chooses
search,search_terms, orsearch_technical_resultsbased on the question. - If the result is
supported, the agent answers directly from cited evidence. - If the result is
related_onlyornot_found, the agent explains that corpus evidence is insufficient and asks whether the user allows further reasoning. - If the user allows further reasoning and the corpus is closed, the agent uses
check_reasonableto 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. - If theorem, definition, or proposition-level retrieval is needed, the agent can suggest calling
build_technical_indexon 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。