DevRag

by tomohiro-owada

Not rated yet

About

Free local RAG for Claude Code - Save tokens & time with vector search. Indexes markdown docs and finds relevant info without reading entire files (40x fewer tokens, 15x faster).

Explore

Setup

Install DevRag in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/tomohiro-owada/devrag

Follow the installation instructions in the repository README, then restart your MCP client.

Free Local RAG for Claude Code - Save Tokens & Time

DevRag is a lightweight RAG (Retrieval-Augmented Generation) system designed specifically for developers using Claude Code. Stop wasting tokens by reading entire documents - let vector search find exactly what you need.

When using Claude Code, reading documents with the Read tool consumes massive amounts of tokens:

- ❌Wasting Context: Reading entire docs every time (3,000+ tokens per file)
- ❌Poor Searchability: Claude doesn't know which file contains what
- ❌Repetitive: Same documents read multiple times across sessions

- ✅40x Less Tokens: Vector search retrieves only relevant chunks (~200 tokens)
- ✅15x Faster: Search in 100ms vs 30 seconds of reading
- ✅Auto-Discovery: Claude Code finds documents without knowing file names

- 🤖Simple RAG- Retrieval-Augmented Generation for Claude Code
- 📝Markdown Support- Auto-indexes .md files
- 🔍Semantic Search- Natural language queries like "JWT authentication method"
- 🚀Single Binary- No Python, models auto-download on first run
- 💻CLI & MCP- Use as MCP server or standalone CLI commands
- 🖥️Cross-Platform- macOS / Linux / Windows
- ⚡Fast- Auto GPU/CPU detection, incremental sync
- 🌐Multilingual- Supports 100+ languages including Japanese & English

Get the appropriate binary fromReleases:

tar -xzf devrag-.tar.gz chmod +x devrag- sudo mv devrag- /usr/local/bin/

Note: macOS releases includelibonnxruntime.dylibfor CoreML GPU acceleration. Keep it in the same directory as thedevragbinary.

- Extract the zip file
- Place in your preferred location (e.g.,C:\Program Files\devrag\)

{ "mcpServers": { "devrag": { "type": "stdio", "command": "/usr/local/bin/devrag" } } }
{ "mcpServers": { "devrag": { "type": "stdio", "command": "/usr/local/bin/devrag", "args": ["--config", "/path/to/custom-config.json"] } } }
mkdir documents cp your-notes.md documents/

That's it! Documents are automatically indexed on startup.

"Search for JWT authentication methods"
{ "document_patterns": [ "./documents", "./notes//.md", "./projects/backend//.md" ], "db_path": "./vectors.db", "chunk_size": 500, "search_top_k": 5, "compute": { "device": "auto", "fallback_to_cpu": true }, "model": { "name": "multilingual-e5-small", "dimensions": 384 } }

- document_patterns: Array of document paths and glob patterns

- Supports directory paths:"./documents"
- Supports glob patterns:"./docs//
.md"(recursive)
- Multiple patterns: Index files from different locations
-
Note: Olddocuments_dirfield is still supported (automatically migrated)

- --config <path>: Specify a custom configuration file path (default:config.json)

devrag --config /path/to/custom-config.json

- Running multiple instances with different configurations
- Testing different models or chunk sizes
- Maintaining separate dev/test/prod configurations

{ "document_patterns": [ "./documents", // All .md files in documents/ "./notes//.md", // Recursive search in notes/ "./projects//docs/.md", // docs/ in each project "/path/to/external/docs" // Absolute path ] }

DevRag provides the following tools via Model Context Protocol:

Perform semantic vector search with optional filtering

- query(string, required): Search query in natural language
- top_k(number, optional): Maximum number of results (default: 5)
- directory(string, optional): Filter to specific directory (e.g., "docs/api")
- file_pattern(string, optional): Glob pattern for filename (e.g., "api-
.md", ".md")

Returns:Array of search results with filename, chunk content, and similarity score

// Basic search search(query: "JWT authentication") // Search only in docs/api directory search(query: "user endpoints", directory: "docs/api") // Search only files matching pattern search(query: "deployment", file_pattern: "guide-.md") // Combined filters search(query: "authentication", directory: "docs/api", file_pattern: "auth.md")

- filepath(string): Path to the file to index

Returns:Document list with filenames and timestamps

- filepath(string): Path to the file to delete

- filepath(string): Path to the file to re-index

DevRag can also be used as a standalone CLI tool. All MCP tools are available as CLI commands.

# Start MCP server (default) devrag devrag serve # Search documents devrag search "JWT authentication" devrag search "deployment" --top-k 10 --directory docs/api # Index files devrag index ./docs/api-spec.md devrag index-code --directory ./src # List indexed documents devrag list devrag list --fields filename # Delete / Reindex devrag delete ./docs/old-spec.md --dry-run devrag reindex ./docs/updated-spec.md # Code symbol relations devrag search-relations handleAuth --type calls # Build dictionary (Japanese-English mapping) devrag build-dictionary # Show CLI schema (machine-readable) devrag schema

All commands output JSON by default. Use--output textfor human-readable output.

# JSON (default, suitable for scripts and AI agents) devrag search "authentication" # Text (human-readable) devrag search "authentication" --output text

CLI commands also accept MCP tool names with underscores:

devrag index_markdown ./docs/api.md # same as: devrag index devrag list_documents # same as: devrag list devrag delete_document ./docs/old.md # same as: devrag delete devrag reindex_document ./docs/api.md # same as: devrag reindex

Flags must be placedbeforepositional arguments:

# Correct devrag delete --dry-run file.md # Incorrect (--dry-run is ignored) devrag delete file.md --dry-run

Perfect for teams with large documentation repositories:
- Manage docs in Git: Normal Git workflow
- Each developer runs DevRag: Local setup on each machine
- Search via Claude Code: Everyone can search all docs
- Auto-sync:git pullautomatically updates the index

Configure for your project's docs directory:

{ "document_patterns": [ "./docs", "./api-docs//.md", "./wiki//.md" ], "db_path": "./.devrag/vectors.db" }

Environment: MacBook Pro M2, 100 files (1MB total)

# All tests go test ./... # Specific packages go test ./internal/config -v go test ./internal/indexer -v go test ./internal/embedder -v go test ./internal/vectordb -v # Integration tests go test . -v -run TestEndToEnd
# Using build script ./build.sh # Direct build go build -o devrag cmd/main.go # Cross-platform release build ./scripts/build-release.sh
# Create version tag git tag v1.0.1 # Push tag git push origin v1.0.1

- Builds for all platforms
- Creates GitHub Release
- Uploads binaries
- Generates checksums

devrag/ ├── cmd/ │ └── main.go # Entry point ├── internal/ │ ├── cli/ # CLI commands │ ├── config/ # Configuration │ ├── embedder/ # Vector embeddings │ ├── indexer/ # Indexing logic │ ├── mcp/ # MCP server │ └── vectordb/ # Vector database ├── models/ # ONNX models ├── build.sh # Build script └── integration_test.go # Integration tests

Cause: Internet connection or Hugging Face server issues
- Check internet connection
- For proxy environments:

export HTTP_PROXY=http://your-proxy:port export HTTPS_PROXY=http://your-proxy:port

On macOS, DevRag uses Apple CoreML for GPU/Neural Engine acceleration. Requirements:

- libonnxruntime.dylibmust be in the same directory as thedevragbinary
- macOS releases from GitHub include this file automatically

If CoreML is not available, DevRag falls back to CPU automatically. To tune performance:

# Adjust CPU thread count (default: 4) DEVRAG_THREADS=4 devrag
{ "compute": { "device": "cpu", "fallback_to_cpu": true } }

- Ensure Go 1.21+ is installed (for building)
- Check CGO is enabled:go env CGO_ENABLED
- Verify dependencies are installed
- Internet required for first run (model download)

- Adjustchunk_size(default: 500)
- Rebuild index (delete vectors.db and restart)

- GPU mode loads model into VRAM
- Switch to CPU mode for lower memory usage

- Go 1.21+ (for building from source)
- CGO enabled (for sqlite-vec)
- macOS, Linux, or Windows

- Embedding Model:intfloat/multilingual-e5-small
- Vector Database:
sqlite-vec
- MCP Protocol:
Model Context Protocol
- ONNX Runtime:
onnxruntime-go

Special thanks to all contributors who helped improve DevRag:

- @badri- Multiple document paths with glob patterns (#2),--configCLI flag (#3)
-
@io41- Project cleanup and documentation improvements (#4)

Your contributions make DevRag better for everyone!

DevRagは、Claude Codeを使う開発者のための軽量RAG(Retrieval-Augmented Generation)システムです。ドキュメント全体を読み込んでトークンを無駄にするのをやめて、ベクトル検索で必要な情報だけを取得しましょう。

- ❌コンテキストの浪費: 毎回ドキュメント全体を読み込み(1ファイル3,000トークン以上)
- ❌検索性の欠如: Claudeはどのファイルに何が書いてあるか知らない
- ❌繰り返し: セッションをまたいで同じドキュメントを何度も読む

- ✅トークン消費1/40: ベクトル検索で必要な部分だけ取得(約200トークン)
- ✅15倍高速: 検索100ms vs 読み込み30秒
- ✅自動発見: ファイル名を知らなくてもClaude Codeが見つける

- 🤖簡易RAG- Claude Code用の検索拡張生成
- 📝マークダウン対応- .mdファイルを自動インデックス化
- 🔍意味検索- 「JWTの認証方法」のような自然言語クエリ
- 🚀ワンバイナリー- Python不要、モデルは初回起動時に自動ダウンロード
- 💻CLI & MCP- MCPサーバーとしても、CLIコマンドとしても使える
- 🖥️クロスプラットフォーム- macOS / Linux / Windows
- ⚡高速- GPU/CPU自動検出、差分同期
- 🌐多言語- 日本語・英語を含む100以上の言語対応

tar -xzf devrag-.tar.gz chmod +x devrag- sudo mv devrag- /usr/local/bin/

注意: macOS版リリースにはCoreML GPU高速化用のlibonnxruntime.dylibが含まれています。devragバイナリと同じディレクトリに配置してください。

- zipファイルを解凍
- 任意の場所に配置(例:C:\Program Files\devrag\)

{ "mcpServers": { "devrag": { "type": "stdio", "command": "/usr/local/bin/devrag" } } }
{ "mcpServers": { "devrag": { "type": "stdio", "command": "/usr/local/bin/devrag", "args": ["--config", "/path/to/custom-config.json"] } } }
mkdir documents cp your-notes.md documents/
{ "document_patterns": [ "./documents", "./notes//.md", "./projects/backend//.md" ], "db_path": "./vectors.db", "chunk_size": 500, "search_top_k": 5, "compute": { "device": "auto", "fallback_to_cpu": true }, "model": { "name": "multilingual-e5-small", "dimensions": 384 } }

- document_patterns: ドキュメントのパスとglobパターンの配列

- ディレクトリパス対応:"./documents"
- globパターン対応:"./docs//.md"(再帰的)
- 複数パターン: 異なる場所からファイルをインデックス化
-
注意: 旧形式のdocuments_dirもサポート(自動的に移行)

- --config <path>: カスタム設定ファイルのパスを指定(デフォルト:config.json)

devrag --config /path/to/custom-config.json

- 異なる設定で複数のインスタンスを実行
- 異なるモデルやチャンクサイズをテスト
- 開発/テスト/本番環境の設定を分離

{ "document_patterns": [ "./documents", // documents/内の全.mdファイル "./notes//.md", // notes/内を再帰的に検索 "./projects//docs/.md", // 各プロジェクトのdocs/ "/path/to/external/docs" // 絶対パス ] }
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.