Claude Context
Claude Context предоставляет AI-агентам для написания кода семантический поиск по всему кодовой базе. Получайте глубокий и релевантный контекст эффективно, экономя затраты и улучшая генерацию кода, RAG и многое другое.
Claude Context — это мощный плагин Model Context Protocol (MCP), предназначенный для оснащения ИИ-помощников по написанию кода, таких как Claude Code и Gemini CLI, всесторонним пониманием кодовой базы. Он использует семантический поиск и векторные базы данных для эффективного извлечения релевантных фрагментов кода из миллионов строк кода, гарантируя, что ИИ-агенты имеют необходимый контекст для точной генерации и анализа кода без чрезмерного использования токенов. Это решение помогает разработчикам избежать затрат и ограничений традиционного "набивания контекста", делая программирование с помощью ИИ более практичным и масштабируемым.
Ключевые особенности
Варианты использования
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: Unlike traditional keyword matching that can easily miss relevant code, it uses semantic search to retrieve all your care about from millions of lines of code, without going through multiple hops of discovery, and add to LLM context.
- 💰 Don’t go bankrupt working with large codebase: Compared to simply stuffing a whole directory of files in LLM context for each call, efficient indexing and search in vector database avoids breaking your budget.
Model Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.
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.
Use the command line interface to add the Claude Context MCP server:
# Add the Claude Context MCP server
claude mcp add claude-context -e OPENAI_API_KEY=your-openai-api-key -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.
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:
["@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.
-
Click the hamburger menu.
-
Select Settings.
-
Navigate to the Tools section.
-
Click the + Add MCP button.
-
Enter the following command:
npx @zilliz/claude-context-mcp@latest -
Name the MCP: Claude Context.
-
Click the Add button.
- 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.
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@latestFor more detailed MCP environment variable configuration, see our Environment Variables Guide.
📚 Need more help? Check out our complete documentation for detailed guides and troubleshooting tips.
- 🔍 Semantic Code Search: Ask questions like "find functions that handle user authentication" and get relevant, context-rich code instantly.
- 🧠 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.
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
- 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
While MCP is the recommended way to use Claude Context with AI assistants, you can also use it directly or through the VSCode extension.
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)}...`);
});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
# 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# Build all packages
pnpm build
# Build specific package
pnpm build:core
pnpm build:vscode
pnpm build:mcp# Development with file watching
cd examples/basic-usage
pnpm devBy default, Claude Context supports:
- Programming languages:
.ts,.tsx,.js,.jsx,.py,.java,.cpp,.c,.h,.hpp,.cs,.go,.rs,.php,.rb,.swift,.kt,.scala,.m,.mm - Documentation:
.md,.markdown,.ipynb
Common directories and files are automatically ignored:
- Build outputs:
node_modules/**,dist/**,build/**,out/**,target/**,coverage/**,.nyc_output/** - Version control:
.git/**,.svn/**,.hg/** - IDE/Editor files:
.vscode/**,.idea/**,*.swp,*.swo - Cache directories:
.cache/**,__pycache__/**,.pytest_cache/** - Logs and temporary:
logs/**,tmp/**,temp/**,*.log - Environment files:
.env,.env.*,*.local - Minified/bundled files:
*.min.js,*.min.css,*.bundle.js,*.bundle.css,*.chunk.js,*.map
See FAQ Guide for detailed and customized configuration of supported file extensions and ignore patterns.
Check the /examples directory for complete usage examples:
- Basic Usage: Simple indexing and search example
For frequently asked questions and troubleshooting tips, see our FAQ Guide.
We welcome contributions! Please see our Contributing Guide for details on how to get started.
Package-specific contributing guides:
- 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
This project is licensed under the MIT License - see the LICENSE file for details.
Claude Context — семантический поиск по коду для AI-агентов
Claude Context — MCP-плагин, который добавляет семантический поиск по коду в Claude Code и другие AI-ассистенты. Вместо тупого перебора ключевых слов или загрузки всей папки в контекст LLM, он использует векторную базу данных (Zilliz Cloud) и эмбеддинги, чтобы быстро находить нужные фрагменты кода среди миллионов строк — и не разорить вас на токенах.
Быстрый старт
Предварительные требования
- Векторная база данных — зарегистрируйтесь на Zilliz Cloud и получите API-ключ. Замените им
your-zilliz-cloud-api-keyв примерах ниже. - Ключ OpenAI — для модели эмбеддингов. Получите на OpenAI (ключ начинается с
sk-). Замените имyour-openai-api-key.
Настройка MCP-сервера
Сервер запускается через npx и общается по протоколу stdio. Конфигурация зависит от вашего AI-клиента.
Claude Code
Выполните в терминале:
claude mcp add claude-context -e OPENAI_API_KEY=your-openai-api-key -e MILVUS_TOKEN=your-zilliz-cloud-api-key -- npx @zilliz/claude-context-mcp@latest
Gemini CLI
Добавьте секцию в ~/.gemini/settings.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, Windsurf, VS Code и другие
В большинстве случаев нужно добавить в файл MCP-конфигурации (например, ~/.cursor/mcp.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"
}
}
}
}
Важно: для некоторых клиентов (Claude Code, Gemini) используется
MILVUS_TOKEN, для остальных —MILVUS_ADDRESS+MILVUS_TOKEN. Сверяйтесь с документацией клиента.
Для Cherry Studio настройка делается через GUI: Settings → MCP Servers → Add Server, тип STDIO, команда npx, аргументы ["@zilliz/claude-context-mcp@latest"], переменные окружения те же.
Для Cline и Roo Code — через JSON-файл в настройках MCP-серверов.
Для Augment Code можно использовать UI (Add MCP, команда npx @zilliz/claude-context-mcp@latest) или добавить в settings.json в секцию augment.advanced.mcpServers.
Если вашего клиента нет в списке — сервер работает по стандартному MCP-протоколу через stdio, подходит любой совместимый клиент.
Основные возможности
- Семантический поиск по коду — задавайте вопросы вроде «найди функции для аутентификации пользователей» и получайте релевантные фрагменты.
- Инкрементальная индексация — при изменении файлов переиндексируются только они (на основе Merkle-деревьев).
- Умное разбиение кода — используется AST (автоматический fallback на LangChain-сплиттер).
- Масштабируемость — Zilliz Cloud позволяет работать с кодом любого объёма.
- Гибкая настройка — можно менять расширения файлов, паттерны игнорирования, модель эмбеддингов.
Архитектура и пакеты
Проект — монорепозиторий из трёх компонентов:
@zilliz/claude-context-core— ядро: индексация, эмбеддинги, работа с векторной БД.@zilliz/claude-context-mcp— MCP-сервер для интеграции с AI-агентами.- VSCode Extension (Semantic Code Search) — расширение для Visual Studio Code.
Поддерживаемые технологии
| Категория | Варианты |
|---|---|
| Провайдеры эмбеддингов | OpenAI, VoyageAI, Ollama, Gemini |
| Векторные БД | Milvus, Zilliz Cloud (полностью управляемый сервис) |
| Сплиттеры кода | AST-based (с авто-fallback), LangChain character-based |
| Языки | TypeScript, JavaScript, Python, Java, C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, Markdown |
Использование core-пакета (без MCP)
Если MCP не подходит, используйте @zilliz/claude-context-core напрямую:
import { Context, MilvusVectorDatabase, OpenAIEmbedding } from '@zilliz/claude-context-core';
const embedding = new OpenAIEmbedding({
apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',
model: 'text-embedding-3-small'
});
const vectorDatabase = new MilvusVectorDatabase({
address: process.env.MILVUS_ADDRESS || 'your-zilliz-cloud-public-endpoint',
token: process.env.MILVUS_TOKEN || 'your-zilliz-cloud-api-key'
});
const context = new Context({ embedding, vectorDatabase });
// Индексация с прогрессом
const stats = await context.indexCodebase('./your-project', (progress) => {
console.log(`${progress.phase} — ${progress.percentage}%`);
});
console.log(`Проиндексировано ${stats.indexedFiles} файлов, ${stats.totalChunks} чанков`);
// Семантический поиск
const results = await context.semanticSearch('./your-project', 'векторная база данных', 5);
Ссылки
- Полная документация
- Руководство по переменным окружения
- Расширение для VS Code
- npm-пакет core
- npm-пакет MCP
- DeepWiki проекта
- Discord-сообщество
Лицензия
MIT
Что такое Claude Context?
Claude Context — это мощный инструмент для разработчиков, который расширяет возможности ИИ-агентов по написанию кода, предоставляя им глубокий семантический контекст из всей вашей кодовой базы, что обеспечивает более точное понимание и генерацию кода.
Есть ли какие-либо предварительные требования для использования Claude Context?
Да, для работы Claude Context требуется масштабируемая векторная база данных (например, Zilliz Cloud) для хранения эмбеддингов кода и API-ключ от провайдера эмбеддингов (например, OpenAI, VoyageAI, Ollama, Gemini) для генерации этих эмбеддингов.
Как Claude Context предоставляет глубокий контекст ИИ-агентам?
Он использует семантический поиск кода в больших кодовых базах с помощью векторных баз данных, инкрементальное индексирование с деревьями Меркла для обновлений и интеллектуальное разбиение кода на основе AST для подачи максимально релевантного контекста ИИ-агентам.
Каковы основные преимущества использования Claude Context для разработчиков?
Он гарантирует, что ваши ИИ-агенты имеют доступ ко всей кодовой базе, что значительно повышает релевантность и точность кода, а также снижает затраты, связанные с большими контекстными окнами, благодаря эффективному индексированию и поиску.
С какими ИИ-агентами и инструментами для кодинга интегрируется Claude Context?
Claude Context интегрируется через Model Context Protocol (MCP) с различными ИИ-помощниками по написанию кода, включая Claude Code, Cursor, Gemini CLI, Qwen Code, расширения VS Code и множество других совместимых платформ.
Комментарии
Комментариев пока нет. Будьте первым.