Update Docs: Fully offline install guide

Author: SpaceyKaseyCreated Aug 15, 2025Updated Sep 12, 2026

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:

  1. LM Studio - Provides local text embeddings via OpenAI-compatible API
  2. Milvus - Vector database for storing and searching code embeddings
  3. 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 claude CLI)
  • Windows: WSL2 recommended for Docker
  • Linux: Docker and docker-compose installed

Step 1: Install LM Studio

Download LM Studio

  1. Visit https://lmstudio.ai/
  2. 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

  1. Launch LM Studio
  2. Go to the Models tab
  3. Search for: nomic-embed-text-v2
  4. Download the GGUF version (recommended: nomic-ai/nomic-embed-text-v2-moe-GGUF)
    • Alternative models: all-MiniLM-L6-v2, gte-small, e5-small-v2
  5. Once downloaded, click Load Model
  6. 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:

bash
curl http://localhost:1234/v1/models

Windows (PowerShell):

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):

bash
# 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 standalone

Windows PowerShell alternative:

powershell
docker run -d `
  --name milvus-standalone `
  -p 19530:19530 `
  -p 9091:9091 `
  -v milvus_data:/var/lib/milvus `
  milvusdb/milvus:latest `
  milvus run standalone

Verify Milvus is Running

bash
docker logs milvus-standalone

Look for: Milvus Proxy successfully started

Step 3: Install Claude CLI (if not installed)

macOS

bash
brew install claude

Windows/Linux

  1. Download from: https://github.com/anthropics/claude-cli
  2. Add to PATH

Verify Installation

bash
claude --version

Step 4: Install claude-context MCP Plugin

One-Command Installation

Run this complete command in your terminal:

macOS/Linux:

bash
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@latest

Windows PowerShell:

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@latest

Alternative: 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

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

  1. Fully quit Claude Desktop (not just close the window)
  2. Restart Claude Desktop
  3. 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:

markdown
# 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 assumptions

Usage 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:

  1. Create embeddings using your local LM Studio model
  2. Store vectors in your local Milvus instance
  3. 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

  1. Check LM Studio server: curl http://localhost:1234/v1/models
  2. Check Milvus: docker ps | grep milvus
  3. In Claude: "What code-indexer tools are available?"

Performance Tips

  1. Initial Indexing: Index your main projects once, indexes persist across sessions
  2. Model Selection: Nomic-embed-text provides best balance of speed/quality
  3. Memory: Allocate at least 4GB to Docker for Milvus
  4. 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

  1. Index your first project: "Index the codebase at /path/to/project"
  2. Search your code: "Find all instances of user authentication"
  3. Explore patterns: "Show me the repository pattern implementations"
  4. Refactor confidently: "Find all uses of the deprecated API"

Support & Resources


This setup ensures your code never leaves your machine while providing powerful semantic search capabilities to Claude Desktop.

Source: zilliztech/claude-context