LibraryMCP
Looks up paper metadata (titles, authors, years, abstracts) from arXiv (and Crossref) at ingest time to enrich scientific PDFs indexed in the scientific shelf type, feeding title/abstract semantic search via find_documents and search_papers.
Can use a locally running Ollama instance as the embedding backend (backend: "ollama") to generate vector embeddings of document chunks for hybrid retrieval.
Uses PostgreSQL with the pgvector extension as the document store and vector index for chunks, metadata, and shelves, and uses Postgres LISTEN/NOTIFY as the coordination channel between the watcher and server processes.
Click on "Install 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., "@LibraryMCPfind the air filter replacement steps in the Shelly Plus 2PM manual"
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.
Library
Local document RAG over Postgres + pgvector, exposed to a speech assistant via MCP. Need also llama.cpp or similar to process embeddings. Quick'dirty, AS_SI, all local.
Two processes, one codebase:
library.watcher— scans configured directories, indexes new and changed PDFs. CPU-heavy, bursty, needs outbound internet for paper metadata.library.server— MCP server over streamable-http. Latency-sensitive, needs only Postgres and Ollama on localhost.
They talk through Postgres LISTEN/NOTIFY, so there is no queue or extra port between them.
Setup
sudo apt install postgresql-17-pgvector
psql -U postgres -f sql/01_bootstrap.sql
psql -U librarian -d library -f sql/02_schema.sql
psql -U librarian -d library -f sql/03_shelf_types.sql
python3.13 -m venv .venv
.venv/bin/pip install -r requirements.txt
cp config.yaml.example config.yaml # edit pathsEmbedding server
Any OpenAI-compatible /v1/embeddings endpoint works — llama.cpp, TEI, vLLM,
LM Studio — or Ollama via backend: "ollama".
With llama.cpp, run a second llama-server on its own port, separate from
your chat model:
llama-server \
-m models/bge-m3-F16.gguf \
--embeddings \
--pooling cls \
-c 8192 -b 8192 -ub 8192 \
--host 127.0.0.1 --port 8081Or in ini-file when you can use current llama-server
[bge-m3]
model = /models/bge-m3-f16.gguf
load-on-startup = true
embeddings = on
pooling = cls
ctx-size = 8192
ubatch-size = 8192
batch-size = 8192Then in config.yaml:
embedding:
backend: "openai"
base_url: "http://localhost:8081"
model: "bge-m3"
dimensions: 1024
batch_size: 8Both processes call health_check() at startup, so a wrong port, a missing
--embeddings, or a dimension mismatch fails immediately rather than partway
through the first index.
First index, in the foreground so you can watch it:
.venv/bin/python -m library.watcher --once -vThen run both:
.venv/bin/python -m library.watcher # daemon
.venv/bin/python -m library.server # http://0.0.0.0:8765/mcpOr install the systemd units in systemd/ (adjust User= and paths).
Related MCP server: ickyMCP
Adding a shelf
Append to shelves: in config.yaml and restart the watcher. The shelves
table is reconciled on startup. Several shelves may share a type:
- name: condo_meetings
type: meetings
path: /srv/documents/meetings/condoShelf types and what they do at ingest:
type | parent directory means | title from | network lookup |
| device name + model | directory name | no |
| meeting date | filename + date | no |
| nothing | arXiv/Crossref, else largest font on page 1 | yes |
MCP tools
tool | purpose |
| orientation: what exists, how big |
| enumerate a small/medium shelf, optionally date-filtered |
| semantic search over titles + abstracts, for large shelves |
| full-text + vector over manuals, |
| same over meetings, with |
| same over papers, with |
| neighbouring passages when a result is truncated |
| full metadata for one document |
| signal the watcher to rescan |
Notes
Retrieval is hybrid: vector and full-text arms, fused with Reciprocal Rank Fusion. Both are needed — dense vectors miss
E04andSNSW-102P16EU, keyword search misses paraphrase.Text search config is
simple, notenglish, so model numbers survive and Finnish is not mangled by an English stemmer.Chunks are paragraph-packed to ~400 tokens with overlap, not split by page.
page_start/page_endare recorded as provenance;page_end > page_startmeans the chunk crossed a break, and the citation reads "pages 6-7".Citations are returned as structured fields, not a formatted string, so the speech layer can say "page 12 of the Shelly Plus 2PM manual" without reading a filename aloud.
Scanned PDFs with no text layer are skipped with an error. Run OCR (
ocrmypdf) over them first.
Getting bge-m3 gguf
git clone llama.cpp
# in your llama.cpp checkout, with current master
pip install -r requirements.txt
pip install huggingface_hub
huggingface-cli download BAAI/bge-m3 --local-dir ./bge-m3
python convert_hf_to_gguf.py ./bge-m3 --outtype f16 --outfile bge-m3-f16-new.ggufThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
Ingest, manage, and retrieve documents for RAG-powered AI applications
- KumbukaOAuthai.kumbuka
Governed, auditable knowledge your team curates for its AI assistants, self-hostable
Versioned documentation registry and semantic search for AI tools and coding assistants.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.-
- AlicenseNot gradedqualityDmaintenanceRAG-powered document search server that enables semantic search across large collections of legal and business documents (PDF, Word, Excel, PowerPoint) using local embeddings with no API costs.4MIT
- FlicenseAqualityNot gradedmaintenanceA local-first knowledge base server that enables AI clients to store, retrieve, and manage documents using semantic search. Provides privacy-focused, offline-capable memory for AI assistants with tools for ingesting, querying, updating, and deleting knowledge.710-
- FlicenseNot gradedqualityDmaintenanceEnables semantic search and conversational querying across a personal research library of PDFs, DOCX, and other documents using a vector database. It provides tools for document summarization, finding related papers, and high-accuracy retrieval for AI clients like Claude Desktop.-