Update Docs: Fully offline install guide
Hi,
I just wanted to provide some feedback that is is actually fairly simple to get this working entirely locally with not much effort.
I was finding that I would blow through openai credit like it was going out of style.
I'm running this on an M2Pro Mac Mini with 16gb of ram and it has no issues, its even faster than I found with the fully online configuration. Here is a guide for getting this all working
Local Code Indexer Setup Guide
Run claude-context MCP with LM Studio Embeddings & Milvus Vector Database
This guide walks through setting up a completely local, privacy-preserving code indexing system for Claude Desktop using open-source components.
Overview
The setup consists of three components:
- LM Studio - Provides local text embeddings via OpenAI-compatible API
- Milvus - Vector database for storing and searching code embeddings
- claude-context MCP - Bridges Claude Desktop with your indexed codebase
Prerequisites
All Platforms
- Claude Desktop installed and configured
- Docker Desktop installed and running
- At least 8GB RAM available (16GB recommended)
- 10GB+ free disk space
Platform-Specific
- macOS: Homebrew installed (for
claudeCLI) - Windows: WSL2 recommended for Docker
- Linux: Docker and docker-compose installed
Step 1: Install LM Studio
Download LM Studio
- Visit https://lmstudio.ai/
- Download the appropriate version:
- macOS: LM Studio.app (Apple Silicon or Intel)
- Windows: LM Studio Setup.exe
- Linux: LM Studio.AppImage
Configure LM Studio for Embeddings
- Launch LM Studio
- Go to the Models tab
- Search for:
nomic-embed-text-v2 - Download the GGUF version (recommended:
nomic-ai/nomic-embed-text-v2-moe-GGUF)- Alternative models:
all-MiniLM-L6-v2,gte-small,e5-small-v2
- Alternative models:
- Once downloaded, click Load Model
- Go to Local Server tab:
- Click Start Server
- Verify it shows:
Server running on http://localhost:1234 - Note the exact model name shown (e.g.,
text-embedding-nomic-embed-text-v2-moe)
Verify LM Studio API
macOS/Linux:
curl http://localhost:1234/v1/modelsWindows (PowerShell):
Invoke-RestMethod -Uri "http://localhost:1234/v1/models"You should see your loaded model in the response.
Step 2: Set Up Milvus Vector Database
Run Milvus with Docker
All Platforms (in terminal/PowerShell):
# Pull Milvus image
docker pull milvusdb/milvus:latest
# Run Milvus in standalone mode
docker run -d \
--name milvus-standalone \
-p 19530:19530 \
-p 9091:9091 \
-v milvus_data:/var/lib/milvus \
milvusdb/milvus:latest \
milvus run standaloneWindows PowerShell alternative:
docker run -d `
--name milvus-standalone `
-p 19530:19530 `
-p 9091:9091 `
-v milvus_data:/var/lib/milvus `
milvusdb/milvus:latest `
milvus run standaloneVerify Milvus is Running
docker logs milvus-standaloneLook for: Milvus Proxy successfully started
Step 3: Install Claude CLI (if not installed)
macOS
brew install claudeWindows/Linux
- Download from: https://github.com/anthropics/claude-cli
- Add to PATH
Verify Installation
claude --versionStep 4: Install claude-context MCP Plugin
One-Command Installation
Run this complete command in your terminal:
macOS/Linux:
claude mcp add code-indexer \
-e EMBEDDING_PROVIDER=OpenAI \
-e EMBEDDING_MODEL=text-embedding-nomic-embed-text-v2-moe \
-e OPENAI_API_KEY=local \
-e OPENAI_BASE_URL=http://127.0.0.1:1234/v1/ \
-e MILVUS_ADDRESS=127.0.0.1:19530 \
-e MILVUS_TOKEN=local \
-- npx @zilliz/claude-context-mcp@latestWindows PowerShell:
claude mcp add code-indexer `
-e EMBEDDING_PROVIDER=OpenAI `
-e EMBEDDING_MODEL=text-embedding-nomic-embed-text-v2-moe `
-e OPENAI_API_KEY=local `
-e OPENAI_BASE_URL=http://127.0.0.1:1234/v1/ `
-e MILVUS_ADDRESS=127.0.0.1:19530 `
-e MILVUS_TOKEN=local `
-- npx @zilliz/claude-context-mcp@latestAlternative: Manual Configuration
If you prefer manual setup, add to your Claude Desktop config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-indexer": {
"command": "npx",
"args": ["@zilliz/claude-context-mcp@latest"],
"env": {
"EMBEDDING_PROVIDER": "OpenAI",
"EMBEDDING_MODEL": "text-embedding-nomic-embed-text-v2-moe",
"OPENAI_API_KEY": "local",
"OPENAI_BASE_URL": "http://127.0.0.1:1234/v1/",
"MILVUS_ADDRESS": "127.0.0.1:19530",
"MILVUS_TOKEN": "local"
}
}
}
}Step 5: Restart Claude Desktop
- Fully quit Claude Desktop (not just close the window)
- Restart Claude Desktop
- Verify the MCP is loaded by typing in Claude:
What MCP tools do you have available?
Step 6: Add the Optimized Memory/Prompt
Add this memory to Claude Desktop to ensure optimal usage of the code indexer:
# code-indexer MCP Plugin Usage
## PRIMARY DIRECTIVE
When code-indexer MCP is available, ALWAYS use search_code before reading files directly. All tools require ABSOLUTE paths.
## Available Tools
### search_code (ALWAYS TRY FIRST)
- Default first action for any code exploration
- Requires: absolute path + natural language query
- Optional: limit, extensionFilter (['.ts', '.py'])
- If returns "not indexed" → use index_codebase
### index_codebase (ONLY WHEN NEEDED)
- Use ONLY when search_code returns "not indexed" error
- Never at session start
- Options: force, splitter, customExtensions, ignorePatterns
### get_indexing_status
- Check indexing progress
- Shows completion percentage
### clear_index
- Remove existing index
- Requires absolute path
## Workflow Rules
1. ALWAYS try search_code first
2. Index is PERSISTENT across sessions - don't re-index unnecessarily
3. New/modified files need re-indexing to be searchable
4. Search understands context: "auth" finds login, JWT, sessions
## Search Patterns
Effective queries:
- "authentication logic"
- "database connections"
- "error handling patterns"
- "API endpoints"
- "dependency injection"
- "repository pattern"
## NEVER
- Use relative paths
- Index without trying search first
- Read files without searching first
- Force re-index without user permission
## ALWAYS
- Use absolute paths
- Try search_code before any file operation
- Trust semantic search over file assumptionsUsage Examples
Once everything is set up, you can use natural language queries:
In Claude Desktop:
"Search for authentication logic in /Users/me/project"
"Find all API endpoints in the codebase"
"Show me database connection handling"
"Locate error handling patterns"The MCP will automatically:
- Create embeddings using your local LM Studio model
- Store vectors in your local Milvus instance
- Enable semantic search across your entire codebase
Troubleshooting
LM Studio Issues
- Model not loading: Ensure you have enough RAM (4GB minimum for embeddings)
- API not responding: Check server is started in Local Server tab
- Wrong model name: Copy exact name from LM Studio interface
Milvus Issues
- Container won't start: Check Docker Desktop is running
- Port conflict: Ensure port 19530 is not in use
- Out of memory: Allocate more memory to Docker (Settings → Resources)
MCP Connection Issues
- Tools not appearing: Restart Claude Desktop completely
- "Not indexed" errors: Run index_codebase with absolute path first
- Slow indexing: Normal for large codebases (10k+ files may take 1-2 minutes)
Verify Everything is Connected
- Check LM Studio server:
curl http://localhost:1234/v1/models - Check Milvus:
docker ps | grep milvus - In Claude: "What code-indexer tools are available?"
Performance Tips
- Initial Indexing: Index your main projects once, indexes persist across sessions
- Model Selection: Nomic-embed-text provides best balance of speed/quality
- Memory: Allocate at least 4GB to Docker for Milvus
- File Types: Focus on code files, exclude binaries and node_modules
Security & Privacy
This setup is completely local:
- ✅ No data leaves your machine
- ✅ No API keys required (using placeholder values)
- ✅ All embeddings stored locally in Milvus
- ✅ LM Studio runs offline after model download
- ✅ Perfect for proprietary/sensitive codebases
Next Steps
- Index your first project: "Index the codebase at /path/to/project"
- Search your code: "Find all instances of user authentication"
- Explore patterns: "Show me the repository pattern implementations"
- Refactor confidently: "Find all uses of the deprecated API"
Support & Resources
- LM Studio: https://lmstudio.ai/docs
- Milvus: https://milvus.io/docs
- claude-context: https://github.com/zilliztech/claude-context
- Claude MCP: https://modelcontextprotocol.io/
This setup ensures your code never leaves your machine while providing powerful semantic search capabilities to Claude Desktop.
Source: zilliztech/claude-context