Skip to main content

100% local RAG for Obsidian, Zotero, and Claude Code — LightRAG + Ollama + MCP

Project description

local-rag

100% local RAG for Obsidian, Zotero, and Claude Code — powered by LightRAG + Ollama

Python License: MIT LightRAG Ollama MCP

A complete, privacy-first RAG stack that runs entirely on your machine. No API keys. No cloud. No data leaves your computer.


Why local-rag?

local-rag Cloud RAG
Privacy Your data stays on your machine Sent to third-party servers
Cost Free after hardware Per-token API costs
Offline Works without internet Requires connectivity
Latency Local inference Network round-trips
Customization Any model via Ollama Limited to provider models

Architecture

┌─────────────────────────────────────────────────────┐
│                  YOUR DOCUMENTS                      │
│   Obsidian vault (.md)  │  Zotero storage (.pdf)    │
└──────────────┬──────────────────────────────────────┘
               │  ingestion pipeline (Python)
               ▼
┌─────────────────────────────────────────────────────┐
│                 LIGHTRAG SERVER                      │
│  • Knowledge graph (entities + relations)            │
│  • Vector index (NanoVectorDB)                       │
│  • LLM: Ollama → qwen2.5:14b                        │
│  • Embeddings: Ollama → nomic-embed-text             │
│  • REST API at http://localhost:9621                 │
└──────────────┬──────────────────────────────────────┘
               │
       ┌───────┴───────┐
       ▼               ▼
┌─────────────┐  ┌──────────────┐
│ Claude Code │  │   Obsidian   │
│  (MCP tool) │  │Smart Connect.│
└─────────────┘  └──────────────┘

Quickstart

1. Install Ollama and pull models

# Download Ollama from https://ollama.com
ollama pull qwen2.5:14b        # ~8GB — the LLM
ollama pull nomic-embed-text   # ~300MB — embeddings

2. Install LightRAG

pip install "lightrag-hku[api]"

3. Clone and configure

git clone https://github.com/Ricardo-Kaminski/local-rag
cd local-rag
cp config.example.yaml config.yaml
# Edit config.yaml with your paths

4. Start the stack

Windows:

start-rag.bat

Linux/macOS:

./start-rag.sh

5. Run initial ingestion

conda activate local-rag
python ingest.py

6. Configure Claude Code MCP

Add to your Claude Code settings.json (~/.claude/settings.json):

"mcpServers": {
  "lightrag": {
    "command": "python",
    "args": ["C:/path/to/local-rag/mcp_server.py"]
  }
}

Now use query_rag, insert_document, and rag_health directly in Claude Code.


Install via pip

pip install local-rag-stack

After installation, use the local-rag CLI:

local-rag ingest          # index all documents once
local-rag watch           # continuous indexing daemon
local-rag start           # start LightRAG server + watcher
local-rag mcp             # start MCP server (for testing)

Configure Claude Code to use the MCP server (add to ~/.claude/settings.json):

"mcpServers": {
  "lightrag": {
    "command": "local-rag",
    "args": ["mcp"]
  }
}

Claude Code Plugin

Install directly from Claude Code:

/plugin install local-rag

MCP Tools (7 total)

Tool Description
query_rag(question, mode?) Query the knowledge base. Modes: local, global, hybrid (default)
insert_document(path) Index a specific file by path
rag_health() Check if LightRAG server is running
list_sources() List configured sources with file counts
get_indexed_documents(limit?) List documents already indexed
delete_document(doc_id) Remove a document from the knowledge base
get_graph_labels() List entity types in the knowledge graph

Using Claude API as LLM (optional)

Use Claude instead of Ollama for RAG responses. In config.yaml:

llm:
  provider: "claude"
  model: "claude-opus-4-6"
  api_key: ""   # or set ANTHROPIC_API_KEY env var

Note: Ollama is still required for embeddings (nomic-embed-text). Only the response LLM can be replaced with Claude.


Guides by Use Case


Hardware Requirements

Component Minimum Recommended
RAM 8 GB 16 GB
GPU VRAM 0 (CPU only, slow) 8 GB (qwen2.5:7b) / 12 GB (qwen2.5:14b)
Disk 10 GB 20 GB

Tested on Windows 11 with RTX 3060 12GB. CPU inference works but is significantly slower.


Just want the MCP server?

If you already have a LightRAG instance running, install the standalone MCP package:

pip install lightrag-mcp

See lightrag-mcp for details.


Contributing

See CONTRIBUTING.md. Bug reports and feature requests welcome via GitHub Issues.

License

MIT — see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

local_rag_stack-0.1.0.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

local_rag_stack-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file local_rag_stack-0.1.0.tar.gz.

File metadata

  • Download URL: local_rag_stack-0.1.0.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for local_rag_stack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4215a75533ef8eb68a264378f63698e9ad3612fcfb5e2b63422a21fdee89a127
MD5 19614660fbb53178143714014fe7004a
BLAKE2b-256 366bafb8e283be0d381ab47e0b9c734087699c8ebbc321867309f48b4105259a

See more details on using hashes here.

Provenance

The following attestation bundles were made for local_rag_stack-0.1.0.tar.gz:

Publisher: publish.yml on Ricardo-Kaminski/local-rag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file local_rag_stack-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for local_rag_stack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6a8cf01f2bc8213a1d752f1c24d695d70ada09de8587b9e9469bae391b435b3
MD5 b89aba49d3fa3f6e7f9e0330221d2a9f
BLAKE2b-256 b7dbe3c5a7dc0440415d916e28ccb9038011997b3a08fa9591cc9c36b183caa9

See more details on using hashes here.

Provenance

The following attestation bundles were made for local_rag_stack-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Ricardo-Kaminski/local-rag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page