ai-lab
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AI Lab - Local-First RAG Second Brain
A retrieval-augmented knowledge base that runs entirely on your machine. It ingests markdown and an Obsidian vault, embeds every chunk locally with no API key, stores the vectors in SQLite, and answers semantic queries over hybrid keyword + vector search. It plugs into Claude Code over MCP so an AI assistant can pull your own notes before it answers.
No cloud. No API key for retrieval. Your notes never leave the machine.
$ npm run search "how do I keep my notes private without a cloud API"
[note] Local Embeddings and Local LLMs (score 0.550)
You do not have to send your notes to a cloud API to embed them. transformers.js
runs sentence-embedding models directly in Node with no API key and no network...That match came from pure semantic similarity - the query shares no keywords with the note title.
What it demonstrates
Capability | How |
RAG | Ingest -> chunk by heading -> embed -> retrieve -> assemble context. |
Vector DB | Embeddings stored as BLOBs in SQLite; brute-force cosine scan + FTS5 keyword index in one file. |
Local embeddings (key-free) |
|
Second brain -> Obsidian | Point |
Exposed to Claude Code (MCP) |
|
Related MCP server: HomeKB MCP Server
Quickstart
npm install # native build needs Python <= 3.13
npm run ingest # embeds the bundled sample notes
npm run search "vector search" # semantic + keyword retrieval
npm run ask "what is a second brain" # assembled context block
npm run statsIndex your own Obsidian vault:
OBSIDIAN_VAULTS="$HOME/Documents/My Vault" npm run ingestWire it into Claude Code as a tool:
claude mcp add ai-lab -- npx tsx /absolute/path/to/ai-lab/src/mcp-server.tsHow retrieval works
Ingest - markdown is split on H1-H3 boundaries so each chunk stays topically coherent, with a hard cap (~1600 chars) on long sections.
Embed - each chunk is mean-pooled and L2-normalized into a 384-dim vector, so a raw dot product equals cosine similarity.
Store - vectors live as BLOBs next to their text in SQLite; an FTS5 virtual table indexes the same chunks for keyword recall.
Retrieve (hybrid) - the query is embedded and scored by cosine against every chunk; FTS5 keyword hits get a small boost. Keyword catches exact terms, vectors catch paraphrase - the blend beats either alone.
Assemble - top chunks are packed into a token-budgeted context block ready to ground a prompt.
Testing
npm test # node:test unit tests - pure functions only, no model download, CI gate
npm run eval # retrieval eval harness - downloads the MiniLM model, not part of the CI gateRetrieval quality
eval/ runs search() against a fixed 10-document corpus (eval/corpus/)
covering 10 unrelated topics, against 12 natural-language queries
(eval/queries.json), and reports recall@1, recall@5, and MRR
(eval/run.ts). It ingests into a throwaway temp SQLite db, so it never
touches data/ai-lab.db. Full per-query breakdown: eval/results.md.
Metric | Value |
recall@1 | 100.0% |
recall@5 | 100.0% |
MRR | 1.000 |
12/12 queries, including 2 paraphrase queries with no keyword overlap with their target doc. The corpus is small and deliberately made of maximally distinct topics (sourdough bread, TCP handshakes, Roman aqueducts, ...), so a perfect score here says the hybrid pipeline works end to end and catches regressions - it is not a claim about recall on a real, topically-overlapping personal knowledge base, where scores will be lower.
Architecture decisions
0001 - Brute-force cosine over SQLite, hybridized with FTS5 - why linear cosine scan + FTS5 instead of an ANN index, and what corpus size would change that answer.
Stack
TypeScript + Node (ESM, run directly with
tsx)@huggingface/transformers- local sentence embeddingsbetter-sqlite3- vectors + FTS5, single-file store@modelcontextprotocol/sdk- MCP server for Claude Code
More AI projects
Part of a wider set of AI tooling:
nexus - 12-agent system for Claude Code, structured multi-agent roles
diagrams - describe a diagram in plain English, get rendered Mermaid
decks - AI slide-deck generator from a topic prompt
score-card - technical-interview rubric with Claude feedback
mimi - live meeting transcription with an AI summary
local-apps - self-healing dev monitor with AI fix agents
automations - visual node-based automation flow builder
claude-live - Rust WebSocket server streaming Claude Code sessions
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Personal context for every AI: search, read, and write back to your private Markdown library.
Your own memory inside ChatGPT and Claude, with the source of every note.
Notes and memory assistant: one Markdown vault that Claude, ChatGPT and any MCP client can share.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables local semantic search over documents and code for Claude Code and Claude Desktop, running entirely offline with local embeddings and vector storage.14424 PyPI7MIT
- AlicenseNot gradedqualityCmaintenanceEnables natural language interaction with a personal knowledge base stored locally on your computer, supporting semantic search, note reading, and writing through Claude Code or mobile apps.13MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude Code to use local markdown notes as persistent, searchable memory with hybrid recall, episodic memory, note-graph traversal, design memory, and optional cloud sync.209 npmMIT
- FlicenseNot gradedqualityCmaintenanceEnables Claude Code to read and write local Markdown notes and to query a knowledge graph built from those notes and scanned code projects. Everything runs on localhost with no API key or installation of external services.1-