feat: add lightrag-mcp MCP server + agent tooling
- Add AGENTS.md with repo guidelines - Add lightrag-mcp: FastMCP server exposing insert_documents() + query_documents() to LLM agents via stdio transport, talks to LightRAG REST API - Add scripts/patch-vllm-cpu.py for CPU inference patching - Add .env.vllm for vLLM configuration - Update flake.nix with expanded dev shell - Update .env.lightrag - Remove CLAUDE.md (replaced by AGENTS.md)
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# RAGS
|
||||
|
||||
Private learning tool. Ingest study materials → knowledge graph → query → export Anki flashcards.
|
||||
|
||||
Two systems:
|
||||
- **LightRAG** (`lightrag/`) — graph-based RAG server (primary interface)
|
||||
- **Graphiti** (`graphiti/`) — temporal knowledge graph library (Python library only, needs Neo4j)
|
||||
|
||||
## Quick Start
|
||||
|
||||
```sh
|
||||
# Ollama must be running first on :11434 with:
|
||||
# qwen3:0.6b (LLM)
|
||||
# qwen3-embedding:0.6b (embeddings)
|
||||
|
||||
# Start LightRAG only (LLM + embeddings handled externally by Ollama)
|
||||
nix run .#start
|
||||
# → http://localhost:9621/webui (React frontend)
|
||||
# → http://localhost:9621/docs (Swagger API)
|
||||
|
||||
# Graphiti needs Neo4j running first
|
||||
nix run .#neo4j-start # separate terminal
|
||||
nix develop .#graphiti
|
||||
```
|
||||
|
||||
**Always enter via `nix develop` from repo root** — never activate venvs directly. The shellHook sources `.env.lightrag` and sets `LD_LIBRARY_PATH`.
|
||||
|
||||
## Configuration
|
||||
|
||||
### `.env.lightrag`
|
||||
**Restart LightRAG after changes.**
|
||||
|
||||
| Var | Value |
|
||||
|-----|-------|
|
||||
| `LLM_BINDING` | `ollama` |
|
||||
| `LLM_MODEL` | `qwen3:0.6b` |
|
||||
| `LLM_BINDING_HOST` | `http://localhost:11434` |
|
||||
| `EMBEDDING_BINDING` | `ollama` |
|
||||
| `EMBEDDING_MODEL` | `qwen3-embedding:0.6b` |
|
||||
| `EMBEDDING_DIM` | `1024` |
|
||||
|
||||
Verify embedding works:
|
||||
```sh
|
||||
curl -s http://localhost:11434/api/embed \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model":"qwen3-embedding:0.6b","input":"test"}'
|
||||
```
|
||||
|
||||
**Critical:** If `EMBEDDING_DIM` changes, delete `rag_storage/` before restarting — old vectors are incompatible.
|
||||
|
||||
## LightRAG Storage
|
||||
File-based by default (`JsonKVStorage`, `NanoVectorDBStorage`, `NetworkXStorage`). All data in `rag_storage/` (gitignored). Safe to delete to reset.
|
||||
|
||||
## Nix / NixOS Notes
|
||||
- `UV_PYTHON` pinned to nix-provided Python 3.12 (system has 3.14)
|
||||
- `LD_LIBRARY_PATH` set in shellHook for native wheels
|
||||
- LightRAG installs with `--extra api --extra offline-llm`
|
||||
- WebUI (React/Bun) built on first shell entry if `lightrag/lightrag/api/webui/` missing
|
||||
|
||||
## Known Issue: Pipeline Stuck
|
||||
|
||||
After config changes, pipeline may show `busy: true` with pending async locks. Symptoms:
|
||||
- `GET /documents/pipeline_status` returns `busy: true`, `request_pending: true`
|
||||
- New inserts stay at `status: pending`
|
||||
|
||||
Fix: delete `rag_storage/`, restart. Or `POST /documents/cancel_pipeline`.
|
||||
Reference in New Issue
Block a user