Free, Open Source, Local / Offline Capable, Container-Free Semantic Search For Your Codebase
VibeRAG is fully local, offline capable MCP server for local codebase search.
- Intent-routed codebase search (definitions/files/blocks/usages)
- Hybrid retrieval (full-text + vector search)
- Explainable results with stable follow-ups (open spans, get symbols, find usages)
VibeRAG automatically indexes your codebase into a local container-free vector database (lancedb). Every time you make a change, the indexes are automatically updated.
npm install -g viberag# Initialize in your project
cd your-project
viberag
# Run the initialization wizard to configure embeddings, run initial indexing, and automatically configure MCP server integration.
/init
# In addition to allowing Agents to search via the MCP server,
# you can search yourself via the CLI.
/search authentication handlerWhen using a coding agent like Claude Code, add use viberag to your prompt.
────────────────────────────────────────────────────────────────────
> How is authentication handled in this repo? use viberag
────────────────────────────────────────────────────────────────────Tip: include "
use viberag" in your prompt to ensure your agent will use viberag's codebase search features. Most agents will select MCP tools as appropriate, but sometimes they need a little help with explicit prompting.
- CLI based setup - CLI commands and wizards for setup, editor integration, and configuration
- Agent-first search - Find definitions, entry files, and relevant blocks (not just “chunks”)
- Flexible embeddings - Local model (offline, free) or cloud providers (Gemini, Mistral, OpenAI)
- MCP server - Works with Claude Code, Cursor, VS Code Copilot, and more
- Automatic incremental indexing - Watches for file changes (respects
.gitignore+.viberagignore) and reindexes only what has changed in real time - Cancelable indexing - Supports
/canceland clear status reporting via/status - Multi-language support - TypeScript, JavaScript, Python, Go, Rust, and more
- Blazing fast - The data storage and search functionality is local on your machine, meaning the full power of your machine can churn through massive amounts of data and execute complex search queries in milliseconds.
Your coding agent would normally use Search / Grep / Find and guess search terms that are relevant. VibeRAG indexes the codebase into a local vector database (based on lancedb) and can use semantic search to find all relevant code snippets even if the search terms are not exact.
When searching for "authentication", VibeRAG will find all code snippets that are relevant to authentication, such as "login", "logout", "register", and names of functions and classes like AuthDependency, APIKeyCache, etc.
This ensures comprehensive search of your codebase so you don't miss important files and features that are relevant to your changes or refactor.
Semantic search is especially useful in monorepos, where you may be trying to understand how different parts of the codebase interact with each other. Viberag can find all the pieces with fewer searches, fewer tokens used, and a shorter amount of time spent searching.
All options store embeddings and indexed data on your local machine
-
Local: You can use a locally run embedding model (Qwen3-Embedding-0.6B) so that nothing leaves your machine. This has a smaller vocabulary and is only recommended for privacy and offline concerns.
-
Recommended: API generated embeddings from Gemini, OpenAI, and Mistral are recommended for the largest vocabulary and highest quality semantic meaning.
- These embeddings are very affordable at ~10 - 15 cents per million tokens.
- A typical codebase can be indexed for pennies
VibeRAG includes an MCP server that integrates with AI coding tools.
Run /mcp-setup in the VibeRAG CLI for interactive setup. This wizard will attempt to automatically configure your coding agents / editors with viberags MCP server settings.
# Start viberag
$ viberag
# Run the setup wizard (after having initialized with /init)
$ /mcp-setup
# Automatic configuration wizard
╭───────────────────────────────────────────────────────────────╮
│ MCP Setup Wizard │
│ │
│ Select AI coding tool(s) to configure: │
│ (Space to toggle, Enter to confirm) │
│ │
│ > [x] Claude Code (auto-setup) │
│ [ ] Cursor (auto-setup) │
│ [ ] Gemini CLI (global config) │
│ [ ] JetBrains IDEs (manual setup) │
│ [ ] OpenAI Codex (global config) │
│ [ ] OpenCode (global config) │
│ [ ] Roo Code (auto-setup) │
│ [ ] VS Code Copilot (auto-setup) │
│ [ ] Windsurf (global config) │
│ [ ] Zed (global config) │
│ │
│ 1 selected | ↑/↓ move, Space toggle, Enter confirm, Esc cancel│
╰───────────────────────────────────────────────────────────────╯The wizard can auto-configure project-level configs and merge into global configs.
The following sections describe manual MCP server setup configurations for various editors and agents.
Claude Code
CLI Command:
claude mcp add viberag -- npx viberag-mcpTool Search: Claude Code supports MCP Tool Search (beta) to discover MCP tools on-demand when many tools are installed. It is enabled by default; to force-enable set
ENABLE_TOOL_SEARCH=truewhen launchingclaude.
Global Config: ~/.claude.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Project Config: .mcp.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Verify: Run /mcp in Claude Code, look for "viberag: connected"
Cursor
Global Config: ~/.cursor/mcp.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Project Config: .cursor/mcp.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Verify: Settings → Cursor Settings → MCP, verify "viberag" shows with toggle enabled
Gemini CLI
CLI Command:
gemini mcp add viberag -- npx viberag-mcpGlobal Config: ~/.gemini/settings.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Project Config: .gemini/settings.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Verify: Run /mcp in Gemini CLI, look for "viberag" in server list
JetBrains IDEs
UI Setup:
- Open Settings → Tools → AI Assistant → MCP
- Click "Add Server"
- Set name:
viberag - Set command:
npx - Set args:
viberag-mcp
Verify: Settings → Tools → AI Assistant → MCP, verify "viberag" shows green in Status column
OpenAI Codex
CLI Command:
codex mcp add viberag -- npx -y viberag-mcpGlobal Config: ~/.codex/config.toml
[mcp_servers.viberag]
command = "npx"
args = ["-y", "viberag-mcp"]Note: The
-yflag is required for npx to auto-confirm package installation
Verify: Run /mcp in Codex TUI, look for "viberag" in server list
OpenCode
Global Config: ~/.config/opencode/opencode.json (Linux/macOS) or %APPDATA%/opencode/opencode.json (Windows)
{
"mcp": {
"viberag": {
"type": "local",
"command": ["npx", "-y", "viberag-mcp"]
}
}
}Project Config: opencode.json
{
"mcp": {
"viberag": {
"type": "local",
"command": ["npx", "-y", "viberag-mcp"]
}
}
}Note: OpenCode uses
"mcp"key and requires"type": "local"with command as an array
Verify: Check MCP servers list in OpenCode, verify "viberag" appears and is enabled
Roo Code
Global Config: UI only — Click MCP icon in Roo Code pane header → Edit Global MCP
Project Config: .roo/mcp.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Verify: Click MCP icon in Roo Code pane header, verify "viberag" appears in server list
VS Code Copilot
Global Config: Add to User settings.json under mcp.servers:
{
"mcp": {
"servers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}
}Project Config: .vscode/mcp.json
{
"servers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Note: VS Code uses
"servers"instead of"mcpServers"
Required: Enable Agent Mode in VS Code settings:
- Settings → search
chat.agent.enabled→ check the box, OR- Add
"chat.agent.enabled": trueto your Usersettings.json
Verify: Cmd/Ctrl+Shift+P → "MCP: List Servers", verify "viberag" appears
Windsurf
Global Config: ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"viberag": {
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Verify: Click Plugins icon in Cascade panel, verify "viberag" shows in plugin list
Zed
Global Config: ~/.config/zed/settings.json
{
"context_servers": {
"viberag": {
"source": "custom",
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Project Config: .zed/settings.json
{
"context_servers": {
"viberag": {
"source": "custom",
"command": "npx",
"args": ["viberag-mcp"]
}
}
}Note: Zed uses
"context_servers"instead of"mcpServers"and requires"source": "custom"for non-extension servers
Verify: Open Agent Panel settings, verify "viberag" shows green indicator
VibeRAG exposes a small set of agent-centric tools. Backward compatibility with legacy tool names is not provided.
| Tool | Description |
|---|---|
codebase_search |
Intent-routed search with grouped results + stable IDs for follow-ups |
help |
Usage guide for MCP tools + how search works |
read_file_lines |
Read an exact line range from disk |
get_symbol_details |
Fetch a symbol definition + deterministic metadata by symbol_id |
find_references |
Find usage occurrences (refs) for a symbol name or symbol_id |
get_surrounding_code |
Expand a hit into neighbors (symbols/chunks) and related metadata |
build_index |
Build/update the index (incremental by default) |
get_status |
Get index + daemon status summary |
get_watcher_status |
Get watcher status (auto-indexing) |
cancel_operation |
Cancel indexing or warmup without shutting down the daemon |
Single entry point with intent routing. Use scope for transparent filters.
intent:auto|definition|usage|concept|exact_text|similar_code- Definition-style symbol lookups tolerate small typos via fuzzy (Levenshtein) name matching.
scope:path_prefix,path_contains,path_not_contains,extensionexplain: include per-hit channels + ranking priors
Example:
{
"query": "how does authentication work",
"intent": "concept",
"scope": {
"path_prefix": ["src/"],
"path_not_contains": ["test", "__tests__", ".spec.", ".test."]
},
"k": 20,
"explain": true
}Follow-ups: get_symbol_details, read_file_lines, get_surrounding_code, find_references.
VibeRAG includes a CLI for easy execution of initialization, indexing, setup, and other things you may want to manually control outside of agent use.
| Command | Description |
|---|---|
/init |
Initialize VibeRAG (configure embeddings, index codebase) |
/index |
Index the codebase (incremental) |
/reindex |
Force full reindex |
/search <query> |
Semantic search |
/status |
Show daemon and index status |
/cancel |
Cancel indexing or warmup |
/mcp-setup |
Configure MCP server for AI tools |
/clean |
Remove VibeRAG from project |
/help |
Show all commands |
VibeRAG stores all per-project state (config, index, logs) globally under:
~/.local/share/viberag/projects/<projectId>/(override viaVIBERAG_HOME)
No files are written into your repo.
VibeRAG uses .gitignore rules to exclude files and folders from indexing. For
non-git projects (or for additional ignore patterns), you can create a
.viberagignore file in the project root.
.viberagignoreuses the exact same pattern syntax as.gitignore- It is applied in addition to
.gitignore(if present)
Example .viberagignore:
# build outputs
dist/
build/
# local artifacts
coverage/
tmp/
# generated bundles
**/*.min.jsVibeRAG writes per-service logs with hourly rotation:
~/.local/share/viberag/projects/<projectId>/logs/daemon/- daemon lifecycle and IPC errors~/.local/share/viberag/projects/<projectId>/logs/indexer/- indexing progress, retries, and batch failures~/.local/share/viberag/projects/<projectId>/logs/mcp/- MCP server errors~/.local/share/viberag/projects/<projectId>/logs/cli/- CLI errors
If indexing appears slow or retries are happening, check the latest file under
~/.local/share/viberag/projects/<projectId>/logs/indexer/.
Choose your embedding provider during /init:
| Model | Quant | Download | RAM |
|---|---|---|---|
| Qwen3-0.6B | Q8 | ~700MB | ~1.5GB |
- Works completely offline, no API key required
- Initial indexing may take time; future updates are incremental
- Works great for code and natural language (docs, docstrings, code comments, etc.)
| Provider | Model | Dims | Cost | Get API Key |
|---|---|---|---|---|
| Gemini | gemini-embedding-001 | 1536 | Free tier | Google AI Studio |
| Mistral | codestral-embed | 1536 | $0.10/1M | Mistral Console |
| OpenAI | text-embedding-3-large | 1536 | $0.13/1M | OpenAI Platform |
- Gemini - Free tier available, great for getting started
- Mistral - Code-optimized embeddings for technical content
- OpenAI - Fast and reliable with low cost
API keys are entered during the /init wizard and stored globally in ~/.local/share/viberag/secrets/secrets.json (override via VIBERAG_HOME). Project configs store only a key id reference (never the raw API key).
- Parsing - Tree-sitter extracts functions, classes, and semantic chunks
- Embedding - Code chunks are embedded using local or API-based models
- Storage - Vectors stored in LanceDB (local, no server required)
- Search - Hybrid search combines vector similarity + full-text search
- MCP - AI tools query the index via the MCP protocol
VibeRAG works best when AI agents use sub-agents for exploration tasks. This keeps the main conversation context clean and uses ~8x fewer tokens.
When an AI calls viberag directly, all search results expand the main context. Sub-agents run searches in isolated context windows and return only concise summaries.
| Approach | Context Usage | Token Efficiency |
|---|---|---|
| Direct viberag calls | 24k tokens | Baseline |
| Sub-agent delegation | 3k tokens | 8x better |
# For exploration tasks, use the Task tool:
Task(subagent_type='Explore', prompt='Use viberag to find how authentication works')
# For parallel comprehensive search:
Task(subagent_type='Explore', prompt='Search auth patterns') # runs in parallel
Task(subagent_type='Explore', prompt='Search login flows') # with this one
Add to your CLAUDE.md:
When exploring the codebase, use Task(subagent_type='Explore') and instruct it
to use the viberag `codebase_search` tool (and follow-ups like `get_symbol_details` / `read_file_lines`). This keeps the main context clean.- Use Agent HQ to delegate exploration to background agents
- Background agents can iterate with viberag without blocking your session
- Use
/delegateto hand off exploration tasks to Copilot coding agent
- Enable Agent mode for multi-step exploration
- Agent mode can orchestrate multiple viberag searches autonomously
- Consider the Sub-Agents MCP server for Claude Code-style delegation
- Cascade automatically plans multi-step tasks
- Enable Turbo Mode for autonomous exploration
- Cascade's planning agent will orchestrate viberag calls efficiently
- Use Architect mode for exploration and understanding
- Boomerang tasks coordinate complex multi-mode workflows
- Each mode (Architect, Code, Debug) can use viberag with focused context
- Create extensions that scope viberag tools for specific tasks
- Extensions can bundle viberag with custom prompts for specialized exploration
- Use
gemini mcp add viberagthen reference in extension configs
- Use Agents SDK to orchestrate viberag as an MCP tool
- Codex can run as an MCP server itself for multi-agent setups
- Approval modes control how autonomously Codex explores
- Junie agent handles multi-step exploration autonomously
- Claude Agent integration provides sub-agent-like capabilities
- Access viberag through AI Chat with multi-agent support
- Use External Agents (Claude Code, Codex, Gemini CLI) for exploration
- Set
auto_approvein settings for autonomous agent operation - ACP (Agent Client Protocol) enables BYO agent integration
| Task Type | Recommended Approach |
|---|---|
| "Where is function X defined?" | codebase_search with intent="definition" |
| "What file handles Y?" | codebase_search with intent="concept" (check files) |
| "How does authentication work?" | Sub-agent - needs multi-step search + follow-ups |
| "Find all API endpoints" | Sub-agent - iterative search + scope filters |
| "Understand the data flow" | Sub-agent - iterative exploration |
Use a few targeted codebase_search calls with different intents, then follow up with
get_symbol_details, read_file_lines, get_surrounding_code, and find_references as needed.
Example sequence:
{"query": "authentication", "intent": "concept", "k": 20}{
"query": "login",
"intent": "definition",
"k": 20,
"scope": {"path_prefix": ["src/"]}
}{"symbol_name": "login", "k": 200}Large repos can exceed OS watch limits. The watcher honors .gitignore and .viberagignore, but if you still see EMFILE:
- Add more ignores in
.gitignoreor.viberagignoreto reduce watched files. - Increase OS limits:
- macOS: raise
kern.maxfiles,kern.maxfilesperproc, andulimit -n - Linux: raise
fs.inotify.max_user_watches,fs.inotify.max_user_instances, andulimit -n
- macOS: raise
If indexing fails due to transient network/API issues:
- Run
/statusto confirm daemon/index state. - Re-run
/indexafter connectivity is stable. - Use
/cancelto stop a stuck run, then/reindexif you need a clean rebuild.
