loading…
Search for a command to run...
loading…
Lightweight local RAG MCP server for semantic vector search over markdown documents. Reduces token consumption by 40x with sqlite-vec and multilingual-e5-small
Lightweight local RAG MCP server for semantic vector search over markdown documents. Reduces token consumption by 40x with sqlite-vec and multilingual-e5-small embeddings. Supports filtered search by directory and filename patterns.
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:
With DevRag:
Get the appropriate binary from Releases:
| Platform | File |
|---|---|
| macOS (Apple Silicon) | devrag-macos-apple-silicon.tar.gz |
| macOS (Intel) | devrag-macos-intel.tar.gz |
| Linux (x64) | devrag-linux-x64.tar.gz |
| Linux (ARM64) | devrag-linux-arm64.tar.gz |
| Windows (x64) | devrag-windows-x64.zip |
macOS/Linux:
tar -xzf devrag-*.tar.gz
chmod +x devrag-*
sudo mv devrag-* /usr/local/bin/
Note: macOS releases include
libonnxruntime.dylibfor CoreML GPU acceleration. Keep it in the same directory as thedevragbinary.
Windows:
C:\Program Files\devrag\)Add to ~/.claude.json or .mcp.json:
{
"mcpServers": {
"devrag": {
"type": "stdio",
"command": "/usr/local/bin/devrag"
}
}
}
Using a custom config file:
{
"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.
In Claude Code:
"Search for JWT authentication methods"
Create config.json:
{
"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"./documents""./docs/**/*.md" (recursive)documents_dir field is still supported (automatically migrated)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--config <path>: Specify a custom configuration file path (default: config.json)Example:
devrag --config /path/to/custom-config.json
This is useful for:
{
"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
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:
// 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")
Index a markdown file
Parameters:
filepath (string): Path to the file to indexList all indexed documents
Returns: Document list with filenames and timestamps
Remove a document from the index
Parameters:
filepath (string): Path to the file to deleteRe-index a document
Parameters:
filepath (string): Path to the file to re-indexDevRag 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 text for 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 placed before positional 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:
git pull automatically updates the indexConfigure 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)
| Operation | Time | Tokens |
|---|---|---|
| Startup | 2.3s | - |
| Indexing | 8.5s | - |
| Search (1 query) | 95ms | ~300 |
| Traditional Read | 25s | ~12,000 |
260x faster search, 40x fewer tokens
# 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
GitHub Actions automatically:
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
Solutions:
export HTTP_PROXY=http://your-proxy:port
export HTTPS_PROXY=http://your-proxy:port
models/DOWNLOAD.md)On macOS, DevRag uses Apple CoreML for GPU/Neural Engine acceleration. Requirements:
libonnxruntime.dylib must be in the same directory as the devrag binaryIf CoreML is not available, DevRag falls back to CPU automatically. To tune performance:
# Adjust CPU thread count (default: 4)
DEVRAG_THREADS=4 devrag
To explicitly force CPU mode:
{
"compute": {
"device": "cpu",
"fallback_to_cpu": true
}
}
go env CGO_ENABLEDchunk_size (default: 500)MIT License
Issues and Pull Requests are welcome!
Special thanks to all contributors who helped improve DevRag:
--config CLI flag (#3)Your contributions make DevRag better for everyone!
Claude Code用の無料ローカルRAG - トークン&時間を節約
DevRagは、Claude Codeを使う開発者のための軽量RAG(Retrieval-Augmented Generation)システムです。ドキュメント全体を読み込んでトークンを無駄にするのをやめて、ベクトル検索で必要な情報だけを取得しましょう。
Claude Codeでドキュメントを読み込むと、大量のトークンを消費します:
DevRagを使えば:
Releasesから環境に合ったファイルをダウンロード:
| プラットフォーム | ファイル |
|---|---|
| macOS (Apple Silicon) | devrag-macos-apple-silicon.tar.gz |
| macOS (Intel) | devrag-macos-intel.tar.gz |
| Linux (x64) | devrag-linux-x64.tar.gz |
| Linux (ARM64) | devrag-linux-arm64.tar.gz |
| Windows (x64) | devrag-windows-x64.zip |
macOS/Linux:
tar -xzf devrag-*.tar.gz
chmod +x devrag-*
sudo mv devrag-* /usr/local/bin/
注意: macOS版リリースにはCoreML GPU高速化用の
libonnxruntime.dylibが含まれています。devragバイナリと同じディレクトリに配置してください。
Windows:
C:\Program Files\devrag\)~/.claude.json または .mcp.json に追加:
{
"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/
これで完了!起動時に自動的にインデックス化されます。
Claude Codeで:
「JWTの認証方法について検索して」
config.jsonを作成:
{
"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""./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)使用例:
devrag --config /path/to/custom-config.json
これは以下の用途で便利です:
{
"document_patterns": [
"./documents", // documents/内の全.mdファイル
"./notes/**/*.md", // notes/内を再帰的に検索
"./projects/*/docs/*.md", // 各プロジェクトのdocs/
"/path/to/external/docs" // 絶対パス
]
}
Model Context Protocolを通じて以下のツールを提供:
フィルター機能付き意味ベクトル検索を実行
パラメータ:
query (string, 必須): 自然言語の検索クエリtop_k (number, 任意): 最大結果数(デフォルト: 5)directory (string, 任意): 特定ディレクトリに絞り込み(例: "docs/api")file_pattern (string, 任意): ファイル名のglobパターン(例: "api-.md", ".md")戻り値: ファイル名、チャンク内容、類似度スコアを含む検索結果の配列
使用例:
// 基本検索
search(query: "JWT認証")
// docs/apiディレクトリ内のみ検索
search(query: "ユーザーエンドポイント", directory: "docs/api")
// パターンに一致するファイルのみ検索
search(query: "デプロイ", file_pattern: "guide-*.md")
// フィルターの組み合わせ
search(query: "認証", directory: "docs/api", file_pattern: "auth*.md")
マークダウンファイルをインデックス化
パラメータ:
filepath (string): インデックス化するファイルのパスインデックス化されたドキュメントの一覧を取得
戻り値: ファイル名とタイムスタンプを含むドキュメントリスト
ドキュメントをインデックスから削除
パラメータ:
filepath (string): 削除するファイルのパスドキュメントを再インデックス化
パラメータ:
filepath (string): 再インデックス化するファイルのパスDevRagはスタンドアロンのCLIツールとしても使用できます。すべてのMCPツールがCLIコマンドとして利用可能です。
# MCPサーバーを起動(デフォルト)
devrag
devrag serve
# ドキュメントを検索
devrag search "JWT認証"
devrag search "デプロイ" --top-k 10 --directory docs/api
# ファイルをインデックス化
devrag index ./docs/api-spec.md
devrag index-code --directory ./src
# インデックス済みドキュメント一覧
devrag list
devrag list --fields filename
# 削除 / 再インデックス
devrag delete ./docs/old-spec.md --dry-run
devrag reindex ./docs/updated-spec.md
# コードシンボル関係検索
devrag search-relations handleAuth --type calls
# 辞書ビルド(日本語→英語マッピング)
devrag build-dictionary
# CLIスキーマ表示(機械可読)
devrag schema
全コマンドはデフォルトでJSONを出力します。--output textで人間が読みやすい形式になります。
# JSON(デフォルト、スクリプトやAIエージェント向け)
devrag search "認証"
# テキスト(人間向け)
devrag search "認証" --output text
CLIコマンドはアンダースコア形式のMCPツール名でも動作します:
devrag index_markdown ./docs/api.md # devrag index と同じ
devrag list_documents # devrag list と同じ
devrag delete_document ./docs/old.md # devrag delete と同じ
devrag reindex_document ./docs/api.md # devrag reindex と同じ
フラグは位置引数の前に置く必要があります:
# 正しい
devrag delete --dry-run file.md
# 誤り(--dry-runが無視される)
devrag delete file.md --dry-run
大量のドキュメントがあるチームに最適:
git pullでインデックスを自動更新プロジェクトのdocsディレクトリ用に設定:
{
"document_patterns": [
"./docs",
"./api-docs/**/*.md",
"./wiki/**/*.md"
],
"db_path": "./.devrag/vectors.db"
}
環境: MacBook Pro M2, 100ファイル (合計1MB)
| 操作 | 時間 | トークン |
|---|---|---|
| 起動 | 2.3秒 | - |
| インデックス化 | 8.5秒 | - |
| 検索 (1クエリ) | 95ms | ~300 |
| 従来のRead | 25秒 | ~12,000 |
検索は260倍速、トークンは40分の1
# すべてのテスト
go test ./...
# 特定のパッケージ
go test ./internal/config -v
go test ./internal/indexer -v
go test ./internal/embedder -v
go test ./internal/vectordb -v
# 統合テスト
go test . -v -run TestEndToEnd
# ビルドスクリプト使用
./build.sh
# 直接ビルド
go build -o devrag cmd/main.go
# クロスプラットフォームリリースビルド
./scripts/build-release.sh
# バージョンタグを作成
git tag v1.0.1
# タグをプッシュ
git push origin v1.0.1
GitHub Actionsが自動的に:
devrag/
├── cmd/
│ └── main.go # エントリーポイント
├── internal/
│ ├── cli/ # CLIコマンド
│ ├── config/ # 設定管理
│ ├── embedder/ # ベクトル埋め込み
│ ├── indexer/ # インデックス処理
│ ├── mcp/ # MCPサーバー
│ └── vectordb/ # ベクトルDB
├── models/ # ONNXモデル
├── build.sh # ビルドスクリプト
└── integration_test.go # 統合テスト
原因: インターネット接続またはHugging Faceサーバーの問題
解決方法:
export HTTP_PROXY=http://your-proxy:port
export HTTPS_PROXY=http://your-proxy:port
models/DOWNLOAD.md参照)macOSではApple CoreMLによるGPU/Neural Engine高速化を使用します。条件:
libonnxruntime.dylibがdevragバイナリと同じディレクトリにあることCoreMLが利用できない場合は自動的にCPUにフォールバックします。パフォーマンス調整:
# CPUスレッド数の変更(デフォルト: 4)
DEVRAG_THREADS=4 devrag
明示的にCPUモードを指定する場合:
{
"compute": {
"device": "cpu",
"fallback_to_cpu": true
}
}
go env CGO_ENABLEDchunk_sizeを調整(デフォルト: 500)MIT License
IssuesとPull Requestsを歓迎します!
DevRagの改善に貢献してくださった皆様に感謝します:
皆様の貢献がDevRagをより良くしています!
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"tomohiro-owada-devrag": {
"command": "npx",
"args": []
}
}
}Query your database in natural language
Read-only database access with schema inspection.
Interact with Redis key-value stores.
Database interaction and business intelligence capabilities.