claude-context-local
Code search MCP for Claude Code. Make entire codebase the context for any coding agent. Embeddings are created and stored locally. No API cost.
claude mcp add --transport stdio farhanaliraza-claude-context-local uv run --directory ~/.local/share/claude-context-local python mcp_server/server.py
How to use
This MCP server provides a local Claude Code integration for semantic code search. It runs the claude-context-local code-search MCP service inside a uv virtual environment, serving as a local backend that Claude Code can talk to via MCP. The server uses multi-language chunking, EmbeddingGemma for embeddings, and FAISS for fast similarity search, all offline on your machine. After installation, you register the MCP server in Claude Code, then index your codebases and query them semantically through Claude Code, with results surfaced from the local embeddings and index. Tools exposed by the MCP server include indexing, incremental updates, and semantic search that interpret natural language queries to locate relevant code chunks across supported languages.
To use it, register the MCP server as code-search in your uv environment, then index your projects using the provided indexing utilities (standalone or via the MCP workflow). Once indexed, you can issue natural language search prompts in Claude Code such as "find all functions related to data serialization in Go and Python" or "show implementations of a specific interface across the repository". The server returns semantically relevant code chunks with metadata like file path, language, and line numbers, enabling precise navigation directly within Claude Code.
How to install
Prerequisites:
- Python 3.12+
- curl or wget for the installer script
- Sufficient disk space (1–2 GB for model/cache, plus index data)
Installation steps:
- Install the MCP server and dependencies via the remote installer:
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
If curl is not available, use wget:
wget -qO- https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
- (Optional) Update an existing installation by running the same installer command again:
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash
- After installation, register the MCP server in Claude Code as described in the Quick Start:
claude mcp add code-search --scope user -- uv run --directory ~/.local/share/claude-context-local python mcp_server/server.py
- Index your codebase using Claude Code and the MCP workflow (no manual commands needed for basic indexing when using Claude Code).
Notes:
- The installer preserves embeddings and indexed projects across updates and can auto-download the EmbeddingGemma model if not cached.
- You can customize the storage location via CODE_SEARCH_STORAGE (see additional notes).
Additional notes
Environment and configuration tips:
- CODE_SEARCH_STORAGE: Set a custom storage directory for embeddings and indexes (default: ~/.claude_code_search). Example: export CODE_SEARCH_STORAGE="/path/to/storage".
- The MCP server runs locally in the uv environment; ensure the directory ~/.local/share/claude-context-local exists and is writable.
- If you plan to use GPU acceleration for FAISS, ensure your system has the required CUDA/driver setup; the installer will attempt to install faiss-gpu when a compatible GPU is detected.
- UF Environment: The MCP integration works offline once the embeddings and index are generated; no external API keys are needed.
- For updates, re-run the installer command; your embeddings and indexed projects are preserved automatically.
Related MCP Servers
serena
A powerful coding agent toolkit providing semantic retrieval and editing capabilities (MCP server & other integrations)
claude-context
Code search MCP for Claude Code. Make entire codebase the context for any coding agent.
claude-code-open
Open source AI coding platform with Web IDE, multi-agent system, 37+ tools, MCP protocol. MIT licensed.
vibe-check
Stop AI coding disasters before they cost you weeks. Real-time anti-pattern detection for vibe coders who love AI tools but need a safety net to avoid expensive overengineering traps.
claude-context-local
🔒 Privacy-first MCP server for Claude using PostgreSQL + Ollama. Local alternative to cloud-based code context with full data sovereignty. No API keys, no external calls, 100% local.
AiDex
MCP Server for persistent code indexing. Gives AI assistants (Claude, Gemini, Copilot, Cursor) instant access to your codebase. 50x less context than grep.