This template repository provides 100% local semantic code search using FarhanAliRaza/claude-context-local for any project.
- ๐ Semantic Code Search: Find code by meaning, not just keywords
- ๐ 100% Private: No cloud APIs, your code never leaves your machine
- ๐ฐ Zero Cost: No API fees, completely free
- โก Fast: Local FAISS vector search
- ๐ฏ Per-Project: Isolated index for each project
- ๐ Multi-Language: Python, JS/TS, Go, Rust, Java, C/C++, C#, Markdown
-
Use this template for your new project
git clone <your-template-url> your-project cd your-project
-
Install FarhanAliRaza globally (one-time, ~1 minute)
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash -
Enable Claude Code MCP approval (CRITICAL - Required for MCP to load)
Create or edit
.claude/settings.local.jsonin your project:mkdir -p .claude cat > .claude/settings.local.json << 'EOF' { "enableAllProjectMcpServers": true } EOF
Why needed: Claude Code requires explicit approval to load MCP servers from
.mcp.json. Without this setting, the server won't activate even after restart.Alternative (selective approval):
{ "enabledMcpjsonServers": ["code-search"] } -
Restart Claude Code
Close and reopen Claude Code completely
-
Verify MCP server loaded
Ask Claude: "List available MCP tools"
You should see
mcp__code-search__*tools listed -
Index your codebase
In Claude Code: "Index this codebase"
-
Start searching!
Examples:
- "Find authentication code"
- "Show me the API client class"
-
Copy configuration files to your project root:
cp .mcp.json your-project/ cp .mcp-server-wrapper.sh your-project/ # Merge with existing .gitignore if it exists cat .gitignore >> your-project/.gitignore
-
Make wrapper executable
chmod +x your-project/.mcp-server-wrapper.sh
-
Enable Claude Code MCP approval (CRITICAL)
Create or edit
.claude/settings.local.jsonin your project:cd your-project mkdir -p .claude cat > .claude/settings.local.json << 'EOF' { "enableAllProjectMcpServers": true } EOF
-
Install FarhanAliRaza globally (if not already installed)
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bash -
Restart Claude Code
Close and reopen completely
-
Verify and index
Ask Claude: "List available MCP tools" (should see
mcp__code-search__*)Then: "Index this codebase"
Only needs to be installed once per machine (not per project):
# Check if already installed:
ls ~/.local/share/claude-context-local/
# If not found, install:
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bashSystem Requirements:
- Python 3.12+
- 1-2 GB disk space (for model + index)
- Optional: GPU for faster indexing (works on CPU)
.
โโโ .mcp.json โ
Commit - MCP server config
โโโ .mcp-server-wrapper.sh โ
Commit - Server wrapper script
โโโ .gitignore โ
Commit - Excludes index
โโโ .claude/
โ โโโ settings.local.json.template โ
Commit - Template for MCP approval
โโโ README.md โ
Commit - This file
โโโ SETUP_CHECKLIST.md โ
Commit - Verification guide
โโโ .code-search-index/ โ DON'T commit - Local index (auto-generated)
In Claude Code:
> Index this codebase
Expected output:
โ
Indexing /path/to/project...
โ
Found 121 files
โ
Created 1804 code chunks
โ
Indexed in 23 seconds
> Find all HTTP request handling code
Returns code chunks that handle HTTP requests,
even if they don't contain the exact words "HTTP request"!
> Show me the DatabaseConnection class
Returns:
1. database/connection.py:15-45 (class DatabaseConnection) โญ EXACT
2. database/pool.py:20-40 (ConnectionPool)
3. database/manager.py:10-30 (DBConnectionManager)
> Find error handling patterns
Returns all error handling code across your codebase,
understanding the semantic meaning of "error handling"
> What's the indexing status?
Returns:
{
"total_chunks": 1804,
"files_indexed": 121,
"top_folders": { "src": 450, "tests": 610 }
}
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Project โ
โ โโโ .mcp.json โ Claude Code reads โ
โ โโโ .mcp-server-wrapper.sh โ Launches server โ
โ โโโ .claude/ โ
โ โ โโโ settings.local.json โ Enables MCP โ
โ โโโ .code-search-index/ โ Local FAISS index โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ~/.local/share/claude-context-local/ โ
โ โโโ mcp_server/ โ MCP server code โ
โ โโโ embeddings/ โ EmbeddingGemma model โ
โ โโโ chunking/ โ AST-based parser โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Points:
- FarhanAliRaza installed once globally in
~/.local/share/ - Each project has its own isolated index in
.code-search-index/ - Claude Code approval via
.claude/settings.local.jsonrequired - No conflicts between projects
- Safe to delete and regenerate index anytime
Symptom: No mcp__code-search__* tools available after restart
Cause: Missing Claude Code approval setting
Fix:
-
Create or edit
.claude/settings.local.jsonin your project root:mkdir -p .claude cat > .claude/settings.local.json << 'EOF' { "enableAllProjectMcpServers": true } EOF
-
Restart Claude Code again
Verify fix:
# Check if approval setting exists
cat .claude/settings.local.json | grep enableAllProjectMcpServers
# Should output: "enableAllProjectMcpServers": trueAdditional checklist:
- โ
Is
.mcp.jsonin project root?ls .mcp.json - โ
Is wrapper executable?
ls -la .mcp-server-wrapper.sh(should showrwx) - โ
Is global install present?
ls ~/.local/share/claude-context-local/ - โ
Is approval enabled?
grep enableAllProjectMcpServers .claude/settings.local.json
Fix:
curl -fsSL https://raw.githubusercontent.com/FarhanAliRaza/claude-context-local/main/scripts/install.sh | bashFix:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Restart terminalFix:
chmod +x .mcp-server-wrapper.sh# Delete index:
rm -rf .code-search-index/
# Re-index in Claude Code:
"Index this codebase"Checklist:
- โ Did indexing complete successfully?
- โ Check index stats: "What's the indexing status?"
- โ
Verify files in
.code-search-index/projects/*/index/
Fix:
# Re-index from scratch
rm -rf .code-search-index/
# Then in Claude Code: "Index this codebase"| Project Size | Files | Indexing Time | Storage |
|---|---|---|---|
| Small | <100 | 10-20 sec | ~5 MB |
| Medium | 1,000 | 1-2 min | ~50 MB |
| Large | 10,000 | 10-15 min | ~500 MB |
Search Speed: 50-200ms per query
We tested 3 local code search implementations. Only FarhanAliRaza works reliably:
| Implementation | Status | Issues |
|---|---|---|
| danielbowne/claude-context-mcp | โ Broken | State tracking bug (GitHub #226) |
| MikeO-AI/claude-context-local-mcp | โ Broken | 100-chunk hard limit |
| FarhanAliRaza/claude-context-local | โ Working | None found |
Tested with: 121 files, 1804 chunks, production-ready
- Embeddings: Google EmbeddingGemma (768 dimensions)
- Vector DB: FAISS (IndexFlatIP)
- Chunking: AST-based (respects code structure)
- Languages: Python, JS/TS, Go, Rust, Java, C/C++, C#, Markdown
- Storage: Project-local
.code-search-index/
Found this template useful? Consider:
- โญ Starring the original FarhanAliRaza/claude-context-local
- ๐ Improving this template via pull requests
- ๐ Reporting issues you encounter
This template configuration is provided as-is.
FarhanAliRaza/claude-context-local has its own license - see their repository.
- FarhanAliRaza Repository
- Setup Guide - Detailed instructions
- Setup Checklist - Step-by-step verification
- Comparison - Why we chose FarhanAliRaza
Last Updated: 2025-11-27 Status: โ Production-Ready Tested On: lmstudio-bridge-enhanced (1804 chunks, 121 files)