
Devrag
io.github.tomohiro-owada由 GitHub 帳號 tomohiro-owada 發布v1.2.0更新於 Oct 24, 2026
Lightweight local RAG MCP server. 40x token reduction.
概覽
本機 RAG 伺服器,為 Markdown 文件建立索引,讓助理以語意向量檢索相關內容以節省 token。
- 可以做什麼
- 以自然語言查詢對已索引文件做語意檢索,可依目錄或檔名萬用字元篩選
- 索引 Markdown 檔案、重新索引已變更的檔案,或從索引中移除文件
- 列出所有已索引文件及其檔名與時間戳
- 啟動時依設定的路徑與萬用字元自動索引文件
- 透過獨立命令列以 JSON 或文字格式執行相同操作
- 適用情境
- 適合助理反覆整份讀取大量 Markdown 文件、希望只取回相關片段的場合。鎖定使用 Claude Code、並把筆記、API 文件或 wiki 放在 Git 中的開發者。
- 執行需求
- 以本機 stdio 程序執行;需下載 macOS、Linux 或 Windows 的預先編譯執行檔(或以 Go 1.21+ 並啟用 CGO 從原始碼建置)。設定檔需指定文件路徑、資料庫路徑、分塊大小與嵌入模型。首次執行需連網下載嵌入模型;未宣告任何 API 金鑰或帳號。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Devrag,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
DevRag
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.
Why DevRag?
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
With DevRag:
- ✅ 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
Features
- 🤖 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
Quick Start
1. Download Binary
Get the appropriate binary from Releases:
macOS/Linux:
Note: macOS releases include
libonnxruntime.dylibfor CoreML GPU acceleration. Keep it in the same directory as thedevragbinary.
Windows:
- Extract the zip file
- Place in your preferred location (e.g.,
C:\Program Files\devrag\)
2. Configure Claude Code
Add to ~/.claude.json or .mcp.json:
Using a custom config file:
3. Add Your Documents
That's it! Documents are automatically indexed on startup.
4. Search with Claude Code
In Claude Code:
Configuration
Create config.json:
Configuration Options
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: Old
documents_dirfield is still supported (automatically migrated)
- Supports directory paths:
db_path: Vector database file pathchunk_size: Document chunk size in characterssearch_top_k: Number of search results to returncompute.device: Compute device (auto,cpu,gpu)compute.fallback_to_cpu: Fallback to CPU if GPU unavailablemodel.name: Embedding model namemodel.dimensions: Vector dimensions
Command-Line Options
--config <path>: Specify a custom configuration file path (default:config.json)
Example:
This is useful for:
- Running multiple instances with different configurations
- Testing different models or chunk sizes
- Maintaining separate dev/test/prod configurations
Pattern Examples
MCP Tools
DevRag provides the following tools via Model Context Protocol:
search
Perform semantic vector search with optional filtering
Parameters:
query(string, required): Search query in natural languagetop_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
Examples:
index_markdown
Index a markdown file
Parameters:
filepath(string): Path to the file to index
list_documents
List all indexed documents
Returns: Document list with filenames and timestamps
delete_document
Remove a document from the index
Parameters:
filepath(string): Path to the file to delete
reindex_document
Re-index a document
Parameters:
filepath(string): Path to the file to re-index
CLI Usage
DevRag can also be used as a standalone CLI tool. All MCP tools are available as CLI commands.
Output Format
All commands output JSON by default. Use --output text for human-readable output.
MCP Tool Name Compatibility
CLI commands also accept MCP tool names with underscores:
Flag Syntax
Flags must be placed before positional arguments:
Team Development
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:
Performance
Environment: MacBook Pro M2, 100 files (1MB total)
260x faster search, 40x fewer tokens
Development
Run Tests
Build
Creating a Release
GitHub Actions automatically:
- Builds for all platforms
- Creates GitHub Release
- Uploads binaries
- Generates checksums
Project Structure
Troubleshooting
Model Download Fails
Cause: Internet connection or Hugging Face server issues
Solutions:
- Check internet connection
- For proxy environments:
- Manual download (see
models/DOWNLOAD.md) - Retry (incomplete files are auto-removed)
GPU / CoreML Not Working
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:
To explicitly force CPU mode:
Won't Start
- 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)
Unexpected Search Results
- Adjust
chunk_size(default: 500) - Rebuild index (delete vectors.db and restart)
High Memory Usage
- GPU mode loads model into VRAM
- Switch to CPU mode for lower memory usage
Requirements
- Go 1.21+ (for building from source)
- CGO enabled (for sqlite-vec)
- macOS, Linux, or Windows
License
MIT License
Credits
- Embedding Model: intfloat/multilingual-e5-small
- Vector Database: sqlite-vec
- MCP Protocol: Model Context Protocol
- ONNX Runtime: onnxruntime-go
Contributing
Issues and Pull Requests are welcome!
Contributors
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!
Author
日本語版
Claude Code用の無料ローカルRAG - トークン&時間を節約
DevRagは、Claude Codeを使う開発者のための軽量RAG(Retrieval-Augmented Generation)システムです。ドキュメント全体を読み込んでトークンを無駄にするのをやめて、ベクトル検索で必要な情報だけを取得しましょう。
なぜDevRagが必要か?
Claude Codeでドキュメントを読み込むと、大量のトークンを消費します:
- ❌ コンテキストの浪費: 毎回ドキュメント全体を読み込み(1ファイル3,000トークン以上)
- ❌ 検索性の欠如: Claudeはどのファイルに何が書いてあるか知らない
- ❌ 繰り返し: セッションをまたいで同じドキュメントを何度も読む
DevRagを使えば:
- ✅ トークン消費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以上の言語対応
クイックスタート
1. バイナリダウンロード
Releasesから環境に合ったファイルをダウンロード:
macOS/Linux:
注意: macOS版リリースにはCoreML GPU高速化用の
libonnxruntime.dylibが含まれています。devragバイナリと同じディレクトリに配置してください。
Windows:
- zipファイルを解凍
- 任意の場所に配置(例:
C:\Program Files\devrag\)
2. Claude Code設定
~/.claude.json または .mcp.json に追加:
カスタム設定ファイルを使用する場合:
3. ドキュメントを配置
これで完了!起動時に自動的にインデックス化されます。
4. Claude Codeで検索
Claude Codeで:
設定
config.jsonを作成:
設定項目
document_patterns: ドキュメントのパスとglobパターンの配列- ディレクトリパス対応:
"./documents" - globパターン対応:
"./docs/**/*.md"(再帰的) - 複数パターン: 異なる場所からファイルをインデックス化
- 注意: 旧形式の
documents_dirもサポート(自動的に移行)
- ディレクトリパス対応:
db_path: ベクトルデータベースのパスchunk_size: ドキュメントのチャンクサイズ(文字数)search_top_k: 検索結果の返却件数compute.device: 計算デバイス(auto,cpu,gpu)compute.fallback_to_cpu: GPU利用不可時にCPUにフォールバックmodel.name: 埋め込みモデル名model.dimensions: ベクトル次元数
コマンドラインオプション
--config <path>: カスタム設定ファイルのパスを指定(デフォルト:config.json)
使用例:
これは以下の用途で便利です:
- 異なる設定で複数のインスタンスを実行
- 異なるモデルやチャンクサイズをテスト
- 開発/テスト/本番環境の設定を分離
パターン例
MCPツール
Model Context Protocolを通じて以下のツールを提供:
search
フィルター機能付き意味ベクトル検索を実行
パラメータ:
query(string, 必須): 自然言語の検索クエリtop_k(number, 任意): 最大結果数(デフォルト: 5)directory(string, 任意): 特定ディレクトリに絞り込み(例: "docs/api")file_pattern(string, 任意): ファイル名のglobパターン(例: "api-.md", ".md")
戻り値: ファイル名、チャンク内容、類似度スコアを含む検索結果の配列
使用例:
index_markdown
マークダウンファイルをインデックス化
パラメータ:
filepath(string): インデックス化するファイルのパス
list_documents
インデックス化されたドキュメントの一覧を取得
戻り値: ファイル名とタイムスタンプを含むドキュメントリスト
delete_document
ドキュメントをインデックスから削除
パラメータ:
filepath(string): 削除するファイルのパス
reindex_document
ドキュメントを再インデックス化
パラメータ:
filepath(string): 再インデックス化するファイルのパス
CLI使用方法
DevRagはスタンドアロンのCLIツールとしても使用できます。すべてのMCPツールがCLIコマンドとして利用可能です。
出力形式
全コマンドはデフォルトでJSONを出力します。--output textで人間が読みやすい形式になります。
MCPツール名との互換性
CLIコマンドはアンダースコア形式のMCPツール名でも動作します:
フラグの構文
フラグは位置引数の前に置く必要があります:
チーム開発
大量のドキュメントがあるチームに最適:
- Gitでドキュメント管理: 通常のGitワークフロー
- 各開発者がDevRagを起動: 各マシンでローカルセットアップ
- Claude Codeで検索: 全員が全ドキュメントを検索可能
- 自動同期:
git pullでインデックスを自動更新
プロジェクトのdocsディレクトリ用に設定:
パフォーマンス
環境: MacBook Pro M2, 100ファイル (合計1MB)
検索は260倍速、トークンは40分の1
開発
テスト実行
ビルド
リリース作成
GitHub Actionsが自動的に:
- 全プラットフォーム向けにビルド
- GitHub Releaseを作成
- バイナリをアップロード
- チェックサムを生成
プロジェクト構造
トラブルシューティング
モデルのダウンロードに失敗
原因: インターネット接続またはHugging Faceサーバーの問題
解決方法:
- インターネット接続を確認
- プロキシ環境の場合:
- 手動ダウンロード(
models/DOWNLOAD.md参照) - 再試行(不完全なファイルは自動削除)
GPU / CoreMLが動作しない
macOSではApple CoreMLによるGPU/Neural Engine高速化を使用します。条件:
libonnxruntime.dylibがdevragバイナリと同じディレクトリにあること- GitHubのmacOS版リリースにはこのファイルが含まれています
CoreMLが利用できない場合は自動的にCPUにフォールバックします。パフォーマンス調整:
明示的にCPUモードを指定する場合:
起動しない
- Go 1.21+がインストールされているか確認(ソースからビルドする場合)
- CGOが有効か確認:
go env CGO_ENABLED - 依存関係がインストールされているか確認
- 初回起動時はインターネット接続が必要(モデルダウンロード)
検索結果が期待と異なる
chunk_sizeを調整(デフォルト: 500)- インデックスを再構築(vectors.dbを削除して再起動)
メモリ使用量が多い
- GPUモードではモデルがVRAMにロード
- CPUモードに切り替えるとメモリ使用量が減少
必要要件
- Go 1.21+(ソースからビルドする場合)
- CGO有効(sqlite-vecのため)
- macOS, Linux, または Windows
ライセンス
MIT License
クレジット
- 埋め込みモデル: intfloat/multilingual-e5-small
- ベクトルデータベース: sqlite-vec
- MCPプロトコル: Model Context Protocol
- ONNX Runtime: onnxruntime-go
コントリビューション
IssuesとPull Requestsを歓迎します!
コントリビューター
DevRagの改善に貢献してくださった皆様に感謝します:
皆様の貢献がDevRagをより良くしています!
作者
來源:README.md,提交 288ad59
工具
0版本歷史
1- v1.2.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。