The privacy-first MCP server that transforms any repository into an AI-ready codebase with semantic search and RAG.
RagCode is a Model Context Protocol (MCP) server that instantly makes your project AI-ready. It enables AI assistants like GitHub Copilot, Cursor, Windsurf, and Claude to understand your entire codebase through semantic vector search, bridging the gap between your code and Large Language Models (LLMs).
Built with the official Model Context Protocol Go SDK, RagCode provides 9 powerful tools to index, search, and analyze code, making it the ultimate solution for AI-ready software development.
Your code never leaves your machine. RagCode runs entirely on your local infrastructure:
- β Local AI Models - Uses Ollama for LLM and embeddings (runs on your hardware)
- β Local Vector Database - Qdrant runs in Docker on your machine
- β Zero Cloud Dependencies - No external API calls, no data transmission
- β No API Costs - Free forever, no usage limits or subscriptions
- β Complete Privacy - Your proprietary code stays private and secure
- β Offline Capable - Works without internet connection (after initial model download)
- β Full Control - You own the data, models, and infrastructure
Perfect for: Enterprise codebases, proprietary projects, security-conscious teams, and developers who value privacy.
- π Semantic Code Search - Find code by meaning, not just keywords
- π 5-10x Faster - Instant results vs. reading entire files
- π° 98% Token Savings - Reduce AI context usage dramatically
- π Multi-Language - Go, PHP (Laravel), Python, JavaScript support
- π’ Multi-Workspace - Handle multiple projects simultaneously
- π€ AI-Ready - Works with Copilot, Cursor, Windsurf, Claude, Antigravity
100% Local Stack: Ollama (local LLM + embeddings) + Qdrant (local vector database) + Docker + MCP Protocol
Windsurf β’ Cursor β’ Antigravity β’ Claude Desktop β’ VS Code + GitHub Copilot β’ MCP Inspector
Without RagCode, AI assistants must:
- π Read entire files to find relevant code
- π Search through thousands of lines manually
- π Use precious context window tokens on irrelevant code
- β±οΈ Wait for multiple file reads and searches
With RagCode:
- β‘ Instant semantic search - finds relevant code in milliseconds
- π― Pinpoint accuracy - returns only the exact functions/types you need
- π° 90% less context usage - AI sees only relevant code, not entire files
- π§ Smarter responses - AI has more tokens for actual reasoning
| Task | Without RagCode | With RagCode | Speedup |
|---|---|---|---|
| Find authentication logic | 30-60s (read 10+ files) | 2-3s (semantic search) | 10-20x faster |
| Understand function signature | 15-30s (grep + read file) | 1-2s (direct lookup) | 15x faster |
| Find all API endpoints | 60-120s (manual search) | 3-5s (hybrid search) | 20-40x faster |
| Navigate type hierarchy | 45-90s (multiple files) | 2-4s (type definition) | 20x faster |
Example: Finding a function in a 50,000 line codebase
- Without RagCode: AI reads 5-10 files (~15,000 tokens) to find the function
- With RagCode: AI gets exact function + context (~200 tokens)
- Savings: 98% fewer tokens = faster responses + lower costs
| Feature | RagCode (Local) | Cloud-Based AI Code Search |
|---|---|---|
| Privacy | β 100% local, code never leaves machine | β Code sent to cloud servers |
| Cost | β $0 - Free forever | β $20-100+/month subscriptions |
| API Limits | β Unlimited usage | β Rate limits, token caps |
| Offline | β Works without internet | β Requires constant connection |
| Data Control | β You own everything | β Vendor controls your data |
| Enterprise Ready | β No compliance issues | |
| Setup | β Instant cloud access | |
| Performance | β Fast (local hardware) |
Bottom Line: RagCode gives you enterprise-grade AI code search with zero privacy concerns and zero ongoing costs.
search_code- Semantic vector search across your entire codebasehybrid_search- Combined semantic + keyword search for maximum accuracyget_function_details- Complete function signatures, parameters, and implementationfind_type_definition- Locate class, struct, and interface definitions instantlyfind_implementations- Discover all usages and implementations of any symbollist_package_exports- Browse all exported symbols from any package/modulesearch_docs- Semantic search through project documentation (Markdown)get_code_context- Extract code snippets with surrounding contextindex_workspace- Automated workspace indexing with language detection
- Go - β82% coverage with full AST analysis
- PHP - β84% coverage + Laravel framework support
- Python - Coming soon with full type hint support
- JavaScript/TypeScript - Planned for future releases
- Multi-Workspace Detection - Automatically detects project boundaries (git, go.mod, composer.json, package.json)
- Per-Language Collections - Separate vector databases for each language (
ragcode-{workspace}-go,ragcode-{workspace}-php) - Automatic Indexing - Background indexing on first use, no manual intervention needed
- Incremental Indexing - Smart re-indexing that only processes changed files, saving time and resources
- Vector Embeddings - Uses Ollama's
nomic-embed-textfor high-quality semantic embeddings - Hybrid Search Engine - Combines vector similarity with BM25 lexical matching
- Direct File Access - Read code without indexing for quick lookups
- Smart Caching - Efficient re-indexing only for changed files
| Component | Requirement | Notes |
|---|---|---|
| CPU | 4 cores | For running Ollama models |
| RAM | 16β―GB | 8β―GB for phi3:medium, 4β―GB for nomic-embed-text, 4β―GB system |
| Disk | 10β―GB free | ~8β―GB for models + 2β―GB for data |
| OS | Linux, macOS, Windows | Docker required for Qdrant |
| Component | Requirement | Notes |
|---|---|---|
| CPU | 8+ cores | Better performance for concurrent operations |
| RAM | 32β―GB | Allows comfortable multiβworkspace indexing |
| GPU | NVIDIA GPU with 8β―GB+ VRAM | Significantly speeds up Ollama inference (optional) |
| Disk | 20β―GB free SSD | Faster indexing and search |
nomic-embed-text: ~274β―MB (embeddings model)phi3:medium: ~7.9β―GB (LLM for code analysis)- Total: ~8.2β―GB for models
Linux (amd64):
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=dockerThat's it! One command downloads, extracts, and runs the installer.
macOS (Apple Silicon):
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_arm64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=dockermacOS (Intel):
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=dockerWindows (PowerShell):
# Download and extract
Invoke-WebRequest -Uri "https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_windows_amd64.zip" -OutFile "ragcode.zip"
Expand-Archive ragcode.zip -DestinationPath . -Force
# Run installer (requires Docker Desktop running)
.\ragcode-installer.exe -ollama=docker -qdrant=docker
β οΈ Windows requires Docker Desktop to be installed and running.
Windows with WSL (alternative):
If you prefer to run RagCode inside WSL while using Windows IDEs (Windsurf, Cursor, VS Code):
# Inside WSL terminal
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=dockerThen manually configure your Windows IDE to use the WSL binary. Example for Windsurf (%USERPROFILE%\.codeium\windsurf\mcp_config.json):
{
"mcpServers": {
"ragcode": {
"command": "wsl.exe",
"args": ["-e", "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp"],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "nomic-embed-text",
"QDRANT_URL": "http://localhost:6333"
},
"disabled": false
}
}
}π‘ Replace
YOUR_USERNAMEwith your WSL username. ThelocalhostURLs work because WSL2 shares network ports with Windows.
- β
Downloads and installs the
rag-code-mcpbinary - β Sets up Ollama and Qdrant (Docker or local, your choice)
- β
Downloads required AI models (
phi3:medium,nomic-embed-text) - β Configures your IDE (VS Code, Claude, Cursor, Windsurf)
- β Adds binaries to your PATH
Once installed, you don't need to configure anything.
- Open your project in your IDE (VS Code, Cursor, Windsurf).
- Ask your AI assistant a question about your code (e.g., "How does the authentication system work?").
- That's it! RagCode automatically detects your workspace, creates the index in the background, and answers your question.
- First query might take a moment while indexing starts.
- Subsequent queries are instant.
- File changes are automatically detected and re-indexed incrementally.
The installer runs Ollama and Qdrant in Docker by default, but you can quickly mix and match components:
| Scenario | When to use | Example command |
|---|---|---|
| Everything in Docker (default) | Quick setup, no local software needed | ./ragcode-installer -ollama=docker -qdrant=docker |
| Local Ollama + Docker Qdrant | You already have Ollama installed/optimized locally | ./ragcode-installer -ollama=local -qdrant=docker |
| Existing remote services | Running Qdrant/Ollama in separate infrastructure | ./ragcode-installer -ollama=local -qdrant=remote --skip-build |
| Docker + GPU | Run Ollama container with GPU acceleration | ./ragcode-installer -ollama=docker -qdrant=docker -gpu |
| Docker with custom models folder | Reuse locally downloaded Ollama models | ./ragcode-installer -ollama=docker -models-dir=$HOME/.ollama |
Key flags:
-ollama:docker(default) orlocal-qdrant:docker(default) orremote-models-dir: mount your local directory as/root/.ollama-gpu: adds--gpus=allto the Ollama container-skip-build: skip rebuild if binaries already exist
See QUICKSTART.md for detailed installation and usage instructions.
git clone https://github.com/doITmagic/rag-code-mcp.git
cd rag-code-mcp
go run ./cmd/installDocker is required (for Qdrant, and optionally for Ollama):
# Ubuntu/Debian
sudo apt update && sudo apt install docker.io
sudo systemctl start docker
sudo usermod -aG docker $USER # log out / log in again
# macOS
brew install dockerOption A: Everything in Docker (recommended, no extra installs needed)
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=dockerOption B: Use local Ollama (if you already have Ollama installed)
# First, install Ollama locally (skip if already installed)
curl -fsSL https://ollama.com/install.sh | sh
# Then run installer with local Ollama
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=local -qdrant=dockerInstallation takes 5β10 minutes (downloading the Ollama models is the long pole).
# Check the binary
~/.local/share/ragcode/bin/rag-code-mcp --version
# Verify services are running
docker ps | grep qdrant
ollama list~/.local/share/ragcode/bin/rag-code-mcp --health
docker ps | grep ragcode-qdrant
docker ps | grep ragcode-ollama- Main log file:
~/.local/share/ragcode/bin/mcp.log - Watch in real-time:
tail -f ~/.local/share/ragcode/bin/mcp.log - For service issues, also check Docker logs (
docker logs ragcode-ollama,docker logs ragcode-qdrant).
After installation, RagCode is automatically available in supported IDEs. No additional configuration is required.
- Windsurf - Full MCP support
- Cursor - Full MCP support
- Antigravity - Full MCP support
- Claude Desktop - Full MCP support
- VS Code + GitHub Copilot - Agent mode integration (requires VS Code 1.95+)
RagCode integrates with GitHub Copilot's Agent Mode through MCP, enabling semantic code search as part of Copilot's autonomous workflow.
Quick Setup:
- Install RagCode with
ragcode-installer(it configures VS Code automatically) - Open VS Code in your project
- Open Copilot Chat (Ctrl+Shift+I / Cmd+Shift+I)
- Enable Agent Mode (click "Agent" button or type
/agent) - Ask questions - Copilot will automatically use RagCode tools
Example Prompts:
Find all authentication middleware functions in this codebase
Show me the User model definition and all its methods
Search for functions that handle database connections
Manual Configuration:
Edit ~/.config/Code/User/globalStorage/mcp-servers.json:
{
"mcpServers": {
"ragcode": {
"command": "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "nomic-embed-text",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}Verify Integration:
- Command Palette β
MCP: Show MCP Servers - Check that
ragcodeappears with "Connected" status
π Detailed Guide: See docs/vscode-copilot-integration.md for complete setup, troubleshooting, and advanced features.
See QUICKSTART.md for detailed VS Code setup and troubleshooting.
If you install a new IDE after running ragcode-installer, you'll need to configure it manually. Below are the configuration file paths and JSON snippets for each supported IDE.
| IDE | Config File Path |
|---|---|
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| Cursor | ~/.cursor/mcp.config.json |
| Antigravity | ~/.gemini/antigravity/mcp_config.json |
| Claude Desktop (Linux) | ~/.config/Claude/mcp-servers.json |
| Claude Desktop (macOS) | ~/Library/Application Support/Claude/mcp-servers.json |
| Claude Desktop (Windows) | %APPDATA%\Claude\mcp-servers.json |
| VS Code + Copilot | ~/.config/Code/User/globalStorage/mcp-servers.json |
Add the following to your IDE's MCP configuration file (create the file if it doesn't exist):
{
"mcpServers": {
"ragcode": {
"command": "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "nomic-embed-text",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}Important: Replace
YOUR_USERNAMEwith your actual system username. On macOS, the binary path is typically/Users/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp.
Alternatively, you can re-run the installer to auto-configure newly installed IDEs:
# Re-run installer (it will detect and configure new IDEs)
~/.local/share/ragcode/bin/ragcode-installer -skip-build -ollama=local -qdrant=dockerThe -skip-build flag skips binary compilation and only updates IDE configurations.
| Tool | What it does | When to use |
|---|---|---|
search_code |
Semantic search for relevant code fragments based on intent, not just keywords. | General questions like "show me the authentication logic" or "find the function that processes payments". |
hybrid_search |
Combines semantic + lexical (BM25) for exact matches plus context. | When you have both exact terms (e.g., constant names) and need semantic context. |
get_function_details |
Returns complete signature, parameters, and function body. | Quick clarification of a function/handler without manually opening the file. |
find_type_definition |
Locates structs, types, or interfaces and their fields. | When you need to quickly inspect a complex model/dto/struct. |
find_implementations |
Lists all implementations or usages of a symbol. | Interface audits, identifying handlers that implement a method. |
list_package_exports |
Lists exported symbols from a package. | Quick navigation through a module/package API. |
search_docs |
Semantic search in indexed Markdown documentation. | For questions about guides, RFCs, or large READMEs. |
get_code_context |
Reads a file with context (lines before/after). | When you need an exact snippet from a file without opening it manually. |
index_workspace |
Forces manual re-indexing of a workspace. | Use only if you disabled auto-indexing or want to run indexing from CLI/automations. |
All tools require a file_path parameter so that RagCode can determine the correct workspace.
When a tool (e.g., search_code, get_function_details, etc.) is invoked for the first time in a workspace, RagCode will:
- Detect the workspace from
file_path - Create a Qdrant collection for that workspace and language
- Index the code in the background
- Return results immediately (even if indexing is still in progress)
π You never need to run index_workspace manually β MCP tools automatically trigger indexing and incremental re-indexing in the background.
RagCode features smart incremental indexing that dramatically reduces re-indexing time by only processing files that have changed.
How it works:
- Tracks file modification times and sizes in
.ragcode/state.json - On subsequent indexing runs, compares current state with saved state
- Only indexes new or modified files
- Automatically removes outdated chunks from deleted/modified files
Performance Benefits:
- First run: Indexes all files (e.g., 77 files in ~20 seconds)
- No changes: Completes instantly with "No code changes detected"
- Single file change: Re-indexes only that file (e.g., 1 file in ~1 second)
Manual CLI (optional): If you prefer to automate indexing from CI/CD scripts or run a full reindex on demand, you can use ./bin/index-all -paths .... The command follows the same incremental mechanism, but most users don't need to run it manually.
Note: Incremental indexing applies to source code files. Markdown documentation is fully re-indexed on every run (optimization planned).
For technical details, see docs/incremental_indexing.md.
RagCode installs to ~/.local/share/ragcode/ with the following structure:
~/.local/share/ragcode/
βββ bin/
β βββ rag-code-mcp # Main MCP server binary
β βββ index-all # CLI indexing tool
β βββ mcp.log # Server logs
βββ config.yaml # Main configuration file
Edit ~/.local/share/ragcode/config.yaml to customize RagCode:
llm:
provider: "ollama"
base_url: "http://localhost:11434"
model: "phi3:medium" # LLM for code analysis
embed_model: "nomic-embed-text" # Embedding model
storage:
vector_db:
url: "http://localhost:6333"
collection_prefix: "ragcode"
workspace:
auto_index: true
exclude_patterns:
- "vendor"
- "node_modules"
- ".git"
- "dist"
- "build"
logging:
level: "info" # debug, info, warn, error
path: "~/.local/share/ragcode/bin/mcp.log"Recommended models:
- LLM:
phi3:medium,llama3.1:8b,qwen2.5:7b - Embeddings:
nomic-embed-text,all-minilm
Environment variables override config.yaml settings. These are typically set in your IDE's MCP configuration:
| Variable | Default | Description |
|---|---|---|
OLLAMA_BASE_URL |
http://localhost:11434 |
Ollama server URL |
OLLAMA_MODEL |
phi3:medium |
LLM model for code analysis |
OLLAMA_EMBED |
nomic-embed-text |
Embedding model |
QDRANT_URL |
http://localhost:6333 |
Qdrant vector database URL |
MCP_LOG_LEVEL |
info |
Log level (debug, info, warn, error) |
- Log file:
~/.local/share/ragcode/bin/mcp.log - Watch logs in real-time:
tail -f ~/.local/share/ragcode/bin/mcp.log - Docker container logs:
docker logs ragcode-ollama docker logs ragcode-qdrant
Cause: file_path is missing or points outside a recognized project.
Fix: Provide a valid file_path inside your project, e.g.:
{ "query": "search query", "file_path": "/path/to/your/project/file.go" }Cause: Docker is not running or the Qdrant container is stopped. Fix:
sudo systemctl start docker # Linux
# Then start Qdrant (the installer does this automatically)
~/.local/share/ragcode/start.shCause: Required models have not been downloaded. Fix:
ollama pull nomic-embed-text
ollama pull phi3:mediumCause: Large workspace or a heavy model. Fix:
- Use a smaller model (
phi3:mini) - Exclude large directories in
config.yaml - Wait β indexing runs in the background.
{ "query": "user authentication login", "file_path": "/home/user/myproject/auth/handler.go" }{ "type_name": "UserController", "file_path": "/home/user/laravel-app/app/Http/Controllers/UserController.php" }{ "query": "API endpoints documentation", "file_path": "/home/user/myproject/docs/API.md" }- Quick Start Guide - Get started in 5 minutes
- VS Code + Copilot Integration - Detailed setup for GitHub Copilot
- Architecture Overview - Technical deep dive
- Tool Schema Reference - Complete API documentation
- GitHub Repository - Source code and releases
- Issue Tracker - Report bugs or request features
- Model Context Protocol - Official MCP specification
- Ollama Documentation - LLM and embedding models
- Qdrant Documentation - Vector database guide
- What is RAG? - Understanding Retrieval-Augmented Generation
- Vector Embeddings Explained - How semantic search works
- MCP for Developers - Building MCP servers
We welcome contributions from the community! Here's how you can help:
- π Report Bugs - Open an issue
- π‘ Request Features - Share your ideas for new tools or languages
- π§ Submit PRs - Improve code, documentation, or add new features
- β Star the Project - Show your support on GitHub
- π’ Spread the Word - Share RagCode with other developers
git clone https://github.com/doITmagic/rag-code-mcp.git
cd rag-code-mcp
go mod download
go run ./cmd/rag-code-mcpRagCode MCP is open source software licensed under the MIT License.
See the LICENSE file for full details.
semantic-code-search rag retrieval-augmented-generation mcp-server model-context-protocol ai-code-assistant vector-search code-navigation ollama qdrant github-copilot cursor-ai windsurf go php laravel code-intelligence ast-analysis embeddings llm-tools local-ai privacy-first offline-ai self-hosted on-premise zero-cost no-cloud private-code-search enterprise-ai secure-coding-assistant
Built with β€οΈ for developers who want smarter AI code assistants
β Star us on GitHub if RagCode helps your workflow!
Questions? Problems? Open an Issue β’ Read the Docs β’ Join Discussions
