Code search MCP for Claude Code. Make entire codebase the context for any coding agent. Embeddings are created and stored locally. No API cost.
# Add to your Claude Code skills
git clone https://github.com/FarhanAliRaza/claude-context-local ██████╗ ██╗ █████╗ ██╗ ██╗ ██████╗ ███████╗
██╔════╝ ██║ ██╔══██╗ ██║ ██║ ██╔══██╗ ██╔════╝
██║ ██║ ███████║ ██║ ██║ ██║ ██║ █████╗
██║ ██║ ██╔══██║ ██║ ██║ ██║ ██║ ██╔══╝
╚██████╗ ███████╗ ██║ ██║ ╚██████╔╝ ██████╔╝ ███████╗
╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
██████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗ ██╗ ██╗ ████████╗
██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝ ╚══██╔══╝
██║ ██║ ██║ ██╔██╗ ██║ ██║ █████╗ ╚███╔╝ ██║
██║ ██║ ██║ ██║╚██╗██║ ██║ ██╔══╝ ██╔██╗ ██║
╚██████╗ ╚██████╔╝ ██║ ╚████║ ██║ ███████╗ ██╔╝ ██╗ ██║
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝
██╗ ██████╗ ██████╗ █████╗ ██╗
██║ ██╔═══██╗ ██╔════╝ ██╔══██╗ ██║
██║ ██║ ██║ ██║ ███████║ ██║
██║ ██║ ██║ ██║ ██╔══██║ ██║
███████╗ ╚██████╔╝ ╚██████╗ ██║ ██║ ███████╗
╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝
Claude Context without the cloud. Semantic code search that runs 100% locally using EmbeddingGemma. No API keys, no costs, your code never leaves your machine.
An intelligent code search system that uses Google's EmbeddingGemma model and advanced multi-language chunking to provide semantic search capabilities across 15 file extensions and 9+ programming languages, integrated with Claude Code via MCP (Model Context Protocol).
Claude’s code context is powerful, but sending your code to the cloud costs tokens and raises privacy concerns. This project keeps semantic code search entirely on your machine. It integrates with Claude Code via MCP, so you keep the same workflow—just faster, cheaper, and private.
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
If your system doesn't have curl, you can use wget:
wget -qO- https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
Run the same install command to update:
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
The installer will:
~/.claude_code_searchuv if missing and creates a project venvclaude-context-local in ~/.local/share/claude-context-localuv syncfaiss-gpu if an NVIDIA GPU is detected (interactive mode only)claude mcp add code-search --scope user -- uv run --directory ~/.local/share/claude-context-local python mcp_server/server.py
Then open Claude Code; the server will run in stdio mode inside the uv environment.
Open Claude Code and say: index this codebase. No manual commands needed.
Interact via chat inside Claude Code; no function calls or commands are required.
claude-context-local/
├── chunking/ # Multi-language chunking (15 extensions)
│ ├── multi_language_chunker.py # Unified orchestrator (Python AST + tree-sitter)
│ ├── python_ast_chunker.py # Python-specific chunking (rich metadata)
│ └── tree_sitter.py # Tree-sitter: JS/TS/JSX/TSX/Svelte/Go/Java/Rust/C/C++/C#
├── embeddings/
│ └── embedder.py # EmbeddingGemma; device=auto (CUDA→MPS→CPU); offline cache
├── search/
│ ├── indexer.py # FAISS index (CPU by default; GPU when available)
│ ├── searcher.py # Intelligent ranking & filters
│ └── incremental_indexer.py # Merkle-driven incremental indexing
├── merkle/
│ ├── merkle_dag.py # Content-hash DAG of the workspace
│ ├── change_detector.py # Diffs snapshots to find changed files
│ └── snapshot_manager.py # Snapshot persistence & stats
├── mcp_server/
│ └── server.py # MCP tools for Claude Code (stdio/HTTP)
└── scripts/
├── install.sh # One-liner remote installer (uv + model + faiss)
├── download_model_standalone.py # Pre-fetch embedding model
└── index_codebase.py # Standalone indexing utility
graph TD
A["Claude Code (MCP client)"] -->|index_directory| B["MCP Server"]
B --> C{IncrementalIndexer}
C --> D["ChangeDetector<br/>(Merkle DAG)"]
C --> E["MultiLanguageChunker"]
E --> F["Code Chunks"]
C --> G["CodeEmbedder<br/>(EmbeddingGemma)"]
G --> H["Embeddings"]
C --> I["CodeIndexManager<br/>(FAISS CPU/GPU)"]
H --> I
D --> J["SnapshotManager"]
C --> J
B -->|search_code| K["Searcher"]
K --> I
The system uses advanced parsing to create semantically meaningful chunks across all supported languages:
CODE_SEARCH_STORAGE: Custom storage directory (default: ~/.claude_code_search)The system uses google/embeddinggemma-300m by default.
Notes:
faiss-gpu-cu12 (or faiss-gpu-cu11) and the index will
run on GPU automatically at runtime while saving as CPU for portability.The google/embeddinggemma-300m model is hosted on Hugging Face and may require
accepting terms and/or authentication to download.
Visit the model page and accept any terms:
Authenticate one of the following ways:
CLI (recommended):
uv run huggingface-cli login
# Paste your token from https://huggingface.co/settings/tokens
Environment variable:
export HUGGING_FACE_HUB_TOKEN=hf_XXXXXXXXXXXXXXXXXXXXXXXX
After the first successful download, we cache the model under ~/.claude_code_search/models
and prefer offline loads for speed and reliability.
Fully Supported (15 extensions across 9+ languages):
| Language | Extensions |
| -------------- | ----------------------------- |
| Python | .py |
| JavaScript | .js, .jsx |
| TypeScript | .ts, .tsx |
| Java | .java |
| Go | .go |
| Rust | .rs |
| C | .c |
| C++ | .cpp, .cc, .cxx, .c++ |
| C# | .cs |
| Svelte | .svelte |
Total: 15 file extensions across 9+ programming languages
Data is stored in the configured storag
No comments yet. Be the first to share your thoughts!