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:
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@latestSee 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:
Create or edit the
~/.codex/config.tomlfile.Add the following configuration:
# 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- Save the file and restart Codex CLI to apply the changes.
Gemini CLI
Gemini CLI requires manual configuration through a JSON file:
- Create or edit the
~/.gemini/settings.jsonfile. - Add the following configuration:
{
"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"
}
}
}
}- 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:
{
"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.
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
- Navigate to Settings β MCP Servers β Add Server.
- 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-keyMILVUS_ADDRESS:your-zilliz-cloud-public-endpointMILVUS_TOKEN:your-zilliz-cloud-api-key
- Name:
- 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:
Open Cline and click on the MCP Servers icon in the top navigation bar.
Select the Installed tab, then click Advanced MCP Settings.
In the
cline_mcp_settings.jsonfile, add the following configuration:
{
"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"
}
}
}
}- 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**
Click the hamburger menu.
Select Settings.
Navigate to the Tools section.
Click the + Add MCP button.
Enter the following command:
textnpx @zilliz/claude-context-mcp@latestName the MCP: Claude Context.
Click the Add button.
**B. Manual Configuration**
- Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
- Select Edit Settings
- Under Advanced, click Edit in settings.json
- Add the server configuration to the
mcpServersarray in theaugment.advancedobject
"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:
Open Roo Code and navigate to Settings β MCP Servers β Edit Global Config.
In the
mcp_settings.jsonfile, add the following configuration:
{
"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"
}
}
}
}- 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.
- Go to the Zencoder menu (...)
- From the dropdown menu, select
Tools - Click on the
Add Custom MCP - Add the name (i.e.
Claude Contextand server configuration from below, and make sure to hit theInstallbutton
{
"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"
}
}- Save the server by hitting the
Installbutton.
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:
npx @zilliz/claude-context-mcp@latestUsage in Your Codebase
Open Claude Code
textcd your-project-directory claudeIndex your codebase:
textIndex this codebaseCheck indexing status:
textCheck the indexing statusStart searching:
textFind 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.
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.
- Direct Link: Install from VS Code Marketplace
- 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
# 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 devWindows-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
# 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 devBuilding
# Build all packages (cross-platform)
pnpm build
# Build specific package
pnpm build:core
pnpm build:vscode
pnpm build:mcp
# Performance benchmarking
pnpm benchmarkWindows 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
# 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:
- What files does Claude Context decide to embed?
- Can I use a fully local deployment setup?
- Does it support multiple projects / codebases?
- How does Claude Context compare to other coding tools?
β 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.
π Links
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
- Process Environment Variables (highest)
- Global Configuration File (
~/.context/.env) - 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_MODELis 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-largefor OpenAI,voyage-code-3for VoyageAI, etc.).
Supported Model Names:
OpenAI Models: See
getSupportedModelsinopenai-embedding.tsfor the full list of supported models.VoyageAI Models: See
getSupportedModelsinvoyageai-embedding.tsfor the full list of supported models.Gemini Models: See
getSupportedModelsingemini-embedding.tsfor 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
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
EOFSee the Example File for more details.
2. Simplified MCP Configuration
Claude Code:
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@latestCursor/Windsurf/Others:
{
"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)
Option 1: OpenAI (Recommended)
- API Key: Get from OpenAI Platform
- Billing: Active billing account required
- Models:
text-embedding-3-smallortext-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
Zilliz Cloud (Recommended)
- 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:
- OpenAI API Key: Get from OpenAI Platform
- 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:
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@latestReplace the API keys with your actual keys.
Step 3: Start Using Claude Context
- Open Claude Code in your project directory
- Index your codebase:text
Index this codebase - Check indexing status:text
Check the indexing status - 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:
Create or edit the
~/.codex/config.tomlfile.Add the following configuration:
# 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- Save the file and restart Codex CLI to apply the changes.
Gemini CLI
Gemini CLI requires manual configuration through a JSON file:
Create or edit the
~/.gemini/settings.jsonfile.Add the following configuration:
{
"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"
}
}
}
}- 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:
{
"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):
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
{
"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:
- Navigate to Settings β MCP Servers β Add Server.
- 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-keyMILVUS_TOKEN:your-zilliz-cloud-api-key
- Name:
- 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:
Open Cline and click on the MCP Servers icon in the top navigation bar.
Select the Installed tab, then click Advanced MCP Settings.
In the
cline_mcp_settings.jsonfile, add the following configuration:
{
"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"
}
}
}
}- 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**
Click the hamburger menu.
Select Settings.
Navigate to the Tools section.
Click the + Add MCP button.
Enter the following command:
textnpx @zilliz/claude-context-mcp@latestName the MCP: Claude Context.
Click the Add button.
**B. Manual Configuration**
- Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
- Select Edit Settings
- Under Advanced, click Edit in settings.json
- Add the server configuration to the
mcpServersarray in theaugment.advancedobject
"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:
Open Roo Code and navigate to Settings β MCP Servers β Edit Global Config.
In the
mcp_settings.jsonfile, add the following configuration:
{
"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"
}
}
}
}- 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.
- Go to the Zencoder menu (...)
- From the dropdown menu, select
Tools - Click on the
Add Custom MCP - Add the name (i.e.
Claude Contextand server configuration from below, and make sure to hit theInstallbutton
{
"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"
}
}- Save the server by hitting the
Installbutton.
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:
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 immediatelysearch_code- Searches codebase (works during indexing with partial results)get_indexing_status- Shows current progress and statusclear_index- Removes indexed data
Status States
indexed- β Ready for searchindexing- π Background process runningindexfailed- β Error occurred, can retrynot_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
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:
{
"customExtensions": [".vue", ".svelte", ".astro"]
}Just dynamically tell the agent what extensions you want to index to invoke this parameter. For example:
"Index this codebase, and include .vue, .svelte, .astro files"3. Environment Variable Extensions
Extensions from CUSTOM_EXTENSIONS environment variable:
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:
{
"ignorePatterns": ["temp/**", "*.backup", "private/**"]
}Just dynamically tell the agent what patterns you want to exclude to invoke this parameter. For example:
"Index this codebase, and exclude temp/**, *.backup, private/** files"3. Environment Variable Ignore Patterns
Patterns from CUSTOM_IGNORE_PATTERNS environment variable:
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:
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:
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)
Embedding Service (Ollama): Install and run Ollama locally for embedding generation. Configure:
EMBEDDING_PROVIDER=OllamaOLLAMA_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:
- Make sure you are checking the same absolute path that you originally indexed.
- If the entry still shows zero counts, run
clear_indexfor that path. - Re-run
index_codebasefor 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
- π οΈ Prerequisites - What you need before starting
- π Environment Variables - How to configure environment variables for MCP
- β‘ Quick Start Guide - Get up and running in 1 minutes
Components
- MCP Server - The MCP server of Claude Context
- VSCode Extension - The VSCode extension of Claude Context
- Core Package - The core package of Claude Context
Dive Deep
- File Inclusion & Exclusion Rules - Detailed explanation of file inclusion and exclusion rules
- Asynchronous Indexing Workflow - Detailed explanation of asynchronous indexing workflow
Troubleshooting
- β FAQ - Frequently asked questions
- π Troubleshooting Guide - Troubleshooting guide
π External Resources
π¬ Support
- Issues: GitHub Issues
- Discord: Join our Discord
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:
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
π§ 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 fileKey Success: Semantic search immediately located the actual swap_dims() implementations and understood the functional context.
π Grep Method
/* 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
- Method-Level Understanding: Recognized
.swap_dims()as a specific method with defined behavior - Functional Context: Understood the relationship between Dataset, DataArray, and Variable classes
- Efficient Navigation: Directly located method implementations without searching through tests and docs
- Mutation Awareness: Connected the symptom (unexpected changes) to likely causes (shared references)
Why Grep Was Less Efficient
- Information Overload: Generated hundreds of matches for common terms like 'swap_dims' and 'dimension'
- Context Loss: Treated method names as text strings rather than functional concepts
- 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
both_conversation.log- Both methods interaction loggrep_conversation.log- Grep method interaction logboth_result.json- Both methods performance metricsgrep_result.json- Grep method performance metrics