claude-context Documentation

Code search MCP for Claude Code. Make entire codebase the context for any coding agent.

RAW Doc

File: README.md

πŸ†• Looking for persistent memory for Claude Code? Check out memsearch Claude Code plugin β€” a markdown-first memory system that gives your AI agent long-term memory across sessions.

Your entire codebase as Claude's context










Claude Context is an MCP plugin that adds semantic code search to Claude Code and other AI coding agents, giving them deep context from your entire codebase.

🧠 Your Entire Codebase as Context: Claude Context uses semantic search to find all relevant code from millions of lines. No multi-round discovery needed. It brings results straight into the Claude's context.

πŸ’° Cost-Effective for Large Codebases: Instead of loading entire directories into Claude for every request, which can be very expensive, Claude Context efficiently stores your codebase in a vector database and only uses related code in context to keep your costs manageable.


πŸš€ Demo

Model Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.

Quick Start

Prerequisites

Get a free vector database on Zilliz Cloud πŸ‘ˆ

Claude Context needs a vector database. You can sign up on Zilliz Cloud to get an API key.

Copy your Personal Key to replace your-zilliz-cloud-api-key in the configuration examples.

Get OpenAI API Key for embedding model

You need an OpenAI API key for the embedding model. You can get one by signing up at OpenAI.

Your API key will look like this: it always starts with sk-.
Copy your key and use it in the configuration examples below as your-openai-api-key.

Configure MCP for Claude Code

System Requirements:

  • Node.js >= 20.0.0

Configuration

Use the command line interface to add the Claude Context MCP server:

bash
claude mcp add claude-context \
  -e OPENAI_API_KEY=sk-your-openai-api-key \
  -e MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint \
  -e MILVUS_TOKEN=your-zilliz-cloud-api-key \
  -- npx @zilliz/claude-context-mcp@latest

See the Claude Code MCP documentation for more details about MCP server management.

Other MCP Client Configurations

OpenAI Codex CLI

Codex CLI uses TOML configuration files:

  1. Create or edit the ~/.codex/config.toml file.

  2. Add the following configuration:

toml
# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.
[mcp_servers.claude-context]
command = "npx"
args = ["@zilliz/claude-context-mcp@latest"]
env = { "OPENAI_API_KEY" = "your-openai-api-key", "MILVUS_TOKEN" = "your-zilliz-cloud-api-key" }
# Optional: override the default 10s startup timeout
startup_timeout_ms = 20000
  1. Save the file and restart Codex CLI to apply the changes.

Gemini CLI

Gemini CLI requires manual configuration through a JSON file:

  1. Create or edit the ~/.gemini/settings.json file.
  2. Add the following configuration:
json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file and restart Gemini CLI to apply the changes.

Qwen Code

Create or edit the ~/.qwen/settings.json file and add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Cursor

Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Pasting the following configuration into your Cursor ~/.cursor/mcp.json file is the recommended approach. You may also install in a specific project by creating .cursor/mcp.json in your project folder. See Cursor MCP docs for more info.

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Void

Go to: Settings -> MCP -> Add MCP Server

Add the following configuration to your Void MCP settings:

json
{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Windsurf

Windsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

VS Code

The Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Cherry Studio

Cherry Studio allows for visual MCP server configuration through its settings interface. While it doesn't directly support manual JSON configuration, you can add a new server via the GUI:

  1. Navigate to Settings β†’ MCP Servers β†’ Add Server.
  2. Fill in the server details:
    • Name: claude-context
    • Type: STDIO
    • Command: npx
    • Arguments: ["-y", "@zilliz/claude-context-mcp@latest"]
    • Environment Variables:
      • OPENAI_API_KEY: your-openai-api-key
      • MILVUS_ADDRESS: your-zilliz-cloud-public-endpoint
      • MILVUS_TOKEN: your-zilliz-cloud-api-key
  3. Save the configuration to activate the server.

Cline

Cline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:

  1. Open Cline and click on the MCP Servers icon in the top navigation bar.

  2. Select the Installed tab, then click Advanced MCP Settings.

  3. In the cline_mcp_settings.json file, add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file.

Augment

To configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.

**A. Using the Augment Code UI**

  1. Click the hamburger menu.

  2. Select Settings.

  3. Navigate to the Tools section.

  4. Click the + Add MCP button.

  5. Enter the following command:

    text
    npx @zilliz/claude-context-mcp@latest
  6. Name the MCP: Claude Context.

  7. Click the Add button.


**B. Manual Configuration**

  1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
  2. Select Edit Settings
  3. Under Advanced, click Edit in settings.json
  4. Add the server configuration to the mcpServers array in the augment.advanced object
json
"augment.advanced": { 
  "mcpServers": [ 
    { 
      "name": "claude-context", 
      "command": "npx", 
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  ]
}

Roo Code

Roo Code utilizes a JSON configuration file for MCP servers:

  1. Open Roo Code and navigate to Settings β†’ MCP Servers β†’ Edit Global Config.

  2. In the mcp_settings.json file, add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file to activate the server.

Zencoder

Zencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.

  1. Go to the Zencoder menu (...)
  2. From the dropdown menu, select Tools
  3. Click on the Add Custom MCP
  4. Add the name (i.e. Claude Context and server configuration from below, and make sure to hit the Install button
json
{
    "command": "npx",
    "args": ["@zilliz/claude-context-mcp@latest"],
    "env": {
      "OPENAI_API_KEY": "your-openai-api-key",
      "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
      "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
    }
}
  1. Save the server by hitting the Install button.

LangChain/LangGraph

For LangChain/LangGraph integration examples, see this example.

Other MCP Clients

The server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:

bash
npx @zilliz/claude-context-mcp@latest

Usage in Your Codebase

  1. Open Claude Code

    text
    cd your-project-directory
    claude
  2. Index your codebase:

    text
    Index this codebase
  3. Check indexing status:

    text
    Check the indexing status
  4. Start searching:

    text
    Find functions that handle user authentication

πŸŽ‰ That's it! You now have semantic code search in Claude Code.


Environment Variables Configuration

For more detailed MCP environment variable configuration, see our Environment Variables Guide.

Using Different Embedding Models

To configure custom embedding models (e.g., text-embedding-3-large for OpenAI, voyage-code-3 for VoyageAI), see the MCP Configuration Examples for detailed setup instructions for each provider.

File Inclusion & Exclusion Rules

For detailed explanation of file inclusion and exclusion rules, and how to customize them, see our File Inclusion & Exclusion Rules.

Available Tools

1. `index_codebase`

Index a codebase directory for hybrid search (BM25 + dense vector).

2. `search_code`

Search the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).

3. `clear_index`

Clear the search index for a specific codebase.

4. `get_indexing_status`

Get the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.


πŸ“Š Evaluation

Our controlled evaluation demonstrates that Claude Context MCP achieves ~40% token reduction under the condition of equivalent retrieval quality. This translates to significant cost and time savings in production environments. This also means that, under the constraint of limited token context length, using Claude Context yields better retrieval and answer results.

For detailed evaluation methodology and results, see the evaluation directory.


πŸ—οΈ Architecture

πŸ”§ Implementation Details

  • πŸ” Hybrid Code Search: Ask questions like "find functions that handle user authentication" and get relevant, context-rich code instantly using advanced hybrid search (BM25 + dense vector).
  • 🧠 Context-Aware: Discover large codebase, understand how different parts of your codebase relate, even across millions of lines of code.
  • ⚑ Incremental Indexing: Efficiently re-index only changed files using Merkle trees.
  • 🧩 Intelligent Code Chunking: Analyze code in Abstract Syntax Trees (AST) for chunking.
  • πŸ—„οΈ Scalable: Integrates with Zilliz Cloud for scalable vector search, no matter how large your codebase is.
  • πŸ› οΈ Customizable: Configure file extensions, ignore patterns, and embedding models.

Core Components

Claude Context is a monorepo containing three main packages:

  • @zilliz/claude-context-core: Core indexing engine with embedding and vector database integration
  • VSCode Extension: Semantic Code Search extension for Visual Studio Code
  • @zilliz/claude-context-mcp: Model Context Protocol server for AI agent integration

Supported Technologies

  • Embedding Providers: OpenAI, VoyageAI, Ollama, Gemini
  • Vector Databases: Milvus or Zilliz Cloud(fully managed vector database as a service)
  • Code Splitters: AST-based splitter (with automatic fallback), LangChain character-based splitter
  • Languages: TypeScript, JavaScript, Python, Java, C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, Markdown
  • Development Tools: VSCode, Model Context Protocol

πŸ“¦ Other Ways to Use Claude Context

While MCP is the recommended way to use Claude Context with AI assistants, you can also use it directly or through the VSCode extension.

Build Applications with Core Package

The @zilliz/claude-context-core package provides the fundamental functionality for code indexing and semantic search.

typescript
import { Context, MilvusVectorDatabase, OpenAIEmbedding } from '@zilliz/claude-context-core';

// Initialize embedding provider
const embedding = new OpenAIEmbedding({
    apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',
    model: 'text-embedding-3-small'
});

// Initialize vector database
const vectorDatabase = new MilvusVectorDatabase({
    address: process.env.MILVUS_ADDRESS || 'your-zilliz-cloud-public-endpoint',
    token: process.env.MILVUS_TOKEN || 'your-zilliz-cloud-api-key'
});

// Create context instance
const context = new Context({
    embedding,
    vectorDatabase
});

// Index your codebase with progress tracking
const stats = await context.indexCodebase('./your-project', (progress) => {
    console.log(`${progress.phase} - ${progress.percentage}%`);
});
console.log(`Indexed ${stats.indexedFiles} files, ${stats.totalChunks} chunks`);

// Perform semantic search
const results = await context.semanticSearch('./your-project', 'vector database operations', 5);
results.forEach(result => {
    console.log(`File: ${result.relativePath}:${result.startLine}-${result.endLine}`);
    console.log(`Score: ${(result.score * 100).toFixed(2)}%`);
    console.log(`Content: ${result.content.substring(0, 100)}...`);
});

VSCode Extension

Integrates Claude Context directly into your IDE. Provides an intuitive interface for semantic code search and navigation.

  1. Direct Link: Install from VS Code Marketplace
  2. Manual Search:
    • Open Extensions view in VSCode (Ctrl+Shift+X or Cmd+Shift+X on Mac)
    • Search for "Semantic Code Search"
    • Click Install

πŸ› οΈ Development

Setup Development Environment

Prerequisites

  • Node.js 20.x, 22.x, or 24.x
  • pnpm (recommended package manager)

Cross-Platform Setup

bash
# Clone repository
git clone https://github.com/zilliztech/claude-context.git
cd claude-context

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Start development mode
pnpm dev

Windows-Specific Setup

On Windows, ensure you have:

  • Git for Windows with proper line ending configuration
  • Node.js installed via the official installer or package manager
  • pnpm installed globally: npm install pnpm
powershell
# Windows PowerShell/Command Prompt
git clone https://github.com/zilliztech/claude-context.git
cd claude-context

# Configure git line endings (recommended)
git config core.autocrlf false

# Install dependencies
pnpm install

# Build all packages (uses cross-platform scripts)
pnpm build

# Start development mode
pnpm dev

Building

bash
# Build all packages (cross-platform)
pnpm build

# Build specific package
pnpm build:core
pnpm build:vscode
pnpm build:mcp

# Performance benchmarking
pnpm benchmark

Windows Build Notes

  • All build scripts are cross-platform compatible using rimraf
  • Build caching is enabled for faster subsequent builds
  • Use PowerShell or Command Prompt - both work equally well

Running Examples

bash
# Development with file watching
cd examples/basic-usage
pnpm dev

πŸ“– Examples

Check the /examples directory for complete usage examples:

  • Basic Usage: Simple indexing and search example

❓ FAQ

Common Questions:

❓ For detailed answers and more troubleshooting tips, see our FAQ Guide.

πŸ”§ Encountering issues? Visit our Troubleshooting Guide for step-by-step solutions.

πŸ“š Need more help? Check out our complete documentation for detailed guides and troubleshooting tips.


🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

Package-specific contributing guides:


πŸ—ΊοΈ Roadmap

  • AST-based code analysis for improved understanding
  • Support for additional embedding providers
  • Agent-based interactive search mode
  • Enhanced code chunking strategies
  • Search result ranking optimization
  • Robust Chrome Extension

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.



File: docs/getting-started/environment-variables.md

Environment Variables Configuration

🎯 Global Configuration

Claude Context supports a global configuration file at ~/.context/.env to simplify MCP setup across different MCP clients.

Benefits:

  • Configure once, use everywhere
  • No need to specify environment variables in each MCP client
  • Cleaner MCP configurations

πŸ“‹ Environment Variable Priority

  1. Process Environment Variables (highest)
  2. Global Configuration File (~/.context/.env)
  3. Default Values (lowest)

πŸ”§ Required Environment Variables

Embedding Provider

Variable Description Default
EMBEDDING_PROVIDER Provider: OpenAI, VoyageAI, Gemini, Ollama OpenAI
EMBEDDING_MODEL Embedding model name (works for all providers) Provider-specific default
OPENAI_API_KEY OpenAI API key Required for OpenAI
OPENAI_BASE_URL OpenAI API base URL (optional, for custom endpoints) https://api.openai.com/v1
VOYAGEAI_API_KEY VoyageAI API key Required for VoyageAI
GEMINI_API_KEY Gemini API key Required for Gemini
GEMINI_BASE_URL Gemini API base URL (optional, for custom endpoints) https://generativelanguage.googleapis.com/v1beta

πŸ’‘ Note: EMBEDDING_MODEL is a universal environment variable that works with all embedding providers. Simply set it to the model name you want to use (e.g., text-embedding-3-large for OpenAI, voyage-code-3 for VoyageAI, etc.).

Supported Model Names:

  • OpenAI Models: See getSupportedModels in openai-embedding.ts for the full list of supported models.

  • VoyageAI Models: See getSupportedModels in voyageai-embedding.ts for the full list of supported models.

  • Gemini Models: See getSupportedModels in gemini-embedding.ts for the full list of supported models.

  • Ollama Models: Depends on the model you install locally.

πŸ“– For detailed provider-specific configuration examples and setup instructions, see the MCP Configuration Guide.

Vector Database

Variable Description Default
MILVUS_TOKEN Milvus authentication token. Get Zilliz Personal API Key Recommended
MILVUS_ADDRESS Milvus server address. Optional when using Zilliz Personal API Key Auto-resolved from token
MILVUS_COLLECTION_LIMIT_CHECK_TIMEOUT_MS Timeout for gRPC pre-check in checkCollectionLimit() before indexing begins 15000

Ollama (Optional)

Variable Description Default
OLLAMA_HOST Ollama server URL http://127.0.0.1:11434
OLLAMA_MODEL(alternative to EMBEDDING_MODEL) Model name

Advanced Configuration

Variable Description Default
HYBRID_MODE Enable hybrid search (BM25 + dense vector). Set to false for dense-only search true
EMBEDDING_BATCH_SIZE Batch size for processing. Larger batch size means less indexing time 100
SPLITTER_TYPE Code splitter type: ast, langchain ast
CUSTOM_EXTENSIONS Additional file extensions to include (comma-separated, e.g., .vue,.svelte,.astro) None
CUSTOM_IGNORE_PATTERNS Additional ignore patterns (comma-separated, e.g., temp/**,*.backup,private/**) None
CODE_CHUNKS_COLLECTION_NAME_OVERRIDE Optional custom prefix for collection names. Produces code_chunks_<suffix>_ or hybrid_code_chunks_<suffix>_ after sanitization. The path hash stays appended so collections remain unique per codebase even when the override is set None

When CODE_CHUNKS_COLLECTION_NAME_OVERRIDE is set, Claude Context writes to an override-named collection instead of the default code_chunks_. The per-codebase `` suffix is preserved to keep multiple codebases distinct under the same override. If you later unset the variable, Claude Context returns to the plain hash-based naming for that path.

πŸš€ Quick Setup

1. Create Global Config

bash
mkdir -p ~/.context
cat > ~/.context/.env << 'EOF'
EMBEDDING_PROVIDER=OpenAI
OPENAI_API_KEY=sk-your-openai-api-key
EMBEDDING_MODEL=text-embedding-3-small
MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint
MILVUS_TOKEN=your-zilliz-cloud-api-key
EOF

See the Example File for more details.

2. Simplified MCP Configuration

Claude Code:

bash
claude mcp add claude-context \
  -e OPENAI_API_KEY=sk-your-openai-api-key \
  -e MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint \
  -e MILVUS_TOKEN=your-zilliz-cloud-api-key \
  -- npx @zilliz/claude-context-mcp@latest

Cursor/Windsurf/Others:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"]
    }
  }
}

πŸ“š Additional Information

For detailed information about file processing rules and how custom patterns work, see:


File: docs/getting-started/prerequisites.md

Prerequisites

Before setting up Claude Context, ensure you have the following requirements met.

Required Services

Embedding Provider (Choose One)

  • API Key: Get from OpenAI Platform
  • Billing: Active billing account required
  • Models: text-embedding-3-small or text-embedding-3-large
  • Rate Limits: Check current limits on your OpenAI account

Option 2: VoyageAI

  • API Key: Get from VoyageAI Console
  • Models: voyage-code-3 (optimized for code)
  • Billing: Pay-per-use pricing

Option 3: Gemini

  • API Key: Get from Google AI Studio
  • Models: gemini-embedding-001, gemini-embedding-2
  • Quota: Check current quotas and limits

Option 4: Ollama (Local)

  • Installation: Download from ollama.com
  • Models: Pull embedding models like nomic-embed-text
  • Hardware: Sufficient RAM for model loading (varies by model)

Vector Database

  • Account: Sign up on Zilliz Cloud to get an API key.
  • Convenience: Fully managed Milvus vector database service without the need to install and manage it.

Local Milvus (Advanced)

  • Docker: Install Milvus by following this guide
  • Resources: More complex configuration required

Development Tools (Optional)

For VSCode Extension

  • VSCode: Version 1.74.0 or higher
  • Extensions: Claude Context extension from marketplace

For Development Contributions

  • Git: For version control
  • pnpm: Package manager (preferred over npm)
  • TypeScript: Understanding of TypeScript development

File: docs/getting-started/quick-start.md

Quick Start Guide

Get Claude Context running with AI assistants in under 5 minutes! This guide covers the most common setup using MCP (Model Context Protocol) with Claude Code.

πŸš€ 1-Minute Setup for Claude Code

Step 1: Get API Keys

You'll need two API keys:

  1. OpenAI API Key: Get from OpenAI Platform
  2. Zilliz Cloud API Key:
    Sign up on Zilliz Cloud to get an API key.

Step 2: Configure Claude Code

Run this single command to add Claude Context to Claude Code:

bash
claude mcp add claude-context \
  -e OPENAI_API_KEY=sk-your-openai-api-key \
  -e MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint \
  -e MILVUS_TOKEN=your-zilliz-cloud-api-key \
  -- npx @zilliz/claude-context-mcp@latest

Replace the API keys with your actual keys.

Step 3: Start Using Claude Context

  1. Open Claude Code in your project directory
  2. Index your codebase:
    text
    Index this codebase
  3. Check indexing status:
    text
    Check the indexing status
  4. Start searching:
    text
    Find functions that handle user authentication

πŸŽ‰ That's it! You now have semantic code search in Claude Code.

Alternative Quick Setups

OpenAI Codex CLI

Codex CLI uses TOML configuration files:

  1. Create or edit the ~/.codex/config.toml file.

  2. Add the following configuration:

toml
# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.
[mcp_servers.claude-context]
command = "npx"
args = ["@zilliz/claude-context-mcp@latest"]
env = { "OPENAI_API_KEY" = "your-openai-api-key", "MILVUS_TOKEN" = "your-zilliz-cloud-api-key" }
# Optional: override the default 10s startup timeout
startup_timeout_ms = 20000
  1. Save the file and restart Codex CLI to apply the changes.

Gemini CLI

Gemini CLI requires manual configuration through a JSON file:

  1. Create or edit the ~/.gemini/settings.json file.

  2. Add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file and restart Gemini CLI to apply the changes.

Qwen Code

Create or edit the ~/.qwen/settings.json file and add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Cursor

Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Pasting the following configuration into your Cursor ~/.cursor/mcp.json file is the recommended approach. You may also install in a specific project by creating .cursor/mcp.json in your project folder. See Cursor MCP docs for more info.

OpenAI Configuration (Default):

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "EMBEDDING_PROVIDER": "OpenAI",
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

VoyageAI Configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "EMBEDDING_PROVIDER": "VoyageAI",
        "VOYAGEAI_API_KEY": "your-voyageai-api-key",
        "EMBEDDING_MODEL": "voyage-code-3",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Gemini Configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "EMBEDDING_PROVIDER": "Gemini",
        "GEMINI_API_KEY": "your-gemini-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Ollama Configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "EMBEDDING_PROVIDER": "Ollama",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "OLLAMA_HOST": "http://127.0.0.1:11434",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Void

Go to: Settings -> MCP -> Add MCP Server

Add the following configuration to your Void MCP settings:

json
{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Windsurf

Windsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

VS Code

The Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["-y", "@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}

Cherry Studio

Cherry Studio allows for visual MCP server configuration through its settings interface. While it doesn't directly support manual JSON configuration, you can add a new server via the GUI:

  1. Navigate to Settings β†’ MCP Servers β†’ Add Server.
  2. Fill in the server details:
    • Name: claude-context
    • Type: STDIO
    • Command: npx
    • Arguments: ["-y", "@zilliz/claude-context-mcp@latest"]
    • Environment Variables:
      • OPENAI_API_KEY: your-openai-api-key
      • MILVUS_TOKEN: your-zilliz-cloud-api-key
  3. Save the configuration to activate the server.

Cline

Cline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:

  1. Open Cline and click on the MCP Servers icon in the top navigation bar.

  2. Select the Installed tab, then click Advanced MCP Settings.

  3. In the cline_mcp_settings.json file, add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file.

Augment

To configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.

**A. Using the Augment Code UI**

  1. Click the hamburger menu.

  2. Select Settings.

  3. Navigate to the Tools section.

  4. Click the + Add MCP button.

  5. Enter the following command:

    text
    npx @zilliz/claude-context-mcp@latest
  6. Name the MCP: Claude Context.

  7. Click the Add button.


**B. Manual Configuration**

  1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
  2. Select Edit Settings
  3. Under Advanced, click Edit in settings.json
  4. Add the server configuration to the mcpServers array in the augment.advanced object
json
"augment.advanced": { 
  "mcpServers": [ 
    { 
      "name": "claude-context", 
      "command": "npx", 
      "args": ["-y", "@zilliz/claude-context-mcp@latest"] 
    } 
  ] 
}

Roo Code

Roo Code utilizes a JSON configuration file for MCP servers:

  1. Open Roo Code and navigate to Settings β†’ MCP Servers β†’ Edit Global Config.

  2. In the mcp_settings.json file, add the following configuration:

json
{
  "mcpServers": {
    "claude-context": {
      "command": "npx",
      "args": ["@zilliz/claude-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key",
        "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
      }
    }
  }
}
  1. Save the file to activate the server.

Zencoder

Zencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.

  1. Go to the Zencoder menu (...)
  2. From the dropdown menu, select Tools
  3. Click on the Add Custom MCP
  4. Add the name (i.e. Claude Context and server configuration from below, and make sure to hit the Install button
json
{
    "command": "npx",
    "args": ["@zilliz/claude-context-mcp@latest"],
    "env": {
      "OPENAI_API_KEY": "your-openai-api-key",
      "MILVUS_ADDRESS": "your-zilliz-cloud-public-endpoint",
      "MILVUS_TOKEN": "your-zilliz-cloud-api-key"
    }
}
  1. Save the server by hitting the Install button.

LangChain/LangGraph

For LangChain/LangGraph integration examples, see this example.

Other MCP Clients

The server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:

bash
npx @zilliz/claude-context-mcp@latest

πŸ’‘ Tip: For easier configuration management, you can use global environment variables instead of specifying them in each MCP client configuration.


File: docs/dive-deep/asynchronous-indexing-workflow.md

Asynchronous Indexing Workflow

This document explains how Claude Context MCP handles codebase indexing asynchronously in the background.

Core Concept

Claude Context MCP server allows users to start indexing and get an immediate response, while the actual indexing happens in the background. Users can search and monitor progress at any time.

How It Works

The sequence diagram above demonstrates the timing and interaction between the agent, MCP server, and background process.

The agent receives an immediate response when starting indexing, then the users can perform searches and status checks through the agent while indexing continues in the background.

State Flow

The flow diagram above shows the complete indexing workflow, illustrating how the system handles different states and user interactions. The key insight is that indexing starts immediately but runs in the background, allowing users to interact with the system at any time.

MCP Tools

  • index_codebase - Starts background indexing, returns immediately
  • search_code - Searches codebase (works during indexing with partial results)
  • get_indexing_status - Shows current progress and status
  • clear_index - Removes indexed data

Status States

  • indexed - βœ… Ready for search
  • indexing - πŸ”„ Background process running
  • indexfailed - ❌ Error occurred, can retry
  • not_found - ❌ Not indexed yet

How Progress Is Calculated

get_indexing_status reports a coarse, phase-based percentage, not an exact fraction of files completed.

  • 0% - Preparing the target collection and validating indexing prerequisites
  • ~5% - Scanning the codebase and building the file list
  • 10% β†’ 100% - Processing files, chunking code, generating embeddings, and writing batches to the vector database
  • 100% - Indexing finished successfully

This means it is normal for indexing to jump to around 10% quickly on a large codebase. It reflects a transition from setup phases into file processing, not that exactly one tenth of all files are already indexed.

Progress is also persisted periodically to the local MCP snapshot file at ~/.context/mcp-codebase-snapshot.json, so very fast phases may appear as jumps rather than smooth increments.

When File and Chunk Counts Appear

get_indexing_status shows file and chunk totals after a run has completed and the final statistics have been written to the local snapshot.

During active indexing, the MCP server tracks progress percentage, but it does not stream live file/chunk totals through get_indexing_status.

If you see an indexed entry with 0 files, 0 chunks, that usually means the local snapshot metadata is stale or was created by an older / incomplete bookkeeping path. It is not a live count fetched from the vector database at status-check time.

To refresh those stored totals, clear and re-index the same absolute path.

How Codebases Are Identified

Claude Context tracks codebases by their resolved absolute path.

  • The MCP tools resolve relative paths to absolute paths before indexing, searching, clearing, or checking status.
  • Collection identity is derived from the normalized absolute path.
  • If you index the same repository through different absolute paths (for example, a symlink, a different clone, or a mounted path), Claude Context treats them as separate codebases.

For the most predictable behavior, always use the same absolute path for index_codebase, search_code, clear_index, and get_indexing_status.

Key Benefits

  • Non-blocking: Agent gets immediate response
  • Progressive: Can search partial results while indexing
  • Resilient: Handles errors gracefully with retry capability
  • Transparent: Always know current status

File: docs/dive-deep/file-inclusion-rules.md

File Inclusion & Exclusion Rules

This document explains how Claude Context determines which files to include in the indexing process and which files to exclude.

Overview

Claude Context uses a comprehensive rule system that combines multiple sources of file extensions and ignore patterns to determine what gets indexed.

The Core Rule

text
Final Files = (All Supported Extensions) - (All Ignore Patterns)

Where:

  • All Supported Extensions = Default + MCP Custom + Environment Variable Extensions
  • All Ignore Patterns = Default + MCP Custom + Environment Variable + .gitignore + .xxxignore + Global .contextignore

File Inclusion Flow

The diagram above shows how different sources contribute to the final file selection process.

Extension Sources (Additive)

All extension sources are combined together:

1. Default Extensions

Built-in supported file extensions including:

  • Programming languages: .ts, .tsx, .js, .jsx, .py, .java, .cpp, .c, .h, .hpp, .cs, .go, .rs, .php, .rb, .swift, .kt, .scala, .m, .mm, .dart, .sol
  • Documentation: .md, .markdown, .ipynb

For more details, see DEFAULT_SUPPORTED_EXTENSIONS in the context.ts file.

2. MCP Custom Extensions

Additional extensions passed dynamically via MCP customExtensions parameter:

json
{
  "customExtensions": [".vue", ".svelte", ".astro"]
}

Just dynamically tell the agent what extensions you want to index to invoke this parameter. For example:

text
"Index this codebase, and include .vue, .svelte, .astro files"

3. Environment Variable Extensions

Extensions from CUSTOM_EXTENSIONS environment variable:

bash
export CUSTOM_EXTENSIONS=".vue,.svelte,.astro"

See Environment Variables for more details about how to set environment variables.

Ignore Pattern Sources (Additive)

All ignore pattern sources are combined together:

1. Default Ignore Patterns

Built-in patterns for common files/directories to exclude:

  • Build outputs: node_modules/**, dist/**, build/**, out/**, target/**, coverage/**, .nyc_output/**
  • IDE files: .vscode/**, .idea/**, *.swp, *.swo
  • Version control: .git/**, .svn/**, .hg/**
  • Cache directories: .cache/**, __pycache__/**, .pytest_cache/**
  • Logs and temporary: logs/**, tmp/**, temp/**, *.log
  • Environment files: .env, .env.*, *.local
  • Minified files: *.min.js, *.min.css, *.min.map, *.bundle.js, *.bundle.css, *.chunk.js, *.vendor.js, *.polyfills.js, *.runtime.js, *.map

For more details, see DEFAULT_IGNORE_PATTERNS in the context.ts file.

2. MCP Custom Ignore Patterns

Additional patterns passed dynamically via MCP ignorePatterns parameter:

json
{
  "ignorePatterns": ["temp/**", "*.backup", "private/**"]
}

Just dynamically tell the agent what patterns you want to exclude to invoke this parameter. For example:

text
"Index this codebase, and exclude temp/**, *.backup, private/** files"

3. Environment Variable Ignore Patterns

Patterns from CUSTOM_IGNORE_PATTERNS environment variable:

bash
export CUSTOM_IGNORE_PATTERNS="temp/**,*.backup,private/**"

See Environment Variables for more details about how to set environment variables.

4. .gitignore Files

Standard Git ignore patterns in codebase root.

5. .xxxignore Files

Any file in codebase root matching pattern .xxxignore:

  • .cursorignore
  • .codeiumignore
  • .contextignore
  • etc.

6. Global .contextignore

User-wide patterns in ~/.context/.contextignore.


File: docs/troubleshooting/faq.md

Frequently Asked Questions (FAQ)

Q: What files does Claude Context decide to embed?

A: Claude Context uses a comprehensive rule system to determine which files to include in indexing:

Simple Rule:

text
Final Files = (All Supported Extensions) - (All Ignore Patterns)
  • Extensions are additive: Default extensions + MCP custom + Environment variables
  • Ignore patterns are additive: Default patterns + MCP custom + Environment variables + .gitignore + .xxxignore files + global .contextignore

For detailed explanation see: File Inclusion Rules

Q: Can I use a fully local deployment setup?

A: Yes, you can deploy Claude Context entirely on your local infrastructure. While we recommend using the fully managed Zilliz Cloud service for ease of use, you can also set up your own private local deployment.

For local deployment:

  1. Vector Database (Milvus): Deploy Milvus locally using Docker Compose by following the official Milvus installation guide. Configure the following environment variables:

    • MILVUS_ADDRESS=127.0.0.1:19530 (or your Milvus server address)
    • MILVUS_TOKEN=your-optional-token (if authentication is enabled)
  2. Embedding Service (Ollama): Install and run Ollama locally for embedding generation. Configure:

    • EMBEDDING_PROVIDER=Ollama
    • OLLAMA_HOST=http://127.0.0.1:11434 (or your Ollama server URL)
    • OLLAMA_MODEL=nomic-embed-text (or your preferred embedding model)

This setup gives you complete control over your data while maintaining full functionality. See our environment variables guide for detailed configuration options.

Q: Does it support multiple projects / codebases?

A: Yes, Claude Context fully supports multiple projects and codebases. In MCP mode, it automatically leverages the MCP client's AI Agent to detect and obtain the current codebase path where you're working.

You can seamlessly use queries like index this codebase or search the main function without specifying explicit paths. When you switch between different codebase working directories, Claude Context automatically discovers the change and adapts accordingly - no need to manually input specific codebase paths.

Key features for multi-project support:

  • Automatic Path Detection: Leverages MCP client's workspace awareness to identify current working directory
  • Seamless Project Switching: Automatically detects when you switch between different codebases
  • Background Code Synchronization: Continuously monitors for changes and automatically re-indexes modified parts
  • Context-Aware Operations: All indexing and search operations are scoped to the current project context

Important path detail: Claude Context keys each indexed codebase by its absolute path. If you index the same repository through different paths (for example, a symlinked path, a second clone, or a mounted path), those are treated as separate indexed codebases.

This makes it effortless to work across multiple projects while maintaining isolated, up-to-date indexes for each codebase.

Q: Why does `get_indexing_status` jump quickly to 10% or feel coarse?

A: The percentage is a phase-based progress indicator, not a live fraction of indexed files.

In practice, Claude Context moves through broad stages:

  • collection preparation
  • file scanning
  • file processing, chunking, embedding, and insertion

The status output can therefore jump quickly to around 10% once setup is complete, even for very large repositories. That is expected behavior.

For the full background workflow, see Asynchronous Indexing Workflow.

Q: Why does `get_indexing_status` show `0 files, 0 chunks` for a completed codebase?

A: get_indexing_status reads the MCP snapshot metadata, not a live aggregate directly from the vector database.

If a completed entry shows 0 files, 0 chunks, the most common explanation is that the local snapshot metadata is stale or was created before final statistics were refreshed.

What to do:

  1. Make sure you are checking the same absolute path that you originally indexed.
  2. If the entry still shows zero counts, run clear_index for that path.
  3. Re-run index_codebase for that exact absolute path.

This refreshes the stored file/chunk totals used by get_indexing_status.

Q: How does Claude Context compare to other coding tools like Serena, Context7, or DeepWiki?

A: Claude Context is specifically focused on codebase indexing and semantic search. Here's how we compare:

  • Serena: A comprehensive coding agent toolkit with language server integration and symbolic code understanding. Provides broader AI coding capabilities.

  • Context7: Focuses on providing up-to-date documentation and code examples to prevent "code hallucination" in LLMs. Targets documentation accuracy.

  • DeepWiki: Generates interactive documentation from GitHub repositories. Creates documentation from code.

Our focus: Making your entire codebase searchable and contextually available to AI assistants through efficient vector-based indexing and hybrid search.


File: docs/README.md

Claude Context Documentation

Welcome to the Claude Context documentation! Claude Context is a powerful tool that adds semantic code search capabilities to AI coding assistants through MCP.

πŸš€ Quick Navigation

Getting Started

Components

Dive Deep

Troubleshooting

πŸ”— External Resources

πŸ’¬ Support


File: evaluation/case_study/pydata_xarray_6938/README.md

Xarray 6938: swap_dims() Mutation Bug

A case study showing how both methods(grep + semantic search) efficiently identify object mutation bugs in scientific computing libraries.

πŸ“‹ Original GitHub Issue

`.swap_dims()` can modify original object

Problem: In certain cases, .swap_dims() modifies the original object instead of returning a new one, violating immutability expectations.

Example:

python
import numpy as np
import xarray as xr

nz = 11
ds = xr.Dataset({
    "y": ("z", np.random.rand(nz)),
    "lev": ("z", np.arange(nz) * 10),
})

# This should not modify ds, but it does
ds2 = ds.swap_dims(z="lev").rename_dims(lev="z").reset_index("lev").reset_coords()
ds2.swap_dims(z='lev')  # This modifies ds2['lev'] unexpectedly

# ds2['lev'] now has dimension 'lev' instead of 'z'

Expected: Original objects should remain unchanged after swap_dims operations.
Actual: Original object's internal state gets modified during dimension swapping.

Files: xarray/core/dataset.py, xarray/core/variable.py

Results

Metric Both Methods Grep Method Improvement
Token Usage 15,826 41,999 62% less
Tool Calls 3 11 73% fewer
Success Rate 50% hit 50% hit Equal accuracy

How Each Method Found the Problem

🎯 Both Methods

log
πŸ”§ search_code('.swap_dims()')
βš™οΈ Arguments: {'path': 'repo__pydata__xarray', 'query': '.swap_dims()', 'limit': 10}
   Result: Found 10 results for query: ".swap_dims()" in codebase
   1. Code snippet (python) [repo__pydata__xarray]
      Location: xarray/tests/test_formatting_html.py:67-76
   2. Code snippet (python) [repo__pydata__xarray]
      Location: xarray/tests/test_dataset.py:2926-2979

πŸ”§ edit_file('xarray/core/dataset.py')
βš™οΈ Arguments: {'old_string': 'result_dims = {dims_dict.get(dim, dim) for dim in self.dims}', 'new_string': 'result_dims = {dims_dict.get(dim, dim) for dim in self.dims if dim in dims_dict or dim not in self.variables}'}
   Result: Successfully modified file

πŸ”§ edit_file('xarray/core/dataarray.py')
βš™οΈ Arguments: {'old_string': 'ds = self._to_temp_dataset().swap_dims(dims_dict)', 'new_string': 'ds = self._to_temp_dataset().swap_dims(dims_dict)  # Ensure that ds does not modify the original DataArray'}
   Result: Successfully modified file

Key Success: Semantic search immediately located the actual swap_dims() implementations and understood the functional context.

πŸ” Grep Method

text
/* Detailed source-code truncated for AI context efficiency. */

Key Inefficiency: Used massive list_directory and read_file operations, instead of focusing on relevant methods.

Why Grep + Semantic Search Won

  1. Method-Level Understanding: Recognized .swap_dims() as a specific method with defined behavior
  2. Functional Context: Understood the relationship between Dataset, DataArray, and Variable classes
  3. Efficient Navigation: Directly located method implementations without searching through tests and docs
  4. Mutation Awareness: Connected the symptom (unexpected changes) to likely causes (shared references)

Why Grep Was Less Efficient

  1. Information Overload: Generated hundreds of matches for common terms like 'swap_dims' and 'dimension'
  2. Context Loss: Treated method names as text strings rather than functional concepts
  3. Inefficient Reading: Required reading large portions of files to understand basic functionality

Key Insights

Semantic Search Advantages:

  • Concept Recognition: Understands .swap_dims() as a method concept, not just text
  • Relationship Mapping: Automatically connects related classes and methods
  • Relevance Filtering: Prioritizes implementation code over tests and documentation
  • Efficiency: Achieves same accuracy with 62% fewer tokens and 73% fewer operations

Traditional Search Limitations:

  • Text Literalism: Treats code as text without understanding semantic meaning
  • Noise Generation: Produces excessive irrelevant matches across different contexts
  • Resource Waste: Consumes 2.6x more computational resources for equivalent results
  • Scalability Issues: Becomes increasingly inefficient with larger codebases

This case demonstrates semantic search's particular value for scientific computing libraries where data integrity is paramount and mutation bugs can corrupt research results.

Files