{"owner":"zilliztech","repo":"claude-context","hasSkills":true,"totalSkillsCount":6,"totalTokensCount":12886,"categories":["root-instruction","claude-rule","plugin-manifest"],"hasMcp":false,"mcpConfig":null,"found":["AGENTS.md","CLAUDE.md","packages/chrome-extension/README.md","packages/core/README.md","packages/mcp/README.md","packages/vscode-extension/README.md"],"skills":{"AGENTS.md":"CLAUDE.md","CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Overview\n\nClaude Context is an MCP plugin that adds semantic code search to AI coding agents. A codebase is split into chunks, embedded, and stored in a Milvus/Zilliz vector database; queries are answered by semantic (hybrid dense + sparse) search instead of loading whole directories into the model's context.\n\n## Monorepo Layout\n\npnpm workspace (`packages/*`, `examples/*`). Requires Node >=20 <24 and pnpm >=10.\n\n- `packages/core` (`@zilliz/claude-context-core`) — the indexing engine. All real logic lives here; the other packages are thin frontends over it.\n- `packages/mcp` (`@zilliz/claude-context-mcp`) — stdio MCP server, the primary product. ESM (`\"type\": \"module\"`).\n- `packages/vscode-extension` (`semanticcodesearch`) — VSCode extension. Bundled with webpack; stubs out Node-only deps (Milvus gRPC, native AST) in `src/stubs/`.\n- `packages/chrome-extension` — browser build; overrides `@zilliz/milvus2-sdk-node` to `false` (no gRPC in browser).\n- `examples/basic-usage` — runnable library example.\n\n## Commands\n\n```bash\npnpm install\npnpm build                 # build all packages (examples built last)\npnpm build:core            # build a single package: also build:mcp, build:vscode\npnpm dev                   # watch all; or dev:core / dev:mcp / dev:vscode\npnpm lint                  # eslint across packages; lint:fix to autofix\npnpm typecheck             # tsc --noEmit across packages\npnpm clean                 # rimraf dist in every package\n```\n\nPackages depend on `core` via `workspace:*`, so **rebuild core (`pnpm build:core`) before testing mcp/vscode against core changes** — they consume `core/dist`, not its source.\n\n### Tests\n\n- **core** uses Jest + ts-jest. Test files are colocated as `*.test.ts` in `src/`.\n  ```bash\n  pnpm --filter @zilliz/claude-context-core test                     # all (runs in band)\n  pnpm --filter @zilliz/claude-context-core test -- context.abort    # by filename\n  pnpm --filter @zilliz/claude-context-core test -- -t \"pattern\"     # by test name\n  ```\n- **mcp** uses the Node built-in test runner via tsx (no Jest):\n  ```bash\n  pnpm --filter @zilliz/claude-context-mcp test                      # runs src/**/*.test.ts\n  ```\n\n### Running the MCP server locally\n\n```bash\npnpm --filter @zilliz/claude-context-mcp start        # tsx src/index.ts\n```\nConfiguration is entirely via environment variables (see `.env.example` and `packages/mcp/src/config.ts`). Key vars: `EMBEDDING_PROVIDER` (OpenAI | VoyageAI | Gemini | Ollama | OpenRouter), provider API key, `EMBEDDING_MODEL`, `MILVUS_ADDRESS` and/or `MILVUS_TOKEN` (address can be auto-resolved from a Zilliz token), `CODE_CHUNKS_COLLECTION_NAME_OVERRIDE`.\n\n## Architecture\n\n### Core: the `Context` orchestrator (`packages/core/src/context.ts`)\n\n`Context` ties together three pluggable interfaces injected through its constructor config:\n\n- **Embedding** (`src/embedding/`) — `base-embedding.ts` interface with `OpenAIEmbedding`, `VoyageAIEmbedding`, `GeminiEmbedding`, `OllamaEmbedding` implementations.\n- **VectorDatabase** (`src/vectordb/`) — `MilvusVectorDatabase` (gRPC, Node-only) and `MilvusRestfulVectorDatabase` (HTTP, browser-safe). `zilliz-utils.ts` (`ClusterManager`) can provision a free Zilliz cluster and resolve an address from a token.\n- **Splitter** (`src/splitter/`) — `AstCodeSplitter` (tree-sitter, the default at 2500/300 chunk/overlap) which falls back to `LangChainCodeSplitter` for unsupported languages or parse failures.\n\nThe public surface (`indexCodebase`, `reindexByChange`, `semanticSearch`, `clearIndex`, `hasIndex`) is re-exported from `src/index.ts`. Indexing reads files honoring ignore rules, splits them, embeds in batches, and upserts vectors. Collection name is derived from a hash of the absolute codebase path (overridable).\n\nTwo error types carry control-flow meaning and should be preserved when touching the pipeline:\n- `IndexAbortError` — cooperative cancellation via `AbortSignal`.\n- `EmbeddingError` — always re-thrown to halt the whole pipeline, unlike per-file read/parse errors which are logged and skipped. This prevents silent partial indexing (Milvus getting zero vectors while the snapshot marks files done).\n\n### Incremental sync (`packages/core/src/sync/`)\n\n`FileSynchronizer` builds a Merkle DAG (`merkle.ts`) of file hashes to compute `{added, removed, modified}` between runs. Snapshots persist to `~/.context/merkle/<md5-of-path>.json`. `reindexByChange` uses this so re-indexing only touches changed files. The MCP server can also run a background sync loop (`CLAUDE_CONTEXT_BACKGROUND_SYNC`, `CLAUDE_CONTEXT_SYNC_INTERVAL_MS`).\n\n### Ignore patterns\n\nLayered: built-in `DEFAULT_IGNORE_PATTERNS` + config + env (`CUSTOM_IGNORE_PATTERNS`) + on-disk ignore files (`.gitignore`, `.contextignore`, `.xxxignore`, and a global `~/.context/.gitignore`). `utils/ignore-matcher.ts` implements matching including gitignore negation (`!`) semantics — covered by `context.ignore-patterns.test.ts`.\n\n### Env resolution (`packages/core/src/utils/env-manager.ts`)\n\n`envManager.get(name)` resolves with priority `process.env` > `~/.context/.env` file. Use it instead of reading `process.env` directly so the `.env` file fallback keeps working.\n\n### MCP server (`packages/mcp/src/`)\n\n- `index.ts` — entry point. **Critically, it redirects `console.log`/`console.warn` to stderr at the very top**, because stdout is reserved for the MCP JSON protocol. Never write non-protocol output to stdout in this package.\n- `handlers.ts` (`ToolHandlers`) — implements the tools: `index_codebase`, `search_code`, `clear_index`, `get_indexing_status`.\n- `snapshot.ts` (`SnapshotManager`) — tracks per-codebase indexing state across server restarts.\n- `sync.ts` (`SyncManager`) — drives incremental re-indexing.\n- `config.ts`, `embedding.ts` — build `Context` (embedding provider + Milvus) from environment variables.\n\n## Conventions\n\nCommits follow Conventional Commits with these scopes: `core`, `vscode`, `mcp`, `examples`, `docs` (e.g. `fix(core): support gitignore negation patterns`). All code and comments are written in English.\n","packages/chrome-extension/README.md":"# GitHub Code Vector Search Chrome Extension\n\nA Chrome extension for indexing and semantically searching GitHub repository code, powered by Claude Context.\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search on GitHub repositories based on semantic understanding\n- 📁 **Repository Indexing**: Automatically index GitHub repositories and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets directly on GitHub\n- 🔧 **Multi-platform Support**: Support for OpenAI and VoyageAI as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n- 🌐 **GitHub Integration**: Seamlessly integrates with GitHub's interface\n- 📱 **Cross-Repository**: Search across multiple indexed repositories\n- ⚡ **Real-time**: Index and search code as you browse GitHub\n\n## Installation\n\n### From Chrome Web Store\n\n> **Coming Soon**: Extension will be available on Chrome Web Store\n\n### Manual Installation (Development)\n\n1. **Build the Extension**:\n   ```bash\n   cd packages/chrome-extension\n   pnpm build\n   ```\n\n2. **Load in Chrome**:\n   - Open Chrome and navigate to `chrome://extensions/`\n   - Enable \"Developer mode\" in the top right\n   - Click \"Load unpacked\" and select the `dist` folder\n   - The extension should now appear in your extensions list\n\n## Quick Start\n\n1. **Configure Settings**:\n   - Click the extension icon in Chrome toolbar\n   - Go to Options/Settings\n   - Configure embedding provider and API Key\n   - Set up Milvus connection details\n\n2. **Index a Repository**:\n   - Navigate to any GitHub repository\n   - Click the \"Index Repository\" button that appears in the sidebar\n   - Wait for indexing to complete\n\n3. **Start Searching**:\n   - Use the search box that appears on GitHub repository pages\n   - Enter natural language queries like \"function that handles authentication\"\n   - Click on results to navigate to the code\n\n## Configuration\n\nThe extension can be configured through the options page:\n\n- **Embedding Provider**: Choose between OpenAI or VoyageAI\n- **Embedding Model**: Select specific model (e.g., `text-embedding-3-small`)\n- **API Key**: Your embedding provider API key\n- **Milvus Settings**: Vector database connection details\n- **GitHub Token**: Personal access token for private repositories (optional)\n\n## Permissions\n\nThe extension requires the following permissions:\n\n- **Storage**: To save configuration and index metadata\n- **Scripting**: To inject search UI into GitHub pages\n- **Unlimited Storage**: For storing vector embeddings locally\n- **Host Permissions**: Access to GitHub.com and embedding provider APIs\n\n## File Structure\n\n- `src/content.ts` - Main content script that injects UI into GitHub pages\n- `src/background.ts` - Background service worker for extension lifecycle\n- `src/options.ts` - Options page for configuration\n- `src/config/milvusConfig.ts` - Milvus connection configuration\n- `src/milvus/chromeMilvusAdapter.ts` - Browser-compatible Milvus adapter\n- `src/storage/indexedRepoManager.ts` - Repository indexing management\n- `src/stubs/` - Browser compatibility stubs for Node.js modules\n\n## Development Features\n\n- **Browser Compatibility**: Node.js modules adapted for browser environment\n- **WebAssembly Support**: Optimized for browser performance\n- **Offline Capability**: Local storage for indexed repositories\n- **Progress Tracking**: Real-time indexing progress indicators\n- **Error Handling**: Graceful degradation and user feedback\n\n## Usage Examples\n\n### Basic Search\n1. Navigate to a GitHub repository\n2. Enter query: \"error handling middleware\"\n3. Browse semantic search results\n\n### Context Search\n1. Select code snippet on GitHub\n2. Right-click and choose \"Search Similar Code\"\n3. View related code across the repository\n\n### Multi-Repository Search\n1. Index multiple repositories\n2. Use the extension popup to search across all indexed repos\n3. Filter results by repository or file type\n\n## Contributing\n\nThis Chrome extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Chrome Extension Contributing](CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-vscode-extension](../vscode-extension)** - VSCode integration\n- **[@zilliz/claude-context-mcp](../mcp)** - MCP server integration\n\n## Tech Stack\n\n- **TypeScript** - Type-safe development\n- **Chrome Extension Manifest V3** - Modern extension architecture\n- **Webpack** - Module bundling and optimization\n- **Claude Context Core** - Semantic search engine\n- **Milvus Vector Database** - Vector storage and retrieval\n- **OpenAI/VoyageAI Embeddings** - Text embedding generation\n\n## Browser Support\n\n- Chrome 88+\n- Chromium-based browsers (Edge, Brave, etc.)\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/core/README.md":"# @zilliz/claude-context-core\n![](../../assets/claude-context.png)\n\nThe core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.\n\n## Installation\n\n```bash\nnpm install @zilliz/claude-context-core\n```\n\n### Prepare Environment Variables\n#### OpenAI API key\nSee [OpenAI Documentation](https://platform.openai.com/docs/api-reference) for more details to get your API key.\n```bash\nOPENAI_API_KEY=your-openai-api-key\n```\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](../../assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n> 💡 **Tip**: For easier configuration management across different usage scenarios, consider using [global environment variables](../../docs/getting-started/environment-variables.md).\n\n## Quick Start\n\n```typescript\nimport { \n  Context, \n  OpenAIEmbedding, \n  MilvusVectorDatabase \n} from '@zilliz/claude-context-core';\n\n// Initialize embedding provider\nconst embedding = new OpenAIEmbedding({\n  apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',\n  model: 'text-embedding-3-small'\n});\n\n// Initialize vector database\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\n// Create context instance\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n\n// Index a codebase\nconst stats = await context.indexCodebase('./my-project', (progress) => {\n  console.log(`${progress.phase} - ${progress.percentage}%`);\n});\n\nconsole.log(`Indexed ${stats.indexedFiles} files with ${stats.totalChunks} chunks`);\n\n// Search the codebase\nconst results = await context.semanticSearch(\n  './my-project',\n  'function that handles user authentication',\n  5\n);\n\nresults.forEach(result => {\n  console.log(`${result.relativePath}:${result.startLine}-${result.endLine}`);\n  console.log(`Score: ${result.score}`);\n  console.log(result.content);\n});\n```\n\n## Features\n\n- **Multi-language Support**: Index TypeScript, JavaScript, Python, Java, C++, and many other programming languages\n- **Semantic Search**: Find code using natural language queries powered by AI embeddings\n- **Flexible Architecture**: Pluggable embedding providers and vector databases\n- **Smart Chunking**: Intelligent code splitting that preserves context and structure\n- **Batch Processing**: Efficient processing of large codebases with progress tracking\n- **Pattern Matching**: Built-in ignore patterns for common build artifacts and dependencies\n- **Incremental File Synchronization**: Efficient change detection using Merkle trees to only re-index modified files\n\n## Embedding Providers\n\n- **OpenAI Embeddings** (`text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`)\n- **VoyageAI Embeddings** - High-quality embeddings optimized for code (`voyage-code-3`, `voyage-3.5`, etc.)\n- **Gemini Embeddings** - Google's embedding models (`gemini-embedding-001`, `gemini-embedding-2`)\n- **Ollama Embeddings** - Local embedding models via Ollama\n\n## Vector Database Support\n\n- **Milvus/Zilliz Cloud** - High-performance vector database\n\n## Code Splitters\n\n- **AST Code Splitter** - AST-based code splitting with automatic fallback (default)\n- **LangChain Code Splitter** - Character-based code chunking\n\n## Configuration\n\n### ContextConfig\n\n```typescript\ninterface ContextConfig {\n  embedding?: Embedding;           // Embedding provider\n  vectorDatabase?: VectorDatabase; // Vector database instance (required)\n  codeSplitter?: Splitter;        // Code splitting strategy\n  supportedExtensions?: string[]; // File extensions to index\n  ignorePatterns?: string[];      // Patterns to ignore\n  customExtensions?: string[];    // Custom extensions from MCP\n  customIgnorePatterns?: string[]; // Custom ignore patterns from MCP\n}\n```\n\n### Supported File Extensions (Default)\n\n```typescript\n[\n  // Programming languages\n  '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.cpp', '.c', '.h', '.hpp',\n  '.cs', '.go', '.rs', '.php', '.rb', '.swift', '.kt', '.scala', '.m', '.mm',\n  '.dart', '.sol',\n  // Text and markup files  \n  '.md', '.markdown', '.ipynb'\n]\n```\n\n### Default Ignore Patterns\n\n- Build and dependency directories: `node_modules/**`, `dist/**`, `build/**`, `out/**`, `target/**`\n- Version control: `.git/**`, `.svn/**`, `.hg/**`\n- IDE files: `.vscode/**`, `.idea/**`, `*.swp`, `*.swo`\n- Cache directories: `.cache/**`, `__pycache__/**`, `.pytest_cache/**`, `coverage/**`\n- Minified files: `*.min.js`, `*.min.css`, `*.bundle.js`, `*.map`\n- Log and temp files: `logs/**`, `tmp/**`, `temp/**`, `*.log`\n- Environment files: `.env`, `.env.*`, `*.local`\n\n## API Reference\n\n### Context\n\n#### Methods\n\n- `indexCodebase(path, progressCallback?, forceReindex?)` - Index an entire codebase\n- `reindexByChange(path, progressCallback?)` - Incrementally re-index only changed files\n- `semanticSearch(path, query, topK?, threshold?, filterExpr?)` - Search indexed code semantically\n- `hasIndex(path)` - Check if codebase is already indexed\n- `clearIndex(path, progressCallback?)` - Remove index for a codebase\n- `updateIgnorePatterns(patterns)` - Update ignore patterns\n- `addCustomIgnorePatterns(patterns)` - Add custom ignore patterns\n- `addCustomExtensions(extensions)` - Add custom file extensions\n- `updateEmbedding(embedding)` - Switch embedding provider\n- `updateVectorDatabase(vectorDB)` - Switch vector database\n- `updateSplitter(splitter)` - Switch code splitter\n\n### Search Results\n\n```typescript\ninterface SemanticSearchResult {\n  content: string;      // Code content\n  relativePath: string; // File path relative to codebase root\n  startLine: number;    // Starting line number\n  endLine: number;      // Ending line number\n  language: string;     // Programming language\n  score: number;        // Similarity score (0-1)\n}\n```\n\n\n## Examples\n\n### Using VoyageAI Embeddings\n\n```typescript\nimport { Context, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';\n\n// Initialize with VoyageAI embedding provider\nconst embedding = new VoyageAIEmbedding({\n  apiKey: process.env.VOYAGEAI_API_KEY || 'your-voyageai-api-key',\n  model: 'voyage-code-3'\n});\n\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n```\n\n### Custom File Filtering\n\n```typescript\nconst context = new Context({\n  embedding,\n  vectorDatabase,\n  supportedExtensions: ['.ts', '.js', '.py', '.java'],\n  ignorePatterns: [\n    'node_modules/**',\n    'dist/**',\n    '*.spec.ts',\n    '*.test.js'\n  ]\n});\n```\n\n## File Synchronization Architecture\n\nClaude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.\n\n![File Synchronization Architecture](../../assets/file_synchronizer.png)\n\n### How It Works\n\nThe file synchronization system uses a **Merkle tree-based approach** combined with SHA-256 file hashing to detect changes:\n\n#### 1. File Hashing\n- Each file in the codebase is hashed using SHA-256\n- File hashes are computed based on file content, not metadata\n- Hashes are stored with relative file paths for consistency across different environments\n\n#### 2. Merkle Tree Construction\n- All file hashes are organized into a Merkle tree structure\n- The tree provides a single root hash that represents the entire codebase state\n- Any change to any file will cause the root hash to change\n\n#### 3. Snapshot Management\n- File synchronization state is persisted to `~/.context/merkle/` directory\n- Each codebase gets a unique snapshot file based on its absolute path hash\n- Snapshots contain both file hashes and serialized Merkle tree data\n\n#### 4. Change Detection Process\n1. **Quick Check**: Compare current Merkle root hash with stored snapshot\n2. **Detailed Analysis**: If root hashes differ, perform file-by-file comparison\n3. **Change Classification**: Categorize changes into three types:\n   - **Added**: New files that didn't exist before\n   - **Modified**: Existing files with changed content\n   - **Removed**: Files that were deleted from the codebase\n\n#### 5. Incremental Updates\n- Only process files that have actually changed\n- Update vector database entries only for modified chunks\n- Remove entries for deleted files\n- Add entries for new files\n\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Packages\n\n- **[@claude-context/mcp](../mcp)** - MCP server that uses this core engine\n- **[VSCode Extension](../vscode-extension)** - VSCode extension built on this core\n\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/mcp/README.md":"# @zilliz/claude-context-mcp\n\n![](../../assets/claude-context.png)\nModel Context Protocol (MCP) integration for Claude Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## 🚀 Use Claude Context as MCP in Claude Code and others\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf2uIf2c5zowp-iOMOqsefHbY_EwNGiutkxtNXcZVJ8RI6SN9DsCcsc3amXIhOZx9VcKFJQLSAqM-2pjU9zoGs1r8GCTUL3JIsLpLUGAm1VQd5F2o5vpEajx2qrc77iXhBu1zWj?key=qYdFquJrLcfXCUndY-YRBQ)\n\nModel Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.\n\n## Quick Start\n\n### Prerequisites\n\nBefore using the MCP server, make sure you have:\n\n- API key for your chosen embedding provider (OpenAI, VoyageAI, Gemini, or Ollama setup)\n- Milvus vector database (local or cloud)\n\n> 💡 **Setup Help:** See the [main project setup guide](../../README.md#-quick-start) for detailed installation instructions.\n\n### Prepare Environment Variables\n\n#### Embedding Provider Configuration\n\nClaude Context MCP supports multiple embedding providers. Choose the one that best fits your needs:\n\n> 📋 **Quick Reference**: For a complete list of environment variables and their descriptions, see the [Environment Variables Guide](../../docs/getting-started/environment-variables.md).\n\n```bash\n# Supported providers: OpenAI, VoyageAI, Gemini, Ollama\nEMBEDDING_PROVIDER=OpenAI\n```\n\n<details>\n<summary><strong>1. OpenAI Configuration (Default)</strong></summary>\n\nOpenAI provides high-quality embeddings with excellent performance for code understanding.\n\n```bash\n# Required: Your OpenAI API key\nOPENAI_API_KEY=sk-your-openai-api-key\n\n# Optional: Specify embedding model (default: text-embedding-3-small)\nEMBEDDING_MODEL=text-embedding-3-small\n\n# Optional: Custom API base URL (for Azure OpenAI or other compatible services)\nOPENAI_BASE_URL=https://api.openai.com/v1\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`openai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/openai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)\n2. Sign in or create an account\n3. Generate a new API key\n4. Set up billing if needed\n\n</details>\n\n<details>\n<summary><strong>2. VoyageAI Configuration</strong></summary>\n\nVoyageAI offers specialized code embeddings optimized for programming languages.\n\n```bash\n# Required: Your VoyageAI API key\nVOYAGEAI_API_KEY=pa-your-voyageai-api-key\n\n# Optional: Specify embedding model (default: voyage-code-3)\nEMBEDDING_MODEL=voyage-code-3\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`voyageai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/voyageai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [VoyageAI Console](https://dash.voyageai.com/)\n2. Sign up for an account\n3. Navigate to API Keys section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>3. Gemini Configuration</strong></summary>\n\nGoogle's Gemini provides competitive embeddings with good multilingual support.\n\n```bash\n# Required: Your Gemini API key\nGEMINI_API_KEY=your-gemini-api-key\n\n# Optional: Specify embedding model (default: gemini-embedding-001; supports gemini-embedding-2)\nEMBEDDING_MODEL=gemini-embedding-001\n\n# Optional: Custom API base URL (for custom endpoints)\nGEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`gemini-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/gemini-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [Google AI Studio](https://aistudio.google.com/)\n2. Sign in with your Google account\n3. Go to \"Get API key\" section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>4. Ollama Configuration (Local/Self-hosted)</strong></summary>\n\nOllama allows you to run embeddings locally without sending data to external services.\n\n```bash\n# Required: Specify which Ollama model to use\nEMBEDDING_MODEL=nomic-embed-text\n\n# Optional: Specify Ollama host (default: http://127.0.0.1:11434)\nOLLAMA_HOST=http://127.0.0.1:11434\n\n# Optional: Override embedding dimension to skip runtime dimension detection\nEMBEDDING_DIMENSION=768\n```\n\n**Setup Instructions:**\n\n1. Install Ollama from [ollama.com](https://ollama.com/)\n2. Pull the embedding model:\n\n   ```bash\n   ollama pull nomic-embed-text\n   ```\n\n3. Ensure Ollama is running:\n\n   ```bash\n   ollama serve\n   ```\n\n</details>\n\n#### Get a free vector database on Zilliz Cloud\n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.\n\n![](../../assets/signup_and_get_apikey.png)\n\nCopy your Personal Key to replace `your-zilliz-cloud-api-key` in the configuration examples.\n\n```bash\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n\n# Optional: increase timeout for Milvus collection-limit pre-check on slow clusters (default: 15000)\nMILVUS_COLLECTION_LIMIT_CHECK_TIMEOUT_MS=30000\n```\n\n#### Embedding Batch Size\n\nYou can set the embedding batch size to optimize the performance of the MCP server, depending on your embedding model throughput. The default value is 100.\n\n```bash\nEMBEDDING_BATCH_SIZE=512\n```\n\n#### Custom File Processing (Optional)\n\nYou can configure custom file extensions and ignore patterns globally via environment variables:\n\n```bash\n# Additional file extensions to include beyond defaults\nCUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig\n\n# Additional ignore patterns to exclude files/directories\nCUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**\n```\n\nThese settings work in combination with tool parameters - patterns from both sources will be merged together.\n\n#### Custom Collection Name (Optional)\n\nUse this when you want a human-readable prefix on collection names in Milvus/Zilliz instead of the bare hash:\n\n```bash\n# Creates code_chunks_my_project_<pathHash> or hybrid_code_chunks_my_project_<pathHash>\nCODE_CHUNKS_COLLECTION_NAME_OVERRIDE=my_project\n```\n\nThe per-codebase `<pathHash>` suffix is preserved even when the override is set, so the same MCP server can still index multiple repos without collapsing them onto one collection. The override value is sanitized to letters, numbers, and underscores, and truncated to keep the full name within Milvus's 255-char limit. If you unset the variable later, Claude Context switches back to the plain `code_chunks_<pathHash>` naming.\n\n#### Trigger File Watcher (Optional)\n\nIn addition to the periodic background sync, the MCP server watches a sentinel file at `~/.context/.sync-trigger` and starts an immediate re-index whenever the file is modified. This lets external tools (Claude Code `PostToolUse` hooks, editor save hooks, CI scripts, etc.) request a sync on demand instead of waiting for the next polling tick.\n\n```bash\n# Default: watcher enabled. Set to false to disable filesystem watching entirely\n# (useful on read-only filesystems or sandboxed environments).\nCLAUDE_CONTEXT_TRIGGER_WATCHER=true\n```\n\nExample — Claude Code hook that re-indexes after every Edit/Write:\n\n```json\n\"hooks\": {\n  \"PostToolUse\": [\n    { \"matcher\": \"Edit|Write\", \"hooks\": [\n      { \"type\": \"command\", \"command\": \"touch ~/.context/.sync-trigger\" }\n    ]}\n  ]\n}\n```\n\nNotes:\n- The trigger fires a debounced re-index (2 s window) so rapid touches collapse to a single sync.\n- Triggered syncs go through the same global cross-process lock as background sync, so when multiple MCP processes share `$HOME` only one process performs the work per trigger.\n- The trigger file's *contents* are ignored — only the modification event matters.\n\n#### Background Sync Configuration (Optional)\n\nBy default, the MCP server runs startup + periodic background sync for compatibility with existing installations. The global cross-process sync lock ensures only one local MCP process performs a sync cycle at a time.\n\nYou can tune or disable periodic polling with environment variables:\n\n```bash\n# Default: true. Set to false to disable startup + periodic polling.\nCLAUDE_CONTEXT_BACKGROUND_SYNC=false\n\n# Optional: control how often sync runs (default: 300000 = 5 minutes)\nCLAUDE_CONTEXT_SYNC_INTERVAL_MS=60000\n```\n\nFor multi-instance local stdio setups, set `CLAUDE_CONTEXT_BACKGROUND_SYNC=false` and keep the trigger watcher enabled. That avoids idle polling while still allowing external tools to request immediate re-indexing by touching `~/.context/.sync-trigger`.\n\n## Usage with MCP Clients\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\nUse the command line interface to add the Claude Context MCP server:\n\n```bash\n# Add the Claude Context MCP server\nclaude mcp add claude-context -e OPENAI_API_KEY=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\n\n```\n\nSee the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details about MCP server management.\n\n</details>\n\n<details>\n<summary><strong>OpenAI Codex CLI</strong></summary>\n\nCodex CLI uses TOML configuration files:\n\n1. Create or edit the `~/.codex/config.toml` file.\n\n2. Add the following configuration:\n\n```toml\n# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.\n[mcp_servers.claude-context]\ncommand = \"npx\"\nargs = [\"@zilliz/claude-context-mcp@latest\"]\nenv = { \"OPENAI_API_KEY\" = \"your-openai-api-key\", \"MILVUS_TOKEN\" = \"your-zilliz-cloud-api-key\" }\n# Optional: override the default 10s startup timeout\nstartup_timeout_ms = 20000\n```\n\n3. Save the file and restart Codex CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Gemini CLI</strong></summary>\n\nGemini CLI requires manual configuration through a JSON file:\n\n1. Create or edit the `~/.gemini/settings.json` file.\n\n2. Add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file and restart Gemini CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Qwen Code</strong></summary>\n\nCreate or edit the `~/.qwen/settings.json` file and add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\nGo to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`\n\nPasting 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](https://cursor.com/docs/context/mcp) for more info.\n\n**OpenAI Configuration (Default):**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"OpenAI\",\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**VoyageAI Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"VoyageAI\",\n        \"VOYAGEAI_API_KEY\": \"your-voyageai-api-key\",\n        \"EMBEDDING_MODEL\": \"voyage-code-3\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Gemini Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Gemini\",\n        \"GEMINI_API_KEY\": \"your-gemini-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Ollama Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Ollama\",\n        \"EMBEDDING_MODEL\": \"nomic-embed-text\",\n        \"OLLAMA_HOST\": \"http://127.0.0.1:11434\",\n        \"EMBEDDING_DIMENSION\": \"768\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Void</strong></summary>\n\nGo to: `Settings` -> `MCP` -> `Add MCP Server`\n\nAdd the following configuration to your Void MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Desktop</strong></summary>\n\nAdd to your Claude Desktop configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nWindsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>VS Code</strong></summary>\n\nThe Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cherry Studio</strong></summary>\n\nCherry 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:\n\n1. Navigate to **Settings → MCP Servers → Add Server**.\n2. Fill in the server details:\n   - **Name**: `claude-context`\n   - **Type**: `STDIO`\n   - **Command**: `npx`\n   - **Arguments**: `[\"-y\", \"@zilliz/claude-context-mcp@latest\"]`\n   - **Environment Variables**:\n     - `OPENAI_API_KEY`: `your-openai-api-key`\n     - `MILVUS_TOKEN`: `your-zilliz-cloud-api-key`\n3. Save the configuration to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Cline</strong></summary>\n\nCline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:\n\n1. Open Cline and click on the **MCP Servers** icon in the top navigation bar.\n\n2. Select the **Installed** tab, then click **Advanced MCP Settings**.\n\n3. In the `cline_mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n4. Save the file.\n\n</details>\n\n<details>\n<summary><strong>Augment</strong></summary>\n\nTo configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.\n\n#### **A. Using the Augment Code UI**\n\n1. Click the hamburger menu.\n\n2. Select **Settings**.\n\n3. Navigate to the **Tools** section.\n\n4. Click the **+ Add MCP** button.\n\n5. Enter the following command:\n\n   ```\n   npx @zilliz/claude-context-mcp@latest\n   ```\n\n6. Name the MCP: **Claude Context**.\n\n7. Click the **Add** button.\n\n------\n\n#### **B. Manual Configuration**\n\n1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel\n2. Select Edit Settings\n3. Under Advanced, click Edit in settings.json\n4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object\n\n```json\n\"augment.advanced\": { \n  \"mcpServers\": [ \n    { \n      \"name\": \"claude-context\", \n      \"command\": \"npx\", \n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"] \n    } \n  ] \n}\n```\n\n</details>\n\n<details>\n<summary><strong>Roo Code</strong></summary>\n\nRoo Code utilizes a JSON configuration file for MCP servers:\n\n1. Open Roo Code and navigate to **Settings → MCP Servers → Edit Global Config**.\n\n2. In the `mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Zencoder</strong></summary>\n\nZencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.\n\n1. Go to the Zencoder menu (...)\n2. From the dropdown menu, select `Tools`\n3. Click on the `Add Custom MCP`\n4. Add the name (i.e. `Claude Context` and server configuration from below, and make sure to hit the `Install` button\n\n```json\n{\n    \"command\": \"npx\",\n    \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n    \"env\": {\n      \"OPENAI_API_KEY\": \"your-openai-api-key\",\n      \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n      \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n    }\n}\n\n```\n\n5. Save the server by hitting the `Install` button.\n\n</details>\n\n<details>\n<summary><strong>LangChain/LangGraph</strong></summary>\n\nFor LangChain/LangGraph integration examples, see [this example](https://github.com/zilliztech/claude-context/blob/643796a0d30e706a2a0dff3d55621c9b5d831807/evaluation/retrieval/custom.py#L88).\n\n</details>\n\n<details>\n<summary><strong>Other MCP Clients</strong></summary>\n\nThe server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:\n\n```bash\nnpx @zilliz/claude-context-mcp@latest\n```\n\n</details>\n\n## Features\n\n- 🔌 **MCP Protocol Compliance**: Full compatibility with MCP-enabled AI assistants and agents\n- 🔍 **Hybrid Code Search**: Natural language queries using advanced hybrid search (BM25 + dense vector) to find relevant code snippets\n- 📁 **Codebase Indexing**: Index entire codebases for fast hybrid search across millions of lines of code\n- 🔄 **Incremental Indexing**: Efficiently re-index only changed files using Merkle trees for auto-sync\n- 🧩 **Intelligent Code Chunking**: AST-based code analysis for syntax-aware chunking with automatic fallback\n- 🗄️ **Scalable**: Integrates with Zilliz Cloud for scalable vector search, no matter how large your codebase is\n- 🛠️ **Customizable**: Configure file extensions, ignore patterns, and embedding models\n- ⚡ **Real-time**: Interactive indexing and searching with progress feedback\n\n## Available Tools\n\n### 1. `index_codebase`\n\nIndex a codebase directory for hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to index\n- `force` (optional): Force re-indexing even if already indexed (default: false)\n- `splitter` (optional): Code splitter to use - 'ast' for syntax-aware splitting with automatic fallback, 'langchain' for character-based splitting (default: \"ast\")\n- `customExtensions` (optional): Additional file extensions to include beyond defaults (e.g., ['.vue', '.svelte', '.astro']). Extensions should include the dot prefix or will be automatically added (default: [])\n- `ignorePatterns` (optional): Additional ignore patterns to exclude specific files/directories beyond defaults (e.g., ['static/**', '*.tmp', 'private/**']) (default: [])\n\n### 2. `search_code`\n\nSearch the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to search in\n- `query` (required): Natural language query to search for in the codebase\n- `limit` (optional): Maximum number of results to return (default: 10, max: 50)\n- `extensionFilter` (optional): List of file extensions to filter results (e.g., ['.ts', '.py']) (default: [])\n\n### 3. `clear_index`\n\nClear the search index for a specific codebase.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to clear index for\n\n### 4. `get_indexing_status`\n\nGet the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to check status for\n\n**What the status output means:**\n\n- Progress is **phase-based**, not a direct file-count ratio. The MCP server reports coarse milestones for collection preparation, file scanning, and file processing / embedding work.\n- Because indexing runs in the background and progress is persisted periodically, percentages can jump quickly on large repositories or appear unchanged for a while during long embedding batches.\n- File and chunk statistics are written when an indexing run finishes successfully. During active indexing, `get_indexing_status` intentionally reports progress rather than live file/chunk totals.\n- Codebases are keyed by their **absolute path**. Indexing `/repo`, a symlinked path to the same repo, and a second clone will create separate tracked entries.\n- If a completed entry shows `0 files, 0 chunks`, that usually means the local snapshot metadata is stale rather than the vector database being queried live. Re-indexing, or clearing and re-indexing that exact absolute path, refreshes the stored stats.\n\nFor a deeper explanation, see the [asynchronous indexing workflow guide](../../docs/dive-deep/asynchronous-indexing-workflow.md) and the [troubleshooting FAQ](../../docs/troubleshooting/faq.md).\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines  \n- [MCP Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Projects\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this MCP server\n- **[VSCode Extension](../vscode-extension)** - Alternative VSCode integration\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Official MCP documentation\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/vscode-extension/README.md":"# Semantic Code Search VSCode Extension\n\n[![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/v/zilliz.semanticcodesearch?label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\nA code indexing and semantic search VSCode extension powered by [Claude Context](https://github.com/zilliztech/claude-context).\n\n> 📖 **New to Claude Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.\n\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdtCtT9Qi6o5mGVoxzX50r8Nb6zDFcjvTQR7WZ-xMbEsHEPPhSYAFVJ7q4-rETzxJ8wy1cyZmU8CmtpNhAU8PGOqVnE2kc2HCn1etDg97Qsh7m89kBjG4ZT7XBgO4Dp7BfFZx7eow?key=qYdFquJrLcfXCUndY-YRBQ)\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search based on semantic understanding, not just keyword matching\n- 📁 **Codebase Indexing**: Automatically index entire codebase and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets\n- 🔧 **Multi-platform Support**: Support for OpenAI, VoyageAI, Gemini, and Ollama as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n\n## Requirements\n\n- **VSCode Version**: 1.74.0 or higher\n\n## Installation\n\n### From VS Code Marketplace\n\n1. **Direct Link**: [Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\n2. **Manual Search**:\n   - Open Extensions view in VSCode (Ctrl+Shift+X or Cmd+Shift+X on Mac)\n   - Search for \"Semantic Code Search\"\n   - Click Install\n\n## Quick Start\n\n### Configuration\nThe first time you open Claude Context, you need to click on Settings icon to configure the relevant options.\n\n#### Embedding Configuration\nConfigure your embedding provider to convert code into semantic vectors.\n\n**OpenAI Configuration:**\n- `Embedding Provider`: Select \"OpenAI\" from the dropdown\n- `Model name`: Choose the embedding model (e.g., `text-embedding-3-small`, `text-embedding-3-large`)\n- `OpenAI API key`: Your OpenAI API key for authentication\n- `Custom API endpoint URL`: Optional custom endpoint (defaults to `https://api.openai.com/v1`)\n\n**Other Supported Providers:**\n- **Gemini**: Google's state-of-the-art embedding model with Matryoshka representation learning\n- **VoyageAI**: Alternative embedding provider with competitive performance  \n- **Ollama**: For local embedding models\n\n#### Code Splitter Configuration\nConfigure how your code is split into chunks for indexing.\n\n**Splitter Settings:**\n- `Splitter Type`: Choose between \"AST Splitter\" (syntax-aware) or \"LangChain Splitter\" (character-based)\n- `Chunk Size`: Maximum size of each code chunk (default: 1000 characters)\n- `Chunk Overlap`: Number of overlapping characters between chunks (default: 200 characters)\n\n> **Recommendation**: Use AST Splitter for better semantic understanding of code structure.\n\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n### Usage\n\n1. **Set the Configuration**:\n   - Open VSCode Settings (Ctrl+, or Cmd+, on Mac)\n   - Search for \"Semantic Code Search\"\n   - Set the configuration\n\n2. **Index Codebase**:\n   - Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)\n   - Run \"Semantic Code Search: Index Codebase\"\n\n3. **Start Searching**:\n   - Open Semantic Code Search panel in sidebar\n   - Enter search query or right-click on selected code to search\n\n## Commands\n\n- `Semantic Code Search: Semantic Search` - Perform semantic search\n- `Semantic Code Search: Index Codebase` - Index current codebase\n- `Semantic Code Search: Clear Index` - Clear the index\n\n## Configuration\n\n- `semanticCodeSearch.embeddingProvider.provider` - Embedding provider (OpenAI/VoyageAI/Gemini/Ollama)\n- `semanticCodeSearch.embeddingProvider.model` - Embedding model to use\n- `semanticCodeSearch.embeddingProvider.apiKey` - API key for embedding provider\n- `semanticCodeSearch.embeddingProvider.baseURL` - Custom API endpoint URL (optional, for OpenAI and Gemini)\n- `semanticCodeSearch.embeddingProvider.outputDimensionality` - Output dimension for Gemini (supports 3072, 1536, 768, 256)\n- `semanticCodeSearch.milvus.address` - Milvus server address\n\n## Contributing\n\nThis VSCode extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](https://github.com/zilliztech/claude-context/blob/master/CONTRIBUTING.md) - General contribution guidelines\n- [VSCode Extension Contributing](https://github.com/zilliztech/claude-context/blob/master/packages/vscode-extension/CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](https://github.com/zilliztech/claude-context/tree/master/packages/core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-mcp](https://github.com/zilliztech/claude-context/tree/master/packages/mcp)** - Alternative MCP server integration\n\n## Tech Stack\n\n- TypeScript\n- VSCode Extension API  \n- Milvus Vector Database\n- OpenAI/VoyageAI Embeddings\n\n## License\n\nMIT - See [LICENSE](https://github.com/zilliztech/claude-context/blob/master/LICENSE) for details "},"files":{"AGENTS.md":"CLAUDE.md","CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Overview\n\nClaude Context is an MCP plugin that adds semantic code search to AI coding agents. A codebase is split into chunks, embedded, and stored in a Milvus/Zilliz vector database; queries are answered by semantic (hybrid dense + sparse) search instead of loading whole directories into the model's context.\n\n## Monorepo Layout\n\npnpm workspace (`packages/*`, `examples/*`). Requires Node >=20 <24 and pnpm >=10.\n\n- `packages/core` (`@zilliz/claude-context-core`) — the indexing engine. All real logic lives here; the other packages are thin frontends over it.\n- `packages/mcp` (`@zilliz/claude-context-mcp`) — stdio MCP server, the primary product. ESM (`\"type\": \"module\"`).\n- `packages/vscode-extension` (`semanticcodesearch`) — VSCode extension. Bundled with webpack; stubs out Node-only deps (Milvus gRPC, native AST) in `src/stubs/`.\n- `packages/chrome-extension` — browser build; overrides `@zilliz/milvus2-sdk-node` to `false` (no gRPC in browser).\n- `examples/basic-usage` — runnable library example.\n\n## Commands\n\n```bash\npnpm install\npnpm build                 # build all packages (examples built last)\npnpm build:core            # build a single package: also build:mcp, build:vscode\npnpm dev                   # watch all; or dev:core / dev:mcp / dev:vscode\npnpm lint                  # eslint across packages; lint:fix to autofix\npnpm typecheck             # tsc --noEmit across packages\npnpm clean                 # rimraf dist in every package\n```\n\nPackages depend on `core` via `workspace:*`, so **rebuild core (`pnpm build:core`) before testing mcp/vscode against core changes** — they consume `core/dist`, not its source.\n\n### Tests\n\n- **core** uses Jest + ts-jest. Test files are colocated as `*.test.ts` in `src/`.\n  ```bash\n  pnpm --filter @zilliz/claude-context-core test                     # all (runs in band)\n  pnpm --filter @zilliz/claude-context-core test -- context.abort    # by filename\n  pnpm --filter @zilliz/claude-context-core test -- -t \"pattern\"     # by test name\n  ```\n- **mcp** uses the Node built-in test runner via tsx (no Jest):\n  ```bash\n  pnpm --filter @zilliz/claude-context-mcp test                      # runs src/**/*.test.ts\n  ```\n\n### Running the MCP server locally\n\n```bash\npnpm --filter @zilliz/claude-context-mcp start        # tsx src/index.ts\n```\nConfiguration is entirely via environment variables (see `.env.example` and `packages/mcp/src/config.ts`). Key vars: `EMBEDDING_PROVIDER` (OpenAI | VoyageAI | Gemini | Ollama | OpenRouter), provider API key, `EMBEDDING_MODEL`, `MILVUS_ADDRESS` and/or `MILVUS_TOKEN` (address can be auto-resolved from a Zilliz token), `CODE_CHUNKS_COLLECTION_NAME_OVERRIDE`.\n\n## Architecture\n\n### Core: the `Context` orchestrator (`packages/core/src/context.ts`)\n\n`Context` ties together three pluggable interfaces injected through its constructor config:\n\n- **Embedding** (`src/embedding/`) — `base-embedding.ts` interface with `OpenAIEmbedding`, `VoyageAIEmbedding`, `GeminiEmbedding`, `OllamaEmbedding` implementations.\n- **VectorDatabase** (`src/vectordb/`) — `MilvusVectorDatabase` (gRPC, Node-only) and `MilvusRestfulVectorDatabase` (HTTP, browser-safe). `zilliz-utils.ts` (`ClusterManager`) can provision a free Zilliz cluster and resolve an address from a token.\n- **Splitter** (`src/splitter/`) — `AstCodeSplitter` (tree-sitter, the default at 2500/300 chunk/overlap) which falls back to `LangChainCodeSplitter` for unsupported languages or parse failures.\n\nThe public surface (`indexCodebase`, `reindexByChange`, `semanticSearch`, `clearIndex`, `hasIndex`) is re-exported from `src/index.ts`. Indexing reads files honoring ignore rules, splits them, embeds in batches, and upserts vectors. Collection name is derived from a hash of the absolute codebase path (overridable).\n\nTwo error types carry control-flow meaning and should be preserved when touching the pipeline:\n- `IndexAbortError` — cooperative cancellation via `AbortSignal`.\n- `EmbeddingError` — always re-thrown to halt the whole pipeline, unlike per-file read/parse errors which are logged and skipped. This prevents silent partial indexing (Milvus getting zero vectors while the snapshot marks files done).\n\n### Incremental sync (`packages/core/src/sync/`)\n\n`FileSynchronizer` builds a Merkle DAG (`merkle.ts`) of file hashes to compute `{added, removed, modified}` between runs. Snapshots persist to `~/.context/merkle/<md5-of-path>.json`. `reindexByChange` uses this so re-indexing only touches changed files. The MCP server can also run a background sync loop (`CLAUDE_CONTEXT_BACKGROUND_SYNC`, `CLAUDE_CONTEXT_SYNC_INTERVAL_MS`).\n\n### Ignore patterns\n\nLayered: built-in `DEFAULT_IGNORE_PATTERNS` + config + env (`CUSTOM_IGNORE_PATTERNS`) + on-disk ignore files (`.gitignore`, `.contextignore`, `.xxxignore`, and a global `~/.context/.gitignore`). `utils/ignore-matcher.ts` implements matching including gitignore negation (`!`) semantics — covered by `context.ignore-patterns.test.ts`.\n\n### Env resolution (`packages/core/src/utils/env-manager.ts`)\n\n`envManager.get(name)` resolves with priority `process.env` > `~/.context/.env` file. Use it instead of reading `process.env` directly so the `.env` file fallback keeps working.\n\n### MCP server (`packages/mcp/src/`)\n\n- `index.ts` — entry point. **Critically, it redirects `console.log`/`console.warn` to stderr at the very top**, because stdout is reserved for the MCP JSON protocol. Never write non-protocol output to stdout in this package.\n- `handlers.ts` (`ToolHandlers`) — implements the tools: `index_codebase`, `search_code`, `clear_index`, `get_indexing_status`.\n- `snapshot.ts` (`SnapshotManager`) — tracks per-codebase indexing state across server restarts.\n- `sync.ts` (`SyncManager`) — drives incremental re-indexing.\n- `config.ts`, `embedding.ts` — build `Context` (embedding provider + Milvus) from environment variables.\n\n## Conventions\n\nCommits follow Conventional Commits with these scopes: `core`, `vscode`, `mcp`, `examples`, `docs` (e.g. `fix(core): support gitignore negation patterns`). All code and comments are written in English.\n","packages/chrome-extension/README.md":"# GitHub Code Vector Search Chrome Extension\n\nA Chrome extension for indexing and semantically searching GitHub repository code, powered by Claude Context.\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search on GitHub repositories based on semantic understanding\n- 📁 **Repository Indexing**: Automatically index GitHub repositories and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets directly on GitHub\n- 🔧 **Multi-platform Support**: Support for OpenAI and VoyageAI as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n- 🌐 **GitHub Integration**: Seamlessly integrates with GitHub's interface\n- 📱 **Cross-Repository**: Search across multiple indexed repositories\n- ⚡ **Real-time**: Index and search code as you browse GitHub\n\n## Installation\n\n### From Chrome Web Store\n\n> **Coming Soon**: Extension will be available on Chrome Web Store\n\n### Manual Installation (Development)\n\n1. **Build the Extension**:\n   ```bash\n   cd packages/chrome-extension\n   pnpm build\n   ```\n\n2. **Load in Chrome**:\n   - Open Chrome and navigate to `chrome://extensions/`\n   - Enable \"Developer mode\" in the top right\n   - Click \"Load unpacked\" and select the `dist` folder\n   - The extension should now appear in your extensions list\n\n## Quick Start\n\n1. **Configure Settings**:\n   - Click the extension icon in Chrome toolbar\n   - Go to Options/Settings\n   - Configure embedding provider and API Key\n   - Set up Milvus connection details\n\n2. **Index a Repository**:\n   - Navigate to any GitHub repository\n   - Click the \"Index Repository\" button that appears in the sidebar\n   - Wait for indexing to complete\n\n3. **Start Searching**:\n   - Use the search box that appears on GitHub repository pages\n   - Enter natural language queries like \"function that handles authentication\"\n   - Click on results to navigate to the code\n\n## Configuration\n\nThe extension can be configured through the options page:\n\n- **Embedding Provider**: Choose between OpenAI or VoyageAI\n- **Embedding Model**: Select specific model (e.g., `text-embedding-3-small`)\n- **API Key**: Your embedding provider API key\n- **Milvus Settings**: Vector database connection details\n- **GitHub Token**: Personal access token for private repositories (optional)\n\n## Permissions\n\nThe extension requires the following permissions:\n\n- **Storage**: To save configuration and index metadata\n- **Scripting**: To inject search UI into GitHub pages\n- **Unlimited Storage**: For storing vector embeddings locally\n- **Host Permissions**: Access to GitHub.com and embedding provider APIs\n\n## File Structure\n\n- `src/content.ts` - Main content script that injects UI into GitHub pages\n- `src/background.ts` - Background service worker for extension lifecycle\n- `src/options.ts` - Options page for configuration\n- `src/config/milvusConfig.ts` - Milvus connection configuration\n- `src/milvus/chromeMilvusAdapter.ts` - Browser-compatible Milvus adapter\n- `src/storage/indexedRepoManager.ts` - Repository indexing management\n- `src/stubs/` - Browser compatibility stubs for Node.js modules\n\n## Development Features\n\n- **Browser Compatibility**: Node.js modules adapted for browser environment\n- **WebAssembly Support**: Optimized for browser performance\n- **Offline Capability**: Local storage for indexed repositories\n- **Progress Tracking**: Real-time indexing progress indicators\n- **Error Handling**: Graceful degradation and user feedback\n\n## Usage Examples\n\n### Basic Search\n1. Navigate to a GitHub repository\n2. Enter query: \"error handling middleware\"\n3. Browse semantic search results\n\n### Context Search\n1. Select code snippet on GitHub\n2. Right-click and choose \"Search Similar Code\"\n3. View related code across the repository\n\n### Multi-Repository Search\n1. Index multiple repositories\n2. Use the extension popup to search across all indexed repos\n3. Filter results by repository or file type\n\n## Contributing\n\nThis Chrome extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Chrome Extension Contributing](CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-vscode-extension](../vscode-extension)** - VSCode integration\n- **[@zilliz/claude-context-mcp](../mcp)** - MCP server integration\n\n## Tech Stack\n\n- **TypeScript** - Type-safe development\n- **Chrome Extension Manifest V3** - Modern extension architecture\n- **Webpack** - Module bundling and optimization\n- **Claude Context Core** - Semantic search engine\n- **Milvus Vector Database** - Vector storage and retrieval\n- **OpenAI/VoyageAI Embeddings** - Text embedding generation\n\n## Browser Support\n\n- Chrome 88+\n- Chromium-based browsers (Edge, Brave, etc.)\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/core/README.md":"# @zilliz/claude-context-core\n![](../../assets/claude-context.png)\n\nThe core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.\n\n## Installation\n\n```bash\nnpm install @zilliz/claude-context-core\n```\n\n### Prepare Environment Variables\n#### OpenAI API key\nSee [OpenAI Documentation](https://platform.openai.com/docs/api-reference) for more details to get your API key.\n```bash\nOPENAI_API_KEY=your-openai-api-key\n```\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](../../assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n> 💡 **Tip**: For easier configuration management across different usage scenarios, consider using [global environment variables](../../docs/getting-started/environment-variables.md).\n\n## Quick Start\n\n```typescript\nimport { \n  Context, \n  OpenAIEmbedding, \n  MilvusVectorDatabase \n} from '@zilliz/claude-context-core';\n\n// Initialize embedding provider\nconst embedding = new OpenAIEmbedding({\n  apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',\n  model: 'text-embedding-3-small'\n});\n\n// Initialize vector database\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\n// Create context instance\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n\n// Index a codebase\nconst stats = await context.indexCodebase('./my-project', (progress) => {\n  console.log(`${progress.phase} - ${progress.percentage}%`);\n});\n\nconsole.log(`Indexed ${stats.indexedFiles} files with ${stats.totalChunks} chunks`);\n\n// Search the codebase\nconst results = await context.semanticSearch(\n  './my-project',\n  'function that handles user authentication',\n  5\n);\n\nresults.forEach(result => {\n  console.log(`${result.relativePath}:${result.startLine}-${result.endLine}`);\n  console.log(`Score: ${result.score}`);\n  console.log(result.content);\n});\n```\n\n## Features\n\n- **Multi-language Support**: Index TypeScript, JavaScript, Python, Java, C++, and many other programming languages\n- **Semantic Search**: Find code using natural language queries powered by AI embeddings\n- **Flexible Architecture**: Pluggable embedding providers and vector databases\n- **Smart Chunking**: Intelligent code splitting that preserves context and structure\n- **Batch Processing**: Efficient processing of large codebases with progress tracking\n- **Pattern Matching**: Built-in ignore patterns for common build artifacts and dependencies\n- **Incremental File Synchronization**: Efficient change detection using Merkle trees to only re-index modified files\n\n## Embedding Providers\n\n- **OpenAI Embeddings** (`text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`)\n- **VoyageAI Embeddings** - High-quality embeddings optimized for code (`voyage-code-3`, `voyage-3.5`, etc.)\n- **Gemini Embeddings** - Google's embedding models (`gemini-embedding-001`, `gemini-embedding-2`)\n- **Ollama Embeddings** - Local embedding models via Ollama\n\n## Vector Database Support\n\n- **Milvus/Zilliz Cloud** - High-performance vector database\n\n## Code Splitters\n\n- **AST Code Splitter** - AST-based code splitting with automatic fallback (default)\n- **LangChain Code Splitter** - Character-based code chunking\n\n## Configuration\n\n### ContextConfig\n\n```typescript\ninterface ContextConfig {\n  embedding?: Embedding;           // Embedding provider\n  vectorDatabase?: VectorDatabase; // Vector database instance (required)\n  codeSplitter?: Splitter;        // Code splitting strategy\n  supportedExtensions?: string[]; // File extensions to index\n  ignorePatterns?: string[];      // Patterns to ignore\n  customExtensions?: string[];    // Custom extensions from MCP\n  customIgnorePatterns?: string[]; // Custom ignore patterns from MCP\n}\n```\n\n### Supported File Extensions (Default)\n\n```typescript\n[\n  // Programming languages\n  '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.cpp', '.c', '.h', '.hpp',\n  '.cs', '.go', '.rs', '.php', '.rb', '.swift', '.kt', '.scala', '.m', '.mm',\n  '.dart', '.sol',\n  // Text and markup files  \n  '.md', '.markdown', '.ipynb'\n]\n```\n\n### Default Ignore Patterns\n\n- Build and dependency directories: `node_modules/**`, `dist/**`, `build/**`, `out/**`, `target/**`\n- Version control: `.git/**`, `.svn/**`, `.hg/**`\n- IDE files: `.vscode/**`, `.idea/**`, `*.swp`, `*.swo`\n- Cache directories: `.cache/**`, `__pycache__/**`, `.pytest_cache/**`, `coverage/**`\n- Minified files: `*.min.js`, `*.min.css`, `*.bundle.js`, `*.map`\n- Log and temp files: `logs/**`, `tmp/**`, `temp/**`, `*.log`\n- Environment files: `.env`, `.env.*`, `*.local`\n\n## API Reference\n\n### Context\n\n#### Methods\n\n- `indexCodebase(path, progressCallback?, forceReindex?)` - Index an entire codebase\n- `reindexByChange(path, progressCallback?)` - Incrementally re-index only changed files\n- `semanticSearch(path, query, topK?, threshold?, filterExpr?)` - Search indexed code semantically\n- `hasIndex(path)` - Check if codebase is already indexed\n- `clearIndex(path, progressCallback?)` - Remove index for a codebase\n- `updateIgnorePatterns(patterns)` - Update ignore patterns\n- `addCustomIgnorePatterns(patterns)` - Add custom ignore patterns\n- `addCustomExtensions(extensions)` - Add custom file extensions\n- `updateEmbedding(embedding)` - Switch embedding provider\n- `updateVectorDatabase(vectorDB)` - Switch vector database\n- `updateSplitter(splitter)` - Switch code splitter\n\n### Search Results\n\n```typescript\ninterface SemanticSearchResult {\n  content: string;      // Code content\n  relativePath: string; // File path relative to codebase root\n  startLine: number;    // Starting line number\n  endLine: number;      // Ending line number\n  language: string;     // Programming language\n  score: number;        // Similarity score (0-1)\n}\n```\n\n\n## Examples\n\n### Using VoyageAI Embeddings\n\n```typescript\nimport { Context, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';\n\n// Initialize with VoyageAI embedding provider\nconst embedding = new VoyageAIEmbedding({\n  apiKey: process.env.VOYAGEAI_API_KEY || 'your-voyageai-api-key',\n  model: 'voyage-code-3'\n});\n\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n```\n\n### Custom File Filtering\n\n```typescript\nconst context = new Context({\n  embedding,\n  vectorDatabase,\n  supportedExtensions: ['.ts', '.js', '.py', '.java'],\n  ignorePatterns: [\n    'node_modules/**',\n    'dist/**',\n    '*.spec.ts',\n    '*.test.js'\n  ]\n});\n```\n\n## File Synchronization Architecture\n\nClaude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.\n\n![File Synchronization Architecture](../../assets/file_synchronizer.png)\n\n### How It Works\n\nThe file synchronization system uses a **Merkle tree-based approach** combined with SHA-256 file hashing to detect changes:\n\n#### 1. File Hashing\n- Each file in the codebase is hashed using SHA-256\n- File hashes are computed based on file content, not metadata\n- Hashes are stored with relative file paths for consistency across different environments\n\n#### 2. Merkle Tree Construction\n- All file hashes are organized into a Merkle tree structure\n- The tree provides a single root hash that represents the entire codebase state\n- Any change to any file will cause the root hash to change\n\n#### 3. Snapshot Management\n- File synchronization state is persisted to `~/.context/merkle/` directory\n- Each codebase gets a unique snapshot file based on its absolute path hash\n- Snapshots contain both file hashes and serialized Merkle tree data\n\n#### 4. Change Detection Process\n1. **Quick Check**: Compare current Merkle root hash with stored snapshot\n2. **Detailed Analysis**: If root hashes differ, perform file-by-file comparison\n3. **Change Classification**: Categorize changes into three types:\n   - **Added**: New files that didn't exist before\n   - **Modified**: Existing files with changed content\n   - **Removed**: Files that were deleted from the codebase\n\n#### 5. Incremental Updates\n- Only process files that have actually changed\n- Update vector database entries only for modified chunks\n- Remove entries for deleted files\n- Add entries for new files\n\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Packages\n\n- **[@claude-context/mcp](../mcp)** - MCP server that uses this core engine\n- **[VSCode Extension](../vscode-extension)** - VSCode extension built on this core\n\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/mcp/README.md":"# @zilliz/claude-context-mcp\n\n![](../../assets/claude-context.png)\nModel Context Protocol (MCP) integration for Claude Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## 🚀 Use Claude Context as MCP in Claude Code and others\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf2uIf2c5zowp-iOMOqsefHbY_EwNGiutkxtNXcZVJ8RI6SN9DsCcsc3amXIhOZx9VcKFJQLSAqM-2pjU9zoGs1r8GCTUL3JIsLpLUGAm1VQd5F2o5vpEajx2qrc77iXhBu1zWj?key=qYdFquJrLcfXCUndY-YRBQ)\n\nModel Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.\n\n## Quick Start\n\n### Prerequisites\n\nBefore using the MCP server, make sure you have:\n\n- API key for your chosen embedding provider (OpenAI, VoyageAI, Gemini, or Ollama setup)\n- Milvus vector database (local or cloud)\n\n> 💡 **Setup Help:** See the [main project setup guide](../../README.md#-quick-start) for detailed installation instructions.\n\n### Prepare Environment Variables\n\n#### Embedding Provider Configuration\n\nClaude Context MCP supports multiple embedding providers. Choose the one that best fits your needs:\n\n> 📋 **Quick Reference**: For a complete list of environment variables and their descriptions, see the [Environment Variables Guide](../../docs/getting-started/environment-variables.md).\n\n```bash\n# Supported providers: OpenAI, VoyageAI, Gemini, Ollama\nEMBEDDING_PROVIDER=OpenAI\n```\n\n<details>\n<summary><strong>1. OpenAI Configuration (Default)</strong></summary>\n\nOpenAI provides high-quality embeddings with excellent performance for code understanding.\n\n```bash\n# Required: Your OpenAI API key\nOPENAI_API_KEY=sk-your-openai-api-key\n\n# Optional: Specify embedding model (default: text-embedding-3-small)\nEMBEDDING_MODEL=text-embedding-3-small\n\n# Optional: Custom API base URL (for Azure OpenAI or other compatible services)\nOPENAI_BASE_URL=https://api.openai.com/v1\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`openai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/openai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)\n2. Sign in or create an account\n3. Generate a new API key\n4. Set up billing if needed\n\n</details>\n\n<details>\n<summary><strong>2. VoyageAI Configuration</strong></summary>\n\nVoyageAI offers specialized code embeddings optimized for programming languages.\n\n```bash\n# Required: Your VoyageAI API key\nVOYAGEAI_API_KEY=pa-your-voyageai-api-key\n\n# Optional: Specify embedding model (default: voyage-code-3)\nEMBEDDING_MODEL=voyage-code-3\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`voyageai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/voyageai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [VoyageAI Console](https://dash.voyageai.com/)\n2. Sign up for an account\n3. Navigate to API Keys section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>3. Gemini Configuration</strong></summary>\n\nGoogle's Gemini provides competitive embeddings with good multilingual support.\n\n```bash\n# Required: Your Gemini API key\nGEMINI_API_KEY=your-gemini-api-key\n\n# Optional: Specify embedding model (default: gemini-embedding-001; supports gemini-embedding-2)\nEMBEDDING_MODEL=gemini-embedding-001\n\n# Optional: Custom API base URL (for custom endpoints)\nGEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`gemini-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/gemini-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [Google AI Studio](https://aistudio.google.com/)\n2. Sign in with your Google account\n3. Go to \"Get API key\" section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>4. Ollama Configuration (Local/Self-hosted)</strong></summary>\n\nOllama allows you to run embeddings locally without sending data to external services.\n\n```bash\n# Required: Specify which Ollama model to use\nEMBEDDING_MODEL=nomic-embed-text\n\n# Optional: Specify Ollama host (default: http://127.0.0.1:11434)\nOLLAMA_HOST=http://127.0.0.1:11434\n\n# Optional: Override embedding dimension to skip runtime dimension detection\nEMBEDDING_DIMENSION=768\n```\n\n**Setup Instructions:**\n\n1. Install Ollama from [ollama.com](https://ollama.com/)\n2. Pull the embedding model:\n\n   ```bash\n   ollama pull nomic-embed-text\n   ```\n\n3. Ensure Ollama is running:\n\n   ```bash\n   ollama serve\n   ```\n\n</details>\n\n#### Get a free vector database on Zilliz Cloud\n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.\n\n![](../../assets/signup_and_get_apikey.png)\n\nCopy your Personal Key to replace `your-zilliz-cloud-api-key` in the configuration examples.\n\n```bash\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n\n# Optional: increase timeout for Milvus collection-limit pre-check on slow clusters (default: 15000)\nMILVUS_COLLECTION_LIMIT_CHECK_TIMEOUT_MS=30000\n```\n\n#### Embedding Batch Size\n\nYou can set the embedding batch size to optimize the performance of the MCP server, depending on your embedding model throughput. The default value is 100.\n\n```bash\nEMBEDDING_BATCH_SIZE=512\n```\n\n#### Custom File Processing (Optional)\n\nYou can configure custom file extensions and ignore patterns globally via environment variables:\n\n```bash\n# Additional file extensions to include beyond defaults\nCUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig\n\n# Additional ignore patterns to exclude files/directories\nCUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**\n```\n\nThese settings work in combination with tool parameters - patterns from both sources will be merged together.\n\n#### Custom Collection Name (Optional)\n\nUse this when you want a human-readable prefix on collection names in Milvus/Zilliz instead of the bare hash:\n\n```bash\n# Creates code_chunks_my_project_<pathHash> or hybrid_code_chunks_my_project_<pathHash>\nCODE_CHUNKS_COLLECTION_NAME_OVERRIDE=my_project\n```\n\nThe per-codebase `<pathHash>` suffix is preserved even when the override is set, so the same MCP server can still index multiple repos without collapsing them onto one collection. The override value is sanitized to letters, numbers, and underscores, and truncated to keep the full name within Milvus's 255-char limit. If you unset the variable later, Claude Context switches back to the plain `code_chunks_<pathHash>` naming.\n\n#### Trigger File Watcher (Optional)\n\nIn addition to the periodic background sync, the MCP server watches a sentinel file at `~/.context/.sync-trigger` and starts an immediate re-index whenever the file is modified. This lets external tools (Claude Code `PostToolUse` hooks, editor save hooks, CI scripts, etc.) request a sync on demand instead of waiting for the next polling tick.\n\n```bash\n# Default: watcher enabled. Set to false to disable filesystem watching entirely\n# (useful on read-only filesystems or sandboxed environments).\nCLAUDE_CONTEXT_TRIGGER_WATCHER=true\n```\n\nExample — Claude Code hook that re-indexes after every Edit/Write:\n\n```json\n\"hooks\": {\n  \"PostToolUse\": [\n    { \"matcher\": \"Edit|Write\", \"hooks\": [\n      { \"type\": \"command\", \"command\": \"touch ~/.context/.sync-trigger\" }\n    ]}\n  ]\n}\n```\n\nNotes:\n- The trigger fires a debounced re-index (2 s window) so rapid touches collapse to a single sync.\n- Triggered syncs go through the same global cross-process lock as background sync, so when multiple MCP processes share `$HOME` only one process performs the work per trigger.\n- The trigger file's *contents* are ignored — only the modification event matters.\n\n#### Background Sync Configuration (Optional)\n\nBy default, the MCP server runs startup + periodic background sync for compatibility with existing installations. The global cross-process sync lock ensures only one local MCP process performs a sync cycle at a time.\n\nYou can tune or disable periodic polling with environment variables:\n\n```bash\n# Default: true. Set to false to disable startup + periodic polling.\nCLAUDE_CONTEXT_BACKGROUND_SYNC=false\n\n# Optional: control how often sync runs (default: 300000 = 5 minutes)\nCLAUDE_CONTEXT_SYNC_INTERVAL_MS=60000\n```\n\nFor multi-instance local stdio setups, set `CLAUDE_CONTEXT_BACKGROUND_SYNC=false` and keep the trigger watcher enabled. That avoids idle polling while still allowing external tools to request immediate re-indexing by touching `~/.context/.sync-trigger`.\n\n## Usage with MCP Clients\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\nUse the command line interface to add the Claude Context MCP server:\n\n```bash\n# Add the Claude Context MCP server\nclaude mcp add claude-context -e OPENAI_API_KEY=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\n\n```\n\nSee the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details about MCP server management.\n\n</details>\n\n<details>\n<summary><strong>OpenAI Codex CLI</strong></summary>\n\nCodex CLI uses TOML configuration files:\n\n1. Create or edit the `~/.codex/config.toml` file.\n\n2. Add the following configuration:\n\n```toml\n# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.\n[mcp_servers.claude-context]\ncommand = \"npx\"\nargs = [\"@zilliz/claude-context-mcp@latest\"]\nenv = { \"OPENAI_API_KEY\" = \"your-openai-api-key\", \"MILVUS_TOKEN\" = \"your-zilliz-cloud-api-key\" }\n# Optional: override the default 10s startup timeout\nstartup_timeout_ms = 20000\n```\n\n3. Save the file and restart Codex CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Gemini CLI</strong></summary>\n\nGemini CLI requires manual configuration through a JSON file:\n\n1. Create or edit the `~/.gemini/settings.json` file.\n\n2. Add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file and restart Gemini CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Qwen Code</strong></summary>\n\nCreate or edit the `~/.qwen/settings.json` file and add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\nGo to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`\n\nPasting 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](https://cursor.com/docs/context/mcp) for more info.\n\n**OpenAI Configuration (Default):**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"OpenAI\",\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**VoyageAI Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"VoyageAI\",\n        \"VOYAGEAI_API_KEY\": \"your-voyageai-api-key\",\n        \"EMBEDDING_MODEL\": \"voyage-code-3\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Gemini Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Gemini\",\n        \"GEMINI_API_KEY\": \"your-gemini-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Ollama Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Ollama\",\n        \"EMBEDDING_MODEL\": \"nomic-embed-text\",\n        \"OLLAMA_HOST\": \"http://127.0.0.1:11434\",\n        \"EMBEDDING_DIMENSION\": \"768\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Void</strong></summary>\n\nGo to: `Settings` -> `MCP` -> `Add MCP Server`\n\nAdd the following configuration to your Void MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Desktop</strong></summary>\n\nAdd to your Claude Desktop configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nWindsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>VS Code</strong></summary>\n\nThe Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cherry Studio</strong></summary>\n\nCherry 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:\n\n1. Navigate to **Settings → MCP Servers → Add Server**.\n2. Fill in the server details:\n   - **Name**: `claude-context`\n   - **Type**: `STDIO`\n   - **Command**: `npx`\n   - **Arguments**: `[\"-y\", \"@zilliz/claude-context-mcp@latest\"]`\n   - **Environment Variables**:\n     - `OPENAI_API_KEY`: `your-openai-api-key`\n     - `MILVUS_TOKEN`: `your-zilliz-cloud-api-key`\n3. Save the configuration to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Cline</strong></summary>\n\nCline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:\n\n1. Open Cline and click on the **MCP Servers** icon in the top navigation bar.\n\n2. Select the **Installed** tab, then click **Advanced MCP Settings**.\n\n3. In the `cline_mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n4. Save the file.\n\n</details>\n\n<details>\n<summary><strong>Augment</strong></summary>\n\nTo configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.\n\n#### **A. Using the Augment Code UI**\n\n1. Click the hamburger menu.\n\n2. Select **Settings**.\n\n3. Navigate to the **Tools** section.\n\n4. Click the **+ Add MCP** button.\n\n5. Enter the following command:\n\n   ```\n   npx @zilliz/claude-context-mcp@latest\n   ```\n\n6. Name the MCP: **Claude Context**.\n\n7. Click the **Add** button.\n\n------\n\n#### **B. Manual Configuration**\n\n1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel\n2. Select Edit Settings\n3. Under Advanced, click Edit in settings.json\n4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object\n\n```json\n\"augment.advanced\": { \n  \"mcpServers\": [ \n    { \n      \"name\": \"claude-context\", \n      \"command\": \"npx\", \n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"] \n    } \n  ] \n}\n```\n\n</details>\n\n<details>\n<summary><strong>Roo Code</strong></summary>\n\nRoo Code utilizes a JSON configuration file for MCP servers:\n\n1. Open Roo Code and navigate to **Settings → MCP Servers → Edit Global Config**.\n\n2. In the `mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Zencoder</strong></summary>\n\nZencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.\n\n1. Go to the Zencoder menu (...)\n2. From the dropdown menu, select `Tools`\n3. Click on the `Add Custom MCP`\n4. Add the name (i.e. `Claude Context` and server configuration from below, and make sure to hit the `Install` button\n\n```json\n{\n    \"command\": \"npx\",\n    \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n    \"env\": {\n      \"OPENAI_API_KEY\": \"your-openai-api-key\",\n      \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n      \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n    }\n}\n\n```\n\n5. Save the server by hitting the `Install` button.\n\n</details>\n\n<details>\n<summary><strong>LangChain/LangGraph</strong></summary>\n\nFor LangChain/LangGraph integration examples, see [this example](https://github.com/zilliztech/claude-context/blob/643796a0d30e706a2a0dff3d55621c9b5d831807/evaluation/retrieval/custom.py#L88).\n\n</details>\n\n<details>\n<summary><strong>Other MCP Clients</strong></summary>\n\nThe server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:\n\n```bash\nnpx @zilliz/claude-context-mcp@latest\n```\n\n</details>\n\n## Features\n\n- 🔌 **MCP Protocol Compliance**: Full compatibility with MCP-enabled AI assistants and agents\n- 🔍 **Hybrid Code Search**: Natural language queries using advanced hybrid search (BM25 + dense vector) to find relevant code snippets\n- 📁 **Codebase Indexing**: Index entire codebases for fast hybrid search across millions of lines of code\n- 🔄 **Incremental Indexing**: Efficiently re-index only changed files using Merkle trees for auto-sync\n- 🧩 **Intelligent Code Chunking**: AST-based code analysis for syntax-aware chunking with automatic fallback\n- 🗄️ **Scalable**: Integrates with Zilliz Cloud for scalable vector search, no matter how large your codebase is\n- 🛠️ **Customizable**: Configure file extensions, ignore patterns, and embedding models\n- ⚡ **Real-time**: Interactive indexing and searching with progress feedback\n\n## Available Tools\n\n### 1. `index_codebase`\n\nIndex a codebase directory for hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to index\n- `force` (optional): Force re-indexing even if already indexed (default: false)\n- `splitter` (optional): Code splitter to use - 'ast' for syntax-aware splitting with automatic fallback, 'langchain' for character-based splitting (default: \"ast\")\n- `customExtensions` (optional): Additional file extensions to include beyond defaults (e.g., ['.vue', '.svelte', '.astro']). Extensions should include the dot prefix or will be automatically added (default: [])\n- `ignorePatterns` (optional): Additional ignore patterns to exclude specific files/directories beyond defaults (e.g., ['static/**', '*.tmp', 'private/**']) (default: [])\n\n### 2. `search_code`\n\nSearch the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to search in\n- `query` (required): Natural language query to search for in the codebase\n- `limit` (optional): Maximum number of results to return (default: 10, max: 50)\n- `extensionFilter` (optional): List of file extensions to filter results (e.g., ['.ts', '.py']) (default: [])\n\n### 3. `clear_index`\n\nClear the search index for a specific codebase.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to clear index for\n\n### 4. `get_indexing_status`\n\nGet the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to check status for\n\n**What the status output means:**\n\n- Progress is **phase-based**, not a direct file-count ratio. The MCP server reports coarse milestones for collection preparation, file scanning, and file processing / embedding work.\n- Because indexing runs in the background and progress is persisted periodically, percentages can jump quickly on large repositories or appear unchanged for a while during long embedding batches.\n- File and chunk statistics are written when an indexing run finishes successfully. During active indexing, `get_indexing_status` intentionally reports progress rather than live file/chunk totals.\n- Codebases are keyed by their **absolute path**. Indexing `/repo`, a symlinked path to the same repo, and a second clone will create separate tracked entries.\n- If a completed entry shows `0 files, 0 chunks`, that usually means the local snapshot metadata is stale rather than the vector database being queried live. Re-indexing, or clearing and re-indexing that exact absolute path, refreshes the stored stats.\n\nFor a deeper explanation, see the [asynchronous indexing workflow guide](../../docs/dive-deep/asynchronous-indexing-workflow.md) and the [troubleshooting FAQ](../../docs/troubleshooting/faq.md).\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines  \n- [MCP Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Projects\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this MCP server\n- **[VSCode Extension](../vscode-extension)** - Alternative VSCode integration\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Official MCP documentation\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","packages/vscode-extension/README.md":"# Semantic Code Search VSCode Extension\n\n[![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/v/zilliz.semanticcodesearch?label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\nA code indexing and semantic search VSCode extension powered by [Claude Context](https://github.com/zilliztech/claude-context).\n\n> 📖 **New to Claude Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.\n\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdtCtT9Qi6o5mGVoxzX50r8Nb6zDFcjvTQR7WZ-xMbEsHEPPhSYAFVJ7q4-rETzxJ8wy1cyZmU8CmtpNhAU8PGOqVnE2kc2HCn1etDg97Qsh7m89kBjG4ZT7XBgO4Dp7BfFZx7eow?key=qYdFquJrLcfXCUndY-YRBQ)\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search based on semantic understanding, not just keyword matching\n- 📁 **Codebase Indexing**: Automatically index entire codebase and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets\n- 🔧 **Multi-platform Support**: Support for OpenAI, VoyageAI, Gemini, and Ollama as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n\n## Requirements\n\n- **VSCode Version**: 1.74.0 or higher\n\n## Installation\n\n### From VS Code Marketplace\n\n1. **Direct Link**: [Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\n2. **Manual Search**:\n   - Open Extensions view in VSCode (Ctrl+Shift+X or Cmd+Shift+X on Mac)\n   - Search for \"Semantic Code Search\"\n   - Click Install\n\n## Quick Start\n\n### Configuration\nThe first time you open Claude Context, you need to click on Settings icon to configure the relevant options.\n\n#### Embedding Configuration\nConfigure your embedding provider to convert code into semantic vectors.\n\n**OpenAI Configuration:**\n- `Embedding Provider`: Select \"OpenAI\" from the dropdown\n- `Model name`: Choose the embedding model (e.g., `text-embedding-3-small`, `text-embedding-3-large`)\n- `OpenAI API key`: Your OpenAI API key for authentication\n- `Custom API endpoint URL`: Optional custom endpoint (defaults to `https://api.openai.com/v1`)\n\n**Other Supported Providers:**\n- **Gemini**: Google's state-of-the-art embedding model with Matryoshka representation learning\n- **VoyageAI**: Alternative embedding provider with competitive performance  \n- **Ollama**: For local embedding models\n\n#### Code Splitter Configuration\nConfigure how your code is split into chunks for indexing.\n\n**Splitter Settings:**\n- `Splitter Type`: Choose between \"AST Splitter\" (syntax-aware) or \"LangChain Splitter\" (character-based)\n- `Chunk Size`: Maximum size of each code chunk (default: 1000 characters)\n- `Chunk Overlap`: Number of overlapping characters between chunks (default: 200 characters)\n\n> **Recommendation**: Use AST Splitter for better semantic understanding of code structure.\n\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n### Usage\n\n1. **Set the Configuration**:\n   - Open VSCode Settings (Ctrl+, or Cmd+, on Mac)\n   - Search for \"Semantic Code Search\"\n   - Set the configuration\n\n2. **Index Codebase**:\n   - Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)\n   - Run \"Semantic Code Search: Index Codebase\"\n\n3. **Start Searching**:\n   - Open Semantic Code Search panel in sidebar\n   - Enter search query or right-click on selected code to search\n\n## Commands\n\n- `Semantic Code Search: Semantic Search` - Perform semantic search\n- `Semantic Code Search: Index Codebase` - Index current codebase\n- `Semantic Code Search: Clear Index` - Clear the index\n\n## Configuration\n\n- `semanticCodeSearch.embeddingProvider.provider` - Embedding provider (OpenAI/VoyageAI/Gemini/Ollama)\n- `semanticCodeSearch.embeddingProvider.model` - Embedding model to use\n- `semanticCodeSearch.embeddingProvider.apiKey` - API key for embedding provider\n- `semanticCodeSearch.embeddingProvider.baseURL` - Custom API endpoint URL (optional, for OpenAI and Gemini)\n- `semanticCodeSearch.embeddingProvider.outputDimensionality` - Output dimension for Gemini (supports 3072, 1536, 768, 256)\n- `semanticCodeSearch.milvus.address` - Milvus server address\n\n## Contributing\n\nThis VSCode extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](https://github.com/zilliztech/claude-context/blob/master/CONTRIBUTING.md) - General contribution guidelines\n- [VSCode Extension Contributing](https://github.com/zilliztech/claude-context/blob/master/packages/vscode-extension/CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](https://github.com/zilliztech/claude-context/tree/master/packages/core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-mcp](https://github.com/zilliztech/claude-context/tree/master/packages/mcp)** - Alternative MCP server integration\n\n## Tech Stack\n\n- TypeScript\n- VSCode Extension API  \n- Milvus Vector Database\n- OpenAI/VoyageAI Embeddings\n\n## License\n\nMIT - See [LICENSE](https://github.com/zilliztech/claude-context/blob/master/LICENSE) for details "},"items":[{"name":"AGENTS.md","path":"AGENTS.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/AGENTS.md","title":"AI Agent Protocol & Instructions","category":"root-instruction","format":"markdown","content":"CLAUDE.md","isInternal":false,"tokens":4,"sizeBytes":9},{"name":"CLAUDE.md","path":"CLAUDE.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/CLAUDE.md","title":"Claude Agent Guidelines & System Prompt","category":"claude-rule","format":"markdown","content":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Overview\n\nClaude Context is an MCP plugin that adds semantic code search to AI coding agents. A codebase is split into chunks, embedded, and stored in a Milvus/Zilliz vector database; queries are answered by semantic (hybrid dense + sparse) search instead of loading whole directories into the model's context.\n\n## Monorepo Layout\n\npnpm workspace (`packages/*`, `examples/*`). Requires Node >=20 <24 and pnpm >=10.\n\n- `packages/core` (`@zilliz/claude-context-core`) — the indexing engine. All real logic lives here; the other packages are thin frontends over it.\n- `packages/mcp` (`@zilliz/claude-context-mcp`) — stdio MCP server, the primary product. ESM (`\"type\": \"module\"`).\n- `packages/vscode-extension` (`semanticcodesearch`) — VSCode extension. Bundled with webpack; stubs out Node-only deps (Milvus gRPC, native AST) in `src/stubs/`.\n- `packages/chrome-extension` — browser build; overrides `@zilliz/milvus2-sdk-node` to `false` (no gRPC in browser).\n- `examples/basic-usage` — runnable library example.\n\n## Commands\n\n```bash\npnpm install\npnpm build                 # build all packages (examples built last)\npnpm build:core            # build a single package: also build:mcp, build:vscode\npnpm dev                   # watch all; or dev:core / dev:mcp / dev:vscode\npnpm lint                  # eslint across packages; lint:fix to autofix\npnpm typecheck             # tsc --noEmit across packages\npnpm clean                 # rimraf dist in every package\n```\n\nPackages depend on `core` via `workspace:*`, so **rebuild core (`pnpm build:core`) before testing mcp/vscode against core changes** — they consume `core/dist`, not its source.\n\n### Tests\n\n- **core** uses Jest + ts-jest. Test files are colocated as `*.test.ts` in `src/`.\n  ```bash\n  pnpm --filter @zilliz/claude-context-core test                     # all (runs in band)\n  pnpm --filter @zilliz/claude-context-core test -- context.abort    # by filename\n  pnpm --filter @zilliz/claude-context-core test -- -t \"pattern\"     # by test name\n  ```\n- **mcp** uses the Node built-in test runner via tsx (no Jest):\n  ```bash\n  pnpm --filter @zilliz/claude-context-mcp test                      # runs src/**/*.test.ts\n  ```\n\n### Running the MCP server locally\n\n```bash\npnpm --filter @zilliz/claude-context-mcp start        # tsx src/index.ts\n```\nConfiguration is entirely via environment variables (see `.env.example` and `packages/mcp/src/config.ts`). Key vars: `EMBEDDING_PROVIDER` (OpenAI | VoyageAI | Gemini | Ollama | OpenRouter), provider API key, `EMBEDDING_MODEL`, `MILVUS_ADDRESS` and/or `MILVUS_TOKEN` (address can be auto-resolved from a Zilliz token), `CODE_CHUNKS_COLLECTION_NAME_OVERRIDE`.\n\n## Architecture\n\n### Core: the `Context` orchestrator (`packages/core/src/context.ts`)\n\n`Context` ties together three pluggable interfaces injected through its constructor config:\n\n- **Embedding** (`src/embedding/`) — `base-embedding.ts` interface with `OpenAIEmbedding`, `VoyageAIEmbedding`, `GeminiEmbedding`, `OllamaEmbedding` implementations.\n- **VectorDatabase** (`src/vectordb/`) — `MilvusVectorDatabase` (gRPC, Node-only) and `MilvusRestfulVectorDatabase` (HTTP, browser-safe). `zilliz-utils.ts` (`ClusterManager`) can provision a free Zilliz cluster and resolve an address from a token.\n- **Splitter** (`src/splitter/`) — `AstCodeSplitter` (tree-sitter, the default at 2500/300 chunk/overlap) which falls back to `LangChainCodeSplitter` for unsupported languages or parse failures.\n\nThe public surface (`indexCodebase`, `reindexByChange`, `semanticSearch`, `clearIndex`, `hasIndex`) is re-exported from `src/index.ts`. Indexing reads files honoring ignore rules, splits them, embeds in batches, and upserts vectors. Collection name is derived from a hash of the absolute codebase path (overridable).\n\nTwo error types carry control-flow meaning and should be preserved when touching the pipeline:\n- `IndexAbortError` — cooperative cancellation via `AbortSignal`.\n- `EmbeddingError` — always re-thrown to halt the whole pipeline, unlike per-file read/parse errors which are logged and skipped. This prevents silent partial indexing (Milvus getting zero vectors while the snapshot marks files done).\n\n### Incremental sync (`packages/core/src/sync/`)\n\n`FileSynchronizer` builds a Merkle DAG (`merkle.ts`) of file hashes to compute `{added, removed, modified}` between runs. Snapshots persist to `~/.context/merkle/<md5-of-path>.json`. `reindexByChange` uses this so re-indexing only touches changed files. The MCP server can also run a background sync loop (`CLAUDE_CONTEXT_BACKGROUND_SYNC`, `CLAUDE_CONTEXT_SYNC_INTERVAL_MS`).\n\n### Ignore patterns\n\nLayered: built-in `DEFAULT_IGNORE_PATTERNS` + config + env (`CUSTOM_IGNORE_PATTERNS`) + on-disk ignore files (`.gitignore`, `.contextignore`, `.xxxignore`, and a global `~/.context/.gitignore`). `utils/ignore-matcher.ts` implements matching including gitignore negation (`!`) semantics — covered by `context.ignore-patterns.test.ts`.\n\n### Env resolution (`packages/core/src/utils/env-manager.ts`)\n\n`envManager.get(name)` resolves with priority `process.env` > `~/.context/.env` file. Use it instead of reading `process.env` directly so the `.env` file fallback keeps working.\n\n### MCP server (`packages/mcp/src/`)\n\n- `index.ts` — entry point. **Critically, it redirects `console.log`/`console.warn` to stderr at the very top**, because stdout is reserved for the MCP JSON protocol. Never write non-protocol output to stdout in this package.\n- `handlers.ts` (`ToolHandlers`) — implements the tools: `index_codebase`, `search_code`, `clear_index`, `get_indexing_status`.\n- `snapshot.ts` (`SnapshotManager`) — tracks per-codebase indexing state across server restarts.\n- `sync.ts` (`SyncManager`) — drives incremental re-indexing.\n- `config.ts`, `embedding.ts` — build `Context` (embedding provider + Milvus) from environment variables.\n\n## Conventions\n\nCommits follow Conventional Commits with these scopes: `core`, `vscode`, `mcp`, `examples`, `docs` (e.g. `fix(core): support gitignore negation patterns`). All code and comments are written in English.\n","isInternal":false,"tokens":1571,"sizeBytes":6226},{"name":"README.md","path":"packages/chrome-extension/README.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/packages/chrome-extension/README.md","title":"chrome-extension Documentation","category":"plugin-manifest","format":"markdown","content":"# GitHub Code Vector Search Chrome Extension\n\nA Chrome extension for indexing and semantically searching GitHub repository code, powered by Claude Context.\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search on GitHub repositories based on semantic understanding\n- 📁 **Repository Indexing**: Automatically index GitHub repositories and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets directly on GitHub\n- 🔧 **Multi-platform Support**: Support for OpenAI and VoyageAI as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n- 🌐 **GitHub Integration**: Seamlessly integrates with GitHub's interface\n- 📱 **Cross-Repository**: Search across multiple indexed repositories\n- ⚡ **Real-time**: Index and search code as you browse GitHub\n\n## Installation\n\n### From Chrome Web Store\n\n> **Coming Soon**: Extension will be available on Chrome Web Store\n\n### Manual Installation (Development)\n\n1. **Build the Extension**:\n   ```bash\n   cd packages/chrome-extension\n   pnpm build\n   ```\n\n2. **Load in Chrome**:\n   - Open Chrome and navigate to `chrome://extensions/`\n   - Enable \"Developer mode\" in the top right\n   - Click \"Load unpacked\" and select the `dist` folder\n   - The extension should now appear in your extensions list\n\n## Quick Start\n\n1. **Configure Settings**:\n   - Click the extension icon in Chrome toolbar\n   - Go to Options/Settings\n   - Configure embedding provider and API Key\n   - Set up Milvus connection details\n\n2. **Index a Repository**:\n   - Navigate to any GitHub repository\n   - Click the \"Index Repository\" button that appears in the sidebar\n   - Wait for indexing to complete\n\n3. **Start Searching**:\n   - Use the search box that appears on GitHub repository pages\n   - Enter natural language queries like \"function that handles authentication\"\n   - Click on results to navigate to the code\n\n## Configuration\n\nThe extension can be configured through the options page:\n\n- **Embedding Provider**: Choose between OpenAI or VoyageAI\n- **Embedding Model**: Select specific model (e.g., `text-embedding-3-small`)\n- **API Key**: Your embedding provider API key\n- **Milvus Settings**: Vector database connection details\n- **GitHub Token**: Personal access token for private repositories (optional)\n\n## Permissions\n\nThe extension requires the following permissions:\n\n- **Storage**: To save configuration and index metadata\n- **Scripting**: To inject search UI into GitHub pages\n- **Unlimited Storage**: For storing vector embeddings locally\n- **Host Permissions**: Access to GitHub.com and embedding provider APIs\n\n## File Structure\n\n- `src/content.ts` - Main content script that injects UI into GitHub pages\n- `src/background.ts` - Background service worker for extension lifecycle\n- `src/options.ts` - Options page for configuration\n- `src/config/milvusConfig.ts` - Milvus connection configuration\n- `src/milvus/chromeMilvusAdapter.ts` - Browser-compatible Milvus adapter\n- `src/storage/indexedRepoManager.ts` - Repository indexing management\n- `src/stubs/` - Browser compatibility stubs for Node.js modules\n\n## Development Features\n\n- **Browser Compatibility**: Node.js modules adapted for browser environment\n- **WebAssembly Support**: Optimized for browser performance\n- **Offline Capability**: Local storage for indexed repositories\n- **Progress Tracking**: Real-time indexing progress indicators\n- **Error Handling**: Graceful degradation and user feedback\n\n## Usage Examples\n\n### Basic Search\n1. Navigate to a GitHub repository\n2. Enter query: \"error handling middleware\"\n3. Browse semantic search results\n\n### Context Search\n1. Select code snippet on GitHub\n2. Right-click and choose \"Search Similar Code\"\n3. View related code across the repository\n\n### Multi-Repository Search\n1. Index multiple repositories\n2. Use the extension popup to search across all indexed repos\n3. Filter results by repository or file type\n\n## Contributing\n\nThis Chrome extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Chrome Extension Contributing](CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-vscode-extension](../vscode-extension)** - VSCode integration\n- **[@zilliz/claude-context-mcp](../mcp)** - MCP server integration\n\n## Tech Stack\n\n- **TypeScript** - Type-safe development\n- **Chrome Extension Manifest V3** - Modern extension architecture\n- **Webpack** - Module bundling and optimization\n- **Claude Context Core** - Semantic search engine\n- **Milvus Vector Database** - Vector storage and retrieval\n- **OpenAI/VoyageAI Embeddings** - Text embedding generation\n\n## Browser Support\n\n- Chrome 88+\n- Chromium-based browsers (Edge, Brave, etc.)\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","isInternal":false,"tokens":1128,"sizeBytes":5145},{"name":"README.md","path":"packages/core/README.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/packages/core/README.md","title":"core Documentation","category":"plugin-manifest","format":"markdown","content":"# @zilliz/claude-context-core\n![](../../assets/claude-context.png)\n\nThe core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.\n\n## Installation\n\n```bash\nnpm install @zilliz/claude-context-core\n```\n\n### Prepare Environment Variables\n#### OpenAI API key\nSee [OpenAI Documentation](https://platform.openai.com/docs/api-reference) for more details to get your API key.\n```bash\nOPENAI_API_KEY=your-openai-api-key\n```\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](../../assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n> 💡 **Tip**: For easier configuration management across different usage scenarios, consider using [global environment variables](../../docs/getting-started/environment-variables.md).\n\n## Quick Start\n\n```typescript\nimport { \n  Context, \n  OpenAIEmbedding, \n  MilvusVectorDatabase \n} from '@zilliz/claude-context-core';\n\n// Initialize embedding provider\nconst embedding = new OpenAIEmbedding({\n  apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',\n  model: 'text-embedding-3-small'\n});\n\n// Initialize vector database\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\n// Create context instance\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n\n// Index a codebase\nconst stats = await context.indexCodebase('./my-project', (progress) => {\n  console.log(`${progress.phase} - ${progress.percentage}%`);\n});\n\nconsole.log(`Indexed ${stats.indexedFiles} files with ${stats.totalChunks} chunks`);\n\n// Search the codebase\nconst results = await context.semanticSearch(\n  './my-project',\n  'function that handles user authentication',\n  5\n);\n\nresults.forEach(result => {\n  console.log(`${result.relativePath}:${result.startLine}-${result.endLine}`);\n  console.log(`Score: ${result.score}`);\n  console.log(result.content);\n});\n```\n\n## Features\n\n- **Multi-language Support**: Index TypeScript, JavaScript, Python, Java, C++, and many other programming languages\n- **Semantic Search**: Find code using natural language queries powered by AI embeddings\n- **Flexible Architecture**: Pluggable embedding providers and vector databases\n- **Smart Chunking**: Intelligent code splitting that preserves context and structure\n- **Batch Processing**: Efficient processing of large codebases with progress tracking\n- **Pattern Matching**: Built-in ignore patterns for common build artifacts and dependencies\n- **Incremental File Synchronization**: Efficient change detection using Merkle trees to only re-index modified files\n\n## Embedding Providers\n\n- **OpenAI Embeddings** (`text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`)\n- **VoyageAI Embeddings** - High-quality embeddings optimized for code (`voyage-code-3`, `voyage-3.5`, etc.)\n- **Gemini Embeddings** - Google's embedding models (`gemini-embedding-001`, `gemini-embedding-2`)\n- **Ollama Embeddings** - Local embedding models via Ollama\n\n## Vector Database Support\n\n- **Milvus/Zilliz Cloud** - High-performance vector database\n\n## Code Splitters\n\n- **AST Code Splitter** - AST-based code splitting with automatic fallback (default)\n- **LangChain Code Splitter** - Character-based code chunking\n\n## Configuration\n\n### ContextConfig\n\n```typescript\ninterface ContextConfig {\n  embedding?: Embedding;           // Embedding provider\n  vectorDatabase?: VectorDatabase; // Vector database instance (required)\n  codeSplitter?: Splitter;        // Code splitting strategy\n  supportedExtensions?: string[]; // File extensions to index\n  ignorePatterns?: string[];      // Patterns to ignore\n  customExtensions?: string[];    // Custom extensions from MCP\n  customIgnorePatterns?: string[]; // Custom ignore patterns from MCP\n}\n```\n\n### Supported File Extensions (Default)\n\n```typescript\n[\n  // Programming languages\n  '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.cpp', '.c', '.h', '.hpp',\n  '.cs', '.go', '.rs', '.php', '.rb', '.swift', '.kt', '.scala', '.m', '.mm',\n  '.dart', '.sol',\n  // Text and markup files  \n  '.md', '.markdown', '.ipynb'\n]\n```\n\n### Default Ignore Patterns\n\n- Build and dependency directories: `node_modules/**`, `dist/**`, `build/**`, `out/**`, `target/**`\n- Version control: `.git/**`, `.svn/**`, `.hg/**`\n- IDE files: `.vscode/**`, `.idea/**`, `*.swp`, `*.swo`\n- Cache directories: `.cache/**`, `__pycache__/**`, `.pytest_cache/**`, `coverage/**`\n- Minified files: `*.min.js`, `*.min.css`, `*.bundle.js`, `*.map`\n- Log and temp files: `logs/**`, `tmp/**`, `temp/**`, `*.log`\n- Environment files: `.env`, `.env.*`, `*.local`\n\n## API Reference\n\n### Context\n\n#### Methods\n\n- `indexCodebase(path, progressCallback?, forceReindex?)` - Index an entire codebase\n- `reindexByChange(path, progressCallback?)` - Incrementally re-index only changed files\n- `semanticSearch(path, query, topK?, threshold?, filterExpr?)` - Search indexed code semantically\n- `hasIndex(path)` - Check if codebase is already indexed\n- `clearIndex(path, progressCallback?)` - Remove index for a codebase\n- `updateIgnorePatterns(patterns)` - Update ignore patterns\n- `addCustomIgnorePatterns(patterns)` - Add custom ignore patterns\n- `addCustomExtensions(extensions)` - Add custom file extensions\n- `updateEmbedding(embedding)` - Switch embedding provider\n- `updateVectorDatabase(vectorDB)` - Switch vector database\n- `updateSplitter(splitter)` - Switch code splitter\n\n### Search Results\n\n```typescript\ninterface SemanticSearchResult {\n  content: string;      // Code content\n  relativePath: string; // File path relative to codebase root\n  startLine: number;    // Starting line number\n  endLine: number;      // Ending line number\n  language: string;     // Programming language\n  score: number;        // Similarity score (0-1)\n}\n```\n\n\n## Examples\n\n### Using VoyageAI Embeddings\n\n```typescript\nimport { Context, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';\n\n// Initialize with VoyageAI embedding provider\nconst embedding = new VoyageAIEmbedding({\n  apiKey: process.env.VOYAGEAI_API_KEY || 'your-voyageai-api-key',\n  model: 'voyage-code-3'\n});\n\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n```\n\n### Custom File Filtering\n\n```typescript\nconst context = new Context({\n  embedding,\n  vectorDatabase,\n  supportedExtensions: ['.ts', '.js', '.py', '.java'],\n  ignorePatterns: [\n    'node_modules/**',\n    'dist/**',\n    '*.spec.ts',\n    '*.test.js'\n  ]\n});\n```\n\n## File Synchronization Architecture\n\nClaude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.\n\n![File Synchronization Architecture](../../assets/file_synchronizer.png)\n\n### How It Works\n\nThe file synchronization system uses a **Merkle tree-based approach** combined with SHA-256 file hashing to detect changes:\n\n#### 1. File Hashing\n- Each file in the codebase is hashed using SHA-256\n- File hashes are computed based on file content, not metadata\n- Hashes are stored with relative file paths for consistency across different environments\n\n#### 2. Merkle Tree Construction\n- All file hashes are organized into a Merkle tree structure\n- The tree provides a single root hash that represents the entire codebase state\n- Any change to any file will cause the root hash to change\n\n#### 3. Snapshot Management\n- File synchronization state is persisted to `~/.context/merkle/` directory\n- Each codebase gets a unique snapshot file based on its absolute path hash\n- Snapshots contain both file hashes and serialized Merkle tree data\n\n#### 4. Change Detection Process\n1. **Quick Check**: Compare current Merkle root hash with stored snapshot\n2. **Detailed Analysis**: If root hashes differ, perform file-by-file comparison\n3. **Change Classification**: Categorize changes into three types:\n   - **Added**: New files that didn't exist before\n   - **Modified**: Existing files with changed content\n   - **Removed**: Files that were deleted from the codebase\n\n#### 5. Incremental Updates\n- Only process files that have actually changed\n- Update vector database entries only for modified chunks\n- Remove entries for deleted files\n- Add entries for new files\n\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Packages\n\n- **[@claude-context/mcp](../mcp)** - MCP server that uses this core engine\n- **[VSCode Extension](../vscode-extension)** - VSCode extension built on this core\n\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","isInternal":false,"tokens":2455,"sizeBytes":10301},{"name":"README.md","path":"packages/mcp/README.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/packages/mcp/README.md","title":"mcp Documentation","category":"plugin-manifest","format":"markdown","content":"# @zilliz/claude-context-mcp\n\n![](../../assets/claude-context.png)\nModel Context Protocol (MCP) integration for Claude Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## 🚀 Use Claude Context as MCP in Claude Code and others\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf2uIf2c5zowp-iOMOqsefHbY_EwNGiutkxtNXcZVJ8RI6SN9DsCcsc3amXIhOZx9VcKFJQLSAqM-2pjU9zoGs1r8GCTUL3JIsLpLUGAm1VQd5F2o5vpEajx2qrc77iXhBu1zWj?key=qYdFquJrLcfXCUndY-YRBQ)\n\nModel Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.\n\n## Quick Start\n\n### Prerequisites\n\nBefore using the MCP server, make sure you have:\n\n- API key for your chosen embedding provider (OpenAI, VoyageAI, Gemini, or Ollama setup)\n- Milvus vector database (local or cloud)\n\n> 💡 **Setup Help:** See the [main project setup guide](../../README.md#-quick-start) for detailed installation instructions.\n\n### Prepare Environment Variables\n\n#### Embedding Provider Configuration\n\nClaude Context MCP supports multiple embedding providers. Choose the one that best fits your needs:\n\n> 📋 **Quick Reference**: For a complete list of environment variables and their descriptions, see the [Environment Variables Guide](../../docs/getting-started/environment-variables.md).\n\n```bash\n# Supported providers: OpenAI, VoyageAI, Gemini, Ollama\nEMBEDDING_PROVIDER=OpenAI\n```\n\n<details>\n<summary><strong>1. OpenAI Configuration (Default)</strong></summary>\n\nOpenAI provides high-quality embeddings with excellent performance for code understanding.\n\n```bash\n# Required: Your OpenAI API key\nOPENAI_API_KEY=sk-your-openai-api-key\n\n# Optional: Specify embedding model (default: text-embedding-3-small)\nEMBEDDING_MODEL=text-embedding-3-small\n\n# Optional: Custom API base URL (for Azure OpenAI or other compatible services)\nOPENAI_BASE_URL=https://api.openai.com/v1\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`openai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/openai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)\n2. Sign in or create an account\n3. Generate a new API key\n4. Set up billing if needed\n\n</details>\n\n<details>\n<summary><strong>2. VoyageAI Configuration</strong></summary>\n\nVoyageAI offers specialized code embeddings optimized for programming languages.\n\n```bash\n# Required: Your VoyageAI API key\nVOYAGEAI_API_KEY=pa-your-voyageai-api-key\n\n# Optional: Specify embedding model (default: voyage-code-3)\nEMBEDDING_MODEL=voyage-code-3\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`voyageai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/voyageai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [VoyageAI Console](https://dash.voyageai.com/)\n2. Sign up for an account\n3. Navigate to API Keys section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>3. Gemini Configuration</strong></summary>\n\nGoogle's Gemini provides competitive embeddings with good multilingual support.\n\n```bash\n# Required: Your Gemini API key\nGEMINI_API_KEY=your-gemini-api-key\n\n# Optional: Specify embedding model (default: gemini-embedding-001; supports gemini-embedding-2)\nEMBEDDING_MODEL=gemini-embedding-001\n\n# Optional: Custom API base URL (for custom endpoints)\nGEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`gemini-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/gemini-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [Google AI Studio](https://aistudio.google.com/)\n2. Sign in with your Google account\n3. Go to \"Get API key\" section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>4. Ollama Configuration (Local/Self-hosted)</strong></summary>\n\nOllama allows you to run embeddings locally without sending data to external services.\n\n```bash\n# Required: Specify which Ollama model to use\nEMBEDDING_MODEL=nomic-embed-text\n\n# Optional: Specify Ollama host (default: http://127.0.0.1:11434)\nOLLAMA_HOST=http://127.0.0.1:11434\n\n# Optional: Override embedding dimension to skip runtime dimension detection\nEMBEDDING_DIMENSION=768\n```\n\n**Setup Instructions:**\n\n1. Install Ollama from [ollama.com](https://ollama.com/)\n2. Pull the embedding model:\n\n   ```bash\n   ollama pull nomic-embed-text\n   ```\n\n3. Ensure Ollama is running:\n\n   ```bash\n   ollama serve\n   ```\n\n</details>\n\n#### Get a free vector database on Zilliz Cloud\n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.\n\n![](../../assets/signup_and_get_apikey.png)\n\nCopy your Personal Key to replace `your-zilliz-cloud-api-key` in the configuration examples.\n\n```bash\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n\n# Optional: increase timeout for Milvus collection-limit pre-check on slow clusters (default: 15000)\nMILVUS_COLLECTION_LIMIT_CHECK_TIMEOUT_MS=30000\n```\n\n#### Embedding Batch Size\n\nYou can set the embedding batch size to optimize the performance of the MCP server, depending on your embedding model throughput. The default value is 100.\n\n```bash\nEMBEDDING_BATCH_SIZE=512\n```\n\n#### Custom File Processing (Optional)\n\nYou can configure custom file extensions and ignore patterns globally via environment variables:\n\n```bash\n# Additional file extensions to include beyond defaults\nCUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig\n\n# Additional ignore patterns to exclude files/directories\nCUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**\n```\n\nThese settings work in combination with tool parameters - patterns from both sources will be merged together.\n\n#### Custom Collection Name (Optional)\n\nUse this when you want a human-readable prefix on collection names in Milvus/Zilliz instead of the bare hash:\n\n```bash\n# Creates code_chunks_my_project_<pathHash> or hybrid_code_chunks_my_project_<pathHash>\nCODE_CHUNKS_COLLECTION_NAME_OVERRIDE=my_project\n```\n\nThe per-codebase `<pathHash>` suffix is preserved even when the override is set, so the same MCP server can still index multiple repos without collapsing them onto one collection. The override value is sanitized to letters, numbers, and underscores, and truncated to keep the full name within Milvus's 255-char limit. If you unset the variable later, Claude Context switches back to the plain `code_chunks_<pathHash>` naming.\n\n#### Trigger File Watcher (Optional)\n\nIn addition to the periodic background sync, the MCP server watches a sentinel file at `~/.context/.sync-trigger` and starts an immediate re-index whenever the file is modified. This lets external tools (Claude Code `PostToolUse` hooks, editor save hooks, CI scripts, etc.) request a sync on demand instead of waiting for the next polling tick.\n\n```bash\n# Default: watcher enabled. Set to false to disable filesystem watching entirely\n# (useful on read-only filesystems or sandboxed environments).\nCLAUDE_CONTEXT_TRIGGER_WATCHER=true\n```\n\nExample — Claude Code hook that re-indexes after every Edit/Write:\n\n```json\n\"hooks\": {\n  \"PostToolUse\": [\n    { \"matcher\": \"Edit|Write\", \"hooks\": [\n      { \"type\": \"command\", \"command\": \"touch ~/.context/.sync-trigger\" }\n    ]}\n  ]\n}\n```\n\nNotes:\n- The trigger fires a debounced re-index (2 s window) so rapid touches collapse to a single sync.\n- Triggered syncs go through the same global cross-process lock as background sync, so when multiple MCP processes share `$HOME` only one process performs the work per trigger.\n- The trigger file's *contents* are ignored — only the modification event matters.\n\n#### Background Sync Configuration (Optional)\n\nBy default, the MCP server runs startup + periodic background sync for compatibility with existing installations. The global cross-process sync lock ensures only one local MCP process performs a sync cycle at a time.\n\nYou can tune or disable periodic polling with environment variables:\n\n```bash\n# Default: true. Set to false to disable startup + periodic polling.\nCLAUDE_CONTEXT_BACKGROUND_SYNC=false\n\n# Optional: control how often sync runs (default: 300000 = 5 minutes)\nCLAUDE_CONTEXT_SYNC_INTERVAL_MS=60000\n```\n\nFor multi-instance local stdio setups, set `CLAUDE_CONTEXT_BACKGROUND_SYNC=false` and keep the trigger watcher enabled. That avoids idle polling while still allowing external tools to request immediate re-indexing by touching `~/.context/.sync-trigger`.\n\n## Usage with MCP Clients\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\nUse the command line interface to add the Claude Context MCP server:\n\n```bash\n# Add the Claude Context MCP server\nclaude mcp add claude-context -e OPENAI_API_KEY=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\n\n```\n\nSee the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details about MCP server management.\n\n</details>\n\n<details>\n<summary><strong>OpenAI Codex CLI</strong></summary>\n\nCodex CLI uses TOML configuration files:\n\n1. Create or edit the `~/.codex/config.toml` file.\n\n2. Add the following configuration:\n\n```toml\n# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.\n[mcp_servers.claude-context]\ncommand = \"npx\"\nargs = [\"@zilliz/claude-context-mcp@latest\"]\nenv = { \"OPENAI_API_KEY\" = \"your-openai-api-key\", \"MILVUS_TOKEN\" = \"your-zilliz-cloud-api-key\" }\n# Optional: override the default 10s startup timeout\nstartup_timeout_ms = 20000\n```\n\n3. Save the file and restart Codex CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Gemini CLI</strong></summary>\n\nGemini CLI requires manual configuration through a JSON file:\n\n1. Create or edit the `~/.gemini/settings.json` file.\n\n2. Add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file and restart Gemini CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Qwen Code</strong></summary>\n\nCreate or edit the `~/.qwen/settings.json` file and add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\nGo to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`\n\nPasting 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](https://cursor.com/docs/context/mcp) for more info.\n\n**OpenAI Configuration (Default):**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"OpenAI\",\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**VoyageAI Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"VoyageAI\",\n        \"VOYAGEAI_API_KEY\": \"your-voyageai-api-key\",\n        \"EMBEDDING_MODEL\": \"voyage-code-3\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Gemini Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Gemini\",\n        \"GEMINI_API_KEY\": \"your-gemini-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Ollama Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Ollama\",\n        \"EMBEDDING_MODEL\": \"nomic-embed-text\",\n        \"OLLAMA_HOST\": \"http://127.0.0.1:11434\",\n        \"EMBEDDING_DIMENSION\": \"768\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Void</strong></summary>\n\nGo to: `Settings` -> `MCP` -> `Add MCP Server`\n\nAdd the following configuration to your Void MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Desktop</strong></summary>\n\nAdd to your Claude Desktop configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nWindsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>VS Code</strong></summary>\n\nThe Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cherry Studio</strong></summary>\n\nCherry 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:\n\n1. Navigate to **Settings → MCP Servers → Add Server**.\n2. Fill in the server details:\n   - **Name**: `claude-context`\n   - **Type**: `STDIO`\n   - **Command**: `npx`\n   - **Arguments**: `[\"-y\", \"@zilliz/claude-context-mcp@latest\"]`\n   - **Environment Variables**:\n     - `OPENAI_API_KEY`: `your-openai-api-key`\n     - `MILVUS_TOKEN`: `your-zilliz-cloud-api-key`\n3. Save the configuration to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Cline</strong></summary>\n\nCline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:\n\n1. Open Cline and click on the **MCP Servers** icon in the top navigation bar.\n\n2. Select the **Installed** tab, then click **Advanced MCP Settings**.\n\n3. In the `cline_mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n4. Save the file.\n\n</details>\n\n<details>\n<summary><strong>Augment</strong></summary>\n\nTo configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.\n\n#### **A. Using the Augment Code UI**\n\n1. Click the hamburger menu.\n\n2. Select **Settings**.\n\n3. Navigate to the **Tools** section.\n\n4. Click the **+ Add MCP** button.\n\n5. Enter the following command:\n\n   ```\n   npx @zilliz/claude-context-mcp@latest\n   ```\n\n6. Name the MCP: **Claude Context**.\n\n7. Click the **Add** button.\n\n------\n\n#### **B. Manual Configuration**\n\n1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel\n2. Select Edit Settings\n3. Under Advanced, click Edit in settings.json\n4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object\n\n```json\n\"augment.advanced\": { \n  \"mcpServers\": [ \n    { \n      \"name\": \"claude-context\", \n      \"command\": \"npx\", \n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"] \n    } \n  ] \n}\n```\n\n</details>\n\n<details>\n<summary><strong>Roo Code</strong></summary>\n\nRoo Code utilizes a JSON configuration file for MCP servers:\n\n1. Open Roo Code and navigate to **Settings → MCP Servers → Edit Global Config**.\n\n2. In the `mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Zencoder</strong></summary>\n\nZencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.\n\n1. Go to the Zencoder menu (...)\n2. From the dropdown menu, select `Tools`\n3. Click on the `Add Custom MCP`\n4. Add the name (i.e. `Claude Context` and server configuration from below, and make sure to hit the `Install` button\n\n```json\n{\n    \"command\": \"npx\",\n    \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n    \"env\": {\n      \"OPENAI_API_KEY\": \"your-openai-api-key\",\n      \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n      \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n    }\n}\n\n```\n\n5. Save the server by hitting the `Install` button.\n\n</details>\n\n<details>\n<summary><strong>LangChain/LangGraph</strong></summary>\n\nFor LangChain/LangGraph integration examples, see [this example](https://github.com/zilliztech/claude-context/blob/643796a0d30e706a2a0dff3d55621c9b5d831807/evaluation/retrieval/custom.py#L88).\n\n</details>\n\n<details>\n<summary><strong>Other MCP Clients</strong></summary>\n\nThe server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:\n\n```bash\nnpx @zilliz/claude-context-mcp@latest\n```\n\n</details>\n\n## Features\n\n- 🔌 **MCP Protocol Compliance**: Full compatibility with MCP-enabled AI assistants and agents\n- 🔍 **Hybrid Code Search**: Natural language queries using advanced hybrid search (BM25 + dense vector) to find relevant code snippets\n- 📁 **Codebase Indexing**: Index entire codebases for fast hybrid search across millions of lines of code\n- 🔄 **Incremental Indexing**: Efficiently re-index only changed files using Merkle trees for auto-sync\n- 🧩 **Intelligent Code Chunking**: AST-based code analysis for syntax-aware chunking with automatic fallback\n- 🗄️ **Scalable**: Integrates with Zilliz Cloud for scalable vector search, no matter how large your codebase is\n- 🛠️ **Customizable**: Configure file extensions, ignore patterns, and embedding models\n- ⚡ **Real-time**: Interactive indexing and searching with progress feedback\n\n## Available Tools\n\n### 1. `index_codebase`\n\nIndex a codebase directory for hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to index\n- `force` (optional): Force re-indexing even if already indexed (default: false)\n- `splitter` (optional): Code splitter to use - 'ast' for syntax-aware splitting with automatic fallback, 'langchain' for character-based splitting (default: \"ast\")\n- `customExtensions` (optional): Additional file extensions to include beyond defaults (e.g., ['.vue', '.svelte', '.astro']). Extensions should include the dot prefix or will be automatically added (default: [])\n- `ignorePatterns` (optional): Additional ignore patterns to exclude specific files/directories beyond defaults (e.g., ['static/**', '*.tmp', 'private/**']) (default: [])\n\n### 2. `search_code`\n\nSearch the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to search in\n- `query` (required): Natural language query to search for in the codebase\n- `limit` (optional): Maximum number of results to return (default: 10, max: 50)\n- `extensionFilter` (optional): List of file extensions to filter results (e.g., ['.ts', '.py']) (default: [])\n\n### 3. `clear_index`\n\nClear the search index for a specific codebase.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to clear index for\n\n### 4. `get_indexing_status`\n\nGet the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to check status for\n\n**What the status output means:**\n\n- Progress is **phase-based**, not a direct file-count ratio. The MCP server reports coarse milestones for collection preparation, file scanning, and file processing / embedding work.\n- Because indexing runs in the background and progress is persisted periodically, percentages can jump quickly on large repositories or appear unchanged for a while during long embedding batches.\n- File and chunk statistics are written when an indexing run finishes successfully. During active indexing, `get_indexing_status` intentionally reports progress rather than live file/chunk totals.\n- Codebases are keyed by their **absolute path**. Indexing `/repo`, a symlinked path to the same repo, and a second clone will create separate tracked entries.\n- If a completed entry shows `0 files, 0 chunks`, that usually means the local snapshot metadata is stale rather than the vector database being queried live. Re-indexing, or clearing and re-indexing that exact absolute path, refreshes the stored stats.\n\nFor a deeper explanation, see the [asynchronous indexing workflow guide](../../docs/dive-deep/asynchronous-indexing-workflow.md) and the [troubleshooting FAQ](../../docs/troubleshooting/faq.md).\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines  \n- [MCP Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Projects\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this MCP server\n- **[VSCode Extension](../vscode-extension)** - Alternative VSCode integration\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Official MCP documentation\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n","isInternal":false,"tokens":6149,"sizeBytes":23761},{"name":"README.md","path":"packages/vscode-extension/README.md","rawUrl":"https://raw.githubusercontent.com/zilliztech/claude-context/HEAD/packages/vscode-extension/README.md","title":"vscode-extension Documentation","category":"plugin-manifest","format":"markdown","content":"# Semantic Code Search VSCode Extension\n\n[![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/v/zilliz.semanticcodesearch?label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\nA code indexing and semantic search VSCode extension powered by [Claude Context](https://github.com/zilliztech/claude-context).\n\n> 📖 **New to Claude Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.\n\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdtCtT9Qi6o5mGVoxzX50r8Nb6zDFcjvTQR7WZ-xMbEsHEPPhSYAFVJ7q4-rETzxJ8wy1cyZmU8CmtpNhAU8PGOqVnE2kc2HCn1etDg97Qsh7m89kBjG4ZT7XBgO4Dp7BfFZx7eow?key=qYdFquJrLcfXCUndY-YRBQ)\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search based on semantic understanding, not just keyword matching\n- 📁 **Codebase Indexing**: Automatically index entire codebase and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets\n- 🔧 **Multi-platform Support**: Support for OpenAI, VoyageAI, Gemini, and Ollama as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n\n## Requirements\n\n- **VSCode Version**: 1.74.0 or higher\n\n## Installation\n\n### From VS Code Marketplace\n\n1. **Direct Link**: [Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\n2. **Manual Search**:\n   - Open Extensions view in VSCode (Ctrl+Shift+X or Cmd+Shift+X on Mac)\n   - Search for \"Semantic Code Search\"\n   - Click Install\n\n## Quick Start\n\n### Configuration\nThe first time you open Claude Context, you need to click on Settings icon to configure the relevant options.\n\n#### Embedding Configuration\nConfigure your embedding provider to convert code into semantic vectors.\n\n**OpenAI Configuration:**\n- `Embedding Provider`: Select \"OpenAI\" from the dropdown\n- `Model name`: Choose the embedding model (e.g., `text-embedding-3-small`, `text-embedding-3-large`)\n- `OpenAI API key`: Your OpenAI API key for authentication\n- `Custom API endpoint URL`: Optional custom endpoint (defaults to `https://api.openai.com/v1`)\n\n**Other Supported Providers:**\n- **Gemini**: Google's state-of-the-art embedding model with Matryoshka representation learning\n- **VoyageAI**: Alternative embedding provider with competitive performance  \n- **Ollama**: For local embedding models\n\n#### Code Splitter Configuration\nConfigure how your code is split into chunks for indexing.\n\n**Splitter Settings:**\n- `Splitter Type`: Choose between \"AST Splitter\" (syntax-aware) or \"LangChain Splitter\" (character-based)\n- `Chunk Size`: Maximum size of each code chunk (default: 1000 characters)\n- `Chunk Overlap`: Number of overlapping characters between chunks (default: 200 characters)\n\n> **Recommendation**: Use AST Splitter for better semantic understanding of code structure.\n\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n### Usage\n\n1. **Set the Configuration**:\n   - Open VSCode Settings (Ctrl+, or Cmd+, on Mac)\n   - Search for \"Semantic Code Search\"\n   - Set the configuration\n\n2. **Index Codebase**:\n   - Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)\n   - Run \"Semantic Code Search: Index Codebase\"\n\n3. **Start Searching**:\n   - Open Semantic Code Search panel in sidebar\n   - Enter search query or right-click on selected code to search\n\n## Commands\n\n- `Semantic Code Search: Semantic Search` - Perform semantic search\n- `Semantic Code Search: Index Codebase` - Index current codebase\n- `Semantic Code Search: Clear Index` - Clear the index\n\n## Configuration\n\n- `semanticCodeSearch.embeddingProvider.provider` - Embedding provider (OpenAI/VoyageAI/Gemini/Ollama)\n- `semanticCodeSearch.embeddingProvider.model` - Embedding model to use\n- `semanticCodeSearch.embeddingProvider.apiKey` - API key for embedding provider\n- `semanticCodeSearch.embeddingProvider.baseURL` - Custom API endpoint URL (optional, for OpenAI and Gemini)\n- `semanticCodeSearch.embeddingProvider.outputDimensionality` - Output dimension for Gemini (supports 3072, 1536, 768, 256)\n- `semanticCodeSearch.milvus.address` - Milvus server address\n\n## Contributing\n\nThis VSCode extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](https://github.com/zilliztech/claude-context/blob/master/CONTRIBUTING.md) - General contribution guidelines\n- [VSCode Extension Contributing](https://github.com/zilliztech/claude-context/blob/master/packages/vscode-extension/CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](https://github.com/zilliztech/claude-context/tree/master/packages/core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-mcp](https://github.com/zilliztech/claude-context/tree/master/packages/mcp)** - Alternative MCP server integration\n\n## Tech Stack\n\n- TypeScript\n- VSCode Extension API  \n- Milvus Vector Database\n- OpenAI/VoyageAI Embeddings\n\n## License\n\nMIT - See [LICENSE](https://github.com/zilliztech/claude-context/blob/master/LICENSE) for details ","isInternal":false,"tokens":1579,"sizeBytes":6328}],"systemPromptSnippet":"<yakaai_skills repo=\"zilliztech/claude-context\">\n<!-- File: AGENTS.md (Tokens: ~4 | Category: root-instruction) -->\nCLAUDE.md\n\n<!-- File: CLAUDE.md (Tokens: ~1571 | Category: claude-rule) -->\n# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Overview\n\nClaude Context is an MCP plugin that adds semantic code search to AI coding agents. A codebase is split into chunks, embedded, and stored in a Milvus/Zilliz vector database; queries are answered by semantic (hybrid dense + sparse) search instead of loading whole directories into the model's context.\n\n## Monorepo Layout\n\npnpm workspace (`packages/*`, `examples/*`). Requires Node >=20 <24 and pnpm >=10.\n\n- `packages/core` (`@zilliz/claude-context-core`) — the indexing engine. All real logic lives here; the other packages are thin frontends over it.\n- `packages/mcp` (`@zilliz/claude-context-mcp`) — stdio MCP server, the primary product. ESM (`\"type\": \"module\"`).\n- `packages/vscode-extension` (`semanticcodesearch`) — VSCode extension. Bundled with webpack; stubs out Node-only deps (Milvus gRPC, native AST) in `src/stubs/`.\n- `packages/chrome-extension` — browser build; overrides `@zilliz/milvus2-sdk-node` to `false` (no gRPC in browser).\n- `examples/basic-usage` — runnable library example.\n\n## Commands\n\n```bash\npnpm install\npnpm build                 # build all packages (examples built last)\npnpm build:core            # build a single package: also build:mcp, build:vscode\npnpm dev                   # watch all; or dev:core / dev:mcp / dev:vscode\npnpm lint                  # eslint across packages; lint:fix to autofix\npnpm typecheck             # tsc --noEmit across packages\npnpm clean                 # rimraf dist in every package\n```\n\nPackages depend on `core` via `workspace:*`, so **rebuild core (`pnpm build:core`) before testing mcp/vscode against core changes** — they consume `core/dist`, not its source.\n\n### Tests\n\n- **core** uses Jest + ts-jest. Test files are colocated as `*.test.ts` in `src/`.\n  ```bash\n  pnpm --filter @zilliz/claude-context-core test                     # all (runs in band)\n  pnpm --filter @zilliz/claude-context-core test -- context.abort    # by filename\n  pnpm --filter @zilliz/claude-context-core test -- -t \"pattern\"     # by test name\n  ```\n- **mcp** uses the Node built-in test runner via tsx (no Jest):\n  ```bash\n  pnpm --filter @zilliz/claude-context-mcp test                      # runs src/**/*.test.ts\n  ```\n\n### Running the MCP server locally\n\n```bash\npnpm --filter @zilliz/claude-context-mcp start        # tsx src/index.ts\n```\nConfiguration is entirely via environment variables (see `.env.example` and `packages/mcp/src/config.ts`). Key vars: `EMBEDDING_PROVIDER` (OpenAI | VoyageAI | Gemini | Ollama | OpenRouter), provider API key, `EMBEDDING_MODEL`, `MILVUS_ADDRESS` and/or `MILVUS_TOKEN` (address can be auto-resolved from a Zilliz token), `CODE_CHUNKS_COLLECTION_NAME_OVERRIDE`.\n\n## Architecture\n\n### Core: the `Context` orchestrator (`packages/core/src/context.ts`)\n\n`Context` ties together three pluggable interfaces injected through its constructor config:\n\n- **Embedding** (`src/embedding/`) — `base-embedding.ts` interface with `OpenAIEmbedding`, `VoyageAIEmbedding`, `GeminiEmbedding`, `OllamaEmbedding` implementations.\n- **VectorDatabase** (`src/vectordb/`) — `MilvusVectorDatabase` (gRPC, Node-only) and `MilvusRestfulVectorDatabase` (HTTP, browser-safe). `zilliz-utils.ts` (`ClusterManager`) can provision a free Zilliz cluster and resolve an address from a token.\n- **Splitter** (`src/splitter/`) — `AstCodeSplitter` (tree-sitter, the default at 2500/300 chunk/overlap) which falls back to `LangChainCodeSplitter` for unsupported languages or parse failures.\n\nThe public surface (`indexCodebase`, `reindexByChange`, `semanticSearch`, `clearIndex`, `hasIndex`) is re-exported from `src/index.ts`. Indexing reads files honoring ignore rules, splits them, embeds in batches, and upserts vectors. Collection name is derived from a hash of the absolute codebase path (overridable).\n\nTwo error types carry control-flow meaning and should be preserved when touching the pipeline:\n- `IndexAbortError` — cooperative cancellation via `AbortSignal`.\n- `EmbeddingError` — always re-thrown to halt the whole pipeline, unlike per-file read/parse errors which are logged and skipped. This prevents silent partial indexing (Milvus getting zero vectors while the snapshot marks files done).\n\n### Incremental sync (`packages/core/src/sync/`)\n\n`FileSynchronizer` builds a Merkle DAG (`merkle.ts`) of file hashes to compute `{added, removed, modified}` between runs. Snapshots persist to `~/.context/merkle/<md5-of-path>.json`. `reindexByChange` uses this so re-indexing only touches changed files. The MCP server can also run a background sync loop (`CLAUDE_CONTEXT_BACKGROUND_SYNC`, `CLAUDE_CONTEXT_SYNC_INTERVAL_MS`).\n\n### Ignore patterns\n\nLayered: built-in `DEFAULT_IGNORE_PATTERNS` + config + env (`CUSTOM_IGNORE_PATTERNS`) + on-disk ignore files (`.gitignore`, `.contextignore`, `.xxxignore`, and a global `~/.context/.gitignore`). `utils/ignore-matcher.ts` implements matching including gitignore negation (`!`) semantics — covered by `context.ignore-patterns.test.ts`.\n\n### Env resolution (`packages/core/src/utils/env-manager.ts`)\n\n`envManager.get(name)` resolves with priority `process.env` > `~/.context/.env` file. Use it instead of reading `process.env` directly so the `.env` file fallback keeps working.\n\n### MCP server (`packages/mcp/src/`)\n\n- `index.ts` — entry point. **Critically, it redirects `console.log`/`console.warn` to stderr at the very top**, because stdout is reserved for the MCP JSON protocol. Never write non-protocol output to stdout in this package.\n- `handlers.ts` (`ToolHandlers`) — implements the tools: `index_codebase`, `search_code`, `clear_index`, `get_indexing_status`.\n- `snapshot.ts` (`SnapshotManager`) — tracks per-codebase indexing state across server restarts.\n- `sync.ts` (`SyncManager`) — drives incremental re-indexing.\n- `config.ts`, `embedding.ts` — build `Context` (embedding provider + Milvus) from environment variables.\n\n## Conventions\n\nCommits follow Conventional Commits with these scopes: `core`, `vscode`, `mcp`, `examples`, `docs` (e.g. `fix(core): support gitignore negation patterns`). All code and comments are written in English.\n\n<!-- File: packages/chrome-extension/README.md (Tokens: ~1128 | Category: plugin-manifest) -->\n# GitHub Code Vector Search Chrome Extension\n\nA Chrome extension for indexing and semantically searching GitHub repository code, powered by Claude Context.\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search on GitHub repositories based on semantic understanding\n- 📁 **Repository Indexing**: Automatically index GitHub repositories and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets directly on GitHub\n- 🔧 **Multi-platform Support**: Support for OpenAI and VoyageAI as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n- 🌐 **GitHub Integration**: Seamlessly integrates with GitHub's interface\n- 📱 **Cross-Repository**: Search across multiple indexed repositories\n- ⚡ **Real-time**: Index and search code as you browse GitHub\n\n## Installation\n\n### From Chrome Web Store\n\n> **Coming Soon**: Extension will be available on Chrome Web Store\n\n### Manual Installation (Development)\n\n1. **Build the Extension**:\n   ```bash\n   cd packages/chrome-extension\n   pnpm build\n   ```\n\n2. **Load in Chrome**:\n   - Open Chrome and navigate to `chrome://extensions/`\n   - Enable \"Developer mode\" in the top right\n   - Click \"Load unpacked\" and select the `dist` folder\n   - The extension should now appear in your extensions list\n\n## Quick Start\n\n1. **Configure Settings**:\n   - Click the extension icon in Chrome toolbar\n   - Go to Options/Settings\n   - Configure embedding provider and API Key\n   - Set up Milvus connection details\n\n2. **Index a Repository**:\n   - Navigate to any GitHub repository\n   - Click the \"Index Repository\" button that appears in the sidebar\n   - Wait for indexing to complete\n\n3. **Start Searching**:\n   - Use the search box that appears on GitHub repository pages\n   - Enter natural language queries like \"function that handles authentication\"\n   - Click on results to navigate to the code\n\n## Configuration\n\nThe extension can be configured through the options page:\n\n- **Embedding Provider**: Choose between OpenAI or VoyageAI\n- **Embedding Model**: Select specific model (e.g., `text-embedding-3-small`)\n- **API Key**: Your embedding provider API key\n- **Milvus Settings**: Vector database connection details\n- **GitHub Token**: Personal access token for private repositories (optional)\n\n## Permissions\n\nThe extension requires the following permissions:\n\n- **Storage**: To save configuration and index metadata\n- **Scripting**: To inject search UI into GitHub pages\n- **Unlimited Storage**: For storing vector embeddings locally\n- **Host Permissions**: Access to GitHub.com and embedding provider APIs\n\n## File Structure\n\n- `src/content.ts` - Main content script that injects UI into GitHub pages\n- `src/background.ts` - Background service worker for extension lifecycle\n- `src/options.ts` - Options page for configuration\n- `src/config/milvusConfig.ts` - Milvus connection configuration\n- `src/milvus/chromeMilvusAdapter.ts` - Browser-compatible Milvus adapter\n- `src/storage/indexedRepoManager.ts` - Repository indexing management\n- `src/stubs/` - Browser compatibility stubs for Node.js modules\n\n## Development Features\n\n- **Browser Compatibility**: Node.js modules adapted for browser environment\n- **WebAssembly Support**: Optimized for browser performance\n- **Offline Capability**: Local storage for indexed repositories\n- **Progress Tracking**: Real-time indexing progress indicators\n- **Error Handling**: Graceful degradation and user feedback\n\n## Usage Examples\n\n### Basic Search\n1. Navigate to a GitHub repository\n2. Enter query: \"error handling middleware\"\n3. Browse semantic search results\n\n### Context Search\n1. Select code snippet on GitHub\n2. Right-click and choose \"Search Similar Code\"\n3. View related code across the repository\n\n### Multi-Repository Search\n1. Index multiple repositories\n2. Use the extension popup to search across all indexed repos\n3. Filter results by repository or file type\n\n## Contributing\n\nThis Chrome extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Chrome Extension Contributing](CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-vscode-extension](../vscode-extension)** - VSCode integration\n- **[@zilliz/claude-context-mcp](../mcp)** - MCP server integration\n\n## Tech Stack\n\n- **TypeScript** - Type-safe development\n- **Chrome Extension Manifest V3** - Modern extension architecture\n- **Webpack** - Module bundling and optimization\n- **Claude Context Core** - Semantic search engine\n- **Milvus Vector Database** - Vector storage and retrieval\n- **OpenAI/VoyageAI Embeddings** - Text embedding generation\n\n## Browser Support\n\n- Chrome 88+\n- Chromium-based browsers (Edge, Brave, etc.)\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n\n<!-- File: packages/core/README.md (Tokens: ~2455 | Category: plugin-manifest) -->\n# @zilliz/claude-context-core\n![](../../assets/claude-context.png)\n\nThe core indexing engine for Claude Context - a powerful tool for semantic search and analysis of codebases using vector embeddings and AI.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-core.svg)](https://www.npmjs.com/package/@zilliz/claude-context-core)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and quick start guide.\n\n## Installation\n\n```bash\nnpm install @zilliz/claude-context-core\n```\n\n### Prepare Environment Variables\n#### OpenAI API key\nSee [OpenAI Documentation](https://platform.openai.com/docs/api-reference) for more details to get your API key.\n```bash\nOPENAI_API_KEY=your-openai-api-key\n```\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](../../assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](../../assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n> 💡 **Tip**: For easier configuration management across different usage scenarios, consider using [global environment variables](../../docs/getting-started/environment-variables.md).\n\n## Quick Start\n\n```typescript\nimport { \n  Context, \n  OpenAIEmbedding, \n  MilvusVectorDatabase \n} from '@zilliz/claude-context-core';\n\n// Initialize embedding provider\nconst embedding = new OpenAIEmbedding({\n  apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',\n  model: 'text-embedding-3-small'\n});\n\n// Initialize vector database\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\n// Create context instance\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n\n// Index a codebase\nconst stats = await context.indexCodebase('./my-project', (progress) => {\n  console.log(`${progress.phase} - ${progress.percentage}%`);\n});\n\nconsole.log(`Indexed ${stats.indexedFiles} files with ${stats.totalChunks} chunks`);\n\n// Search the codebase\nconst results = await context.semanticSearch(\n  './my-project',\n  'function that handles user authentication',\n  5\n);\n\nresults.forEach(result => {\n  console.log(`${result.relativePath}:${result.startLine}-${result.endLine}`);\n  console.log(`Score: ${result.score}`);\n  console.log(result.content);\n});\n```\n\n## Features\n\n- **Multi-language Support**: Index TypeScript, JavaScript, Python, Java, C++, and many other programming languages\n- **Semantic Search**: Find code using natural language queries powered by AI embeddings\n- **Flexible Architecture**: Pluggable embedding providers and vector databases\n- **Smart Chunking**: Intelligent code splitting that preserves context and structure\n- **Batch Processing**: Efficient processing of large codebases with progress tracking\n- **Pattern Matching**: Built-in ignore patterns for common build artifacts and dependencies\n- **Incremental File Synchronization**: Efficient change detection using Merkle trees to only re-index modified files\n\n## Embedding Providers\n\n- **OpenAI Embeddings** (`text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`)\n- **VoyageAI Embeddings** - High-quality embeddings optimized for code (`voyage-code-3`, `voyage-3.5`, etc.)\n- **Gemini Embeddings** - Google's embedding models (`gemini-embedding-001`, `gemini-embedding-2`)\n- **Ollama Embeddings** - Local embedding models via Ollama\n\n## Vector Database Support\n\n- **Milvus/Zilliz Cloud** - High-performance vector database\n\n## Code Splitters\n\n- **AST Code Splitter** - AST-based code splitting with automatic fallback (default)\n- **LangChain Code Splitter** - Character-based code chunking\n\n## Configuration\n\n### ContextConfig\n\n```typescript\ninterface ContextConfig {\n  embedding?: Embedding;           // Embedding provider\n  vectorDatabase?: VectorDatabase; // Vector database instance (required)\n  codeSplitter?: Splitter;        // Code splitting strategy\n  supportedExtensions?: string[]; // File extensions to index\n  ignorePatterns?: string[];      // Patterns to ignore\n  customExtensions?: string[];    // Custom extensions from MCP\n  customIgnorePatterns?: string[]; // Custom ignore patterns from MCP\n}\n```\n\n### Supported File Extensions (Default)\n\n```typescript\n[\n  // Programming languages\n  '.ts', '.tsx', '.js', '.jsx', '.py', '.java', '.cpp', '.c', '.h', '.hpp',\n  '.cs', '.go', '.rs', '.php', '.rb', '.swift', '.kt', '.scala', '.m', '.mm',\n  '.dart', '.sol',\n  // Text and markup files  \n  '.md', '.markdown', '.ipynb'\n]\n```\n\n### Default Ignore Patterns\n\n- Build and dependency directories: `node_modules/**`, `dist/**`, `build/**`, `out/**`, `target/**`\n- Version control: `.git/**`, `.svn/**`, `.hg/**`\n- IDE files: `.vscode/**`, `.idea/**`, `*.swp`, `*.swo`\n- Cache directories: `.cache/**`, `__pycache__/**`, `.pytest_cache/**`, `coverage/**`\n- Minified files: `*.min.js`, `*.min.css`, `*.bundle.js`, `*.map`\n- Log and temp files: `logs/**`, `tmp/**`, `temp/**`, `*.log`\n- Environment files: `.env`, `.env.*`, `*.local`\n\n## API Reference\n\n### Context\n\n#### Methods\n\n- `indexCodebase(path, progressCallback?, forceReindex?)` - Index an entire codebase\n- `reindexByChange(path, progressCallback?)` - Incrementally re-index only changed files\n- `semanticSearch(path, query, topK?, threshold?, filterExpr?)` - Search indexed code semantically\n- `hasIndex(path)` - Check if codebase is already indexed\n- `clearIndex(path, progressCallback?)` - Remove index for a codebase\n- `updateIgnorePatterns(patterns)` - Update ignore patterns\n- `addCustomIgnorePatterns(patterns)` - Add custom ignore patterns\n- `addCustomExtensions(extensions)` - Add custom file extensions\n- `updateEmbedding(embedding)` - Switch embedding provider\n- `updateVectorDatabase(vectorDB)` - Switch vector database\n- `updateSplitter(splitter)` - Switch code splitter\n\n### Search Results\n\n```typescript\ninterface SemanticSearchResult {\n  content: string;      // Code content\n  relativePath: string; // File path relative to codebase root\n  startLine: number;    // Starting line number\n  endLine: number;      // Ending line number\n  language: string;     // Programming language\n  score: number;        // Similarity score (0-1)\n}\n```\n\n\n## Examples\n\n### Using VoyageAI Embeddings\n\n```typescript\nimport { Context, MilvusVectorDatabase, VoyageAIEmbedding } from '@zilliz/claude-context-core';\n\n// Initialize with VoyageAI embedding provider\nconst embedding = new VoyageAIEmbedding({\n  apiKey: process.env.VOYAGEAI_API_KEY || 'your-voyageai-api-key',\n  model: 'voyage-code-3'\n});\n\nconst vectorDatabase = new MilvusVectorDatabase({\n  address: process.env.MILVUS_ADDRESS || 'localhost:19530',\n  token: process.env.MILVUS_TOKEN || ''\n});\n\nconst context = new Context({\n  embedding,\n  vectorDatabase\n});\n```\n\n### Custom File Filtering\n\n```typescript\nconst context = new Context({\n  embedding,\n  vectorDatabase,\n  supportedExtensions: ['.ts', '.js', '.py', '.java'],\n  ignorePatterns: [\n    'node_modules/**',\n    'dist/**',\n    '*.spec.ts',\n    '*.test.js'\n  ]\n});\n```\n\n## File Synchronization Architecture\n\nClaude Context implements an intelligent file synchronization system that efficiently tracks and processes only the files that have changed since the last indexing operation. This dramatically improves performance when working with large codebases.\n\n![File Synchronization Architecture](../../assets/file_synchronizer.png)\n\n### How It Works\n\nThe file synchronization system uses a **Merkle tree-based approach** combined with SHA-256 file hashing to detect changes:\n\n#### 1. File Hashing\n- Each file in the codebase is hashed using SHA-256\n- File hashes are computed based on file content, not metadata\n- Hashes are stored with relative file paths for consistency across different environments\n\n#### 2. Merkle Tree Construction\n- All file hashes are organized into a Merkle tree structure\n- The tree provides a single root hash that represents the entire codebase state\n- Any change to any file will cause the root hash to change\n\n#### 3. Snapshot Management\n- File synchronization state is persisted to `~/.context/merkle/` directory\n- Each codebase gets a unique snapshot file based on its absolute path hash\n- Snapshots contain both file hashes and serialized Merkle tree data\n\n#### 4. Change Detection Process\n1. **Quick Check**: Compare current Merkle root hash with stored snapshot\n2. **Detailed Analysis**: If root hashes differ, perform file-by-file comparison\n3. **Change Classification**: Categorize changes into three types:\n   - **Added**: New files that didn't exist before\n   - **Modified**: Existing files with changed content\n   - **Removed**: Files that were deleted from the codebase\n\n#### 5. Incremental Updates\n- Only process files that have actually changed\n- Update vector database entries only for modified chunks\n- Remove entries for deleted files\n- Add entries for new files\n\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines\n- [Core Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Packages\n\n- **[@claude-context/mcp](../mcp)** - MCP server that uses this core engine\n- **[VSCode Extension](../vscode-extension)** - VSCode extension built on this core\n\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n\n<!-- File: packages/mcp/README.md (Tokens: ~6149 | Category: plugin-manifest) -->\n# @zilliz/claude-context-mcp\n\n![](../../assets/claude-context.png)\nModel Context Protocol (MCP) integration for Claude Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.\n\n[![npm version](https://img.shields.io/npm/v/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n[![npm downloads](https://img.shields.io/npm/dm/@zilliz/claude-context-mcp.svg)](https://www.npmjs.com/package/@zilliz/claude-context-mcp)\n\n> 📖 **New to Claude Context?** Check out the [main project README](../../README.md) for an overview and setup instructions.\n\n## 🚀 Use Claude Context as MCP in Claude Code and others\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXf2uIf2c5zowp-iOMOqsefHbY_EwNGiutkxtNXcZVJ8RI6SN9DsCcsc3amXIhOZx9VcKFJQLSAqM-2pjU9zoGs1r8GCTUL3JIsLpLUGAm1VQd5F2o5vpEajx2qrc77iXhBu1zWj?key=qYdFquJrLcfXCUndY-YRBQ)\n\nModel Context Protocol (MCP) allows you to integrate Claude Context with your favorite AI coding assistants, e.g. Claude Code.\n\n## Quick Start\n\n### Prerequisites\n\nBefore using the MCP server, make sure you have:\n\n- API key for your chosen embedding provider (OpenAI, VoyageAI, Gemini, or Ollama setup)\n- Milvus vector database (local or cloud)\n\n> 💡 **Setup Help:** See the [main project setup guide](../../README.md#-quick-start) for detailed installation instructions.\n\n### Prepare Environment Variables\n\n#### Embedding Provider Configuration\n\nClaude Context MCP supports multiple embedding providers. Choose the one that best fits your needs:\n\n> 📋 **Quick Reference**: For a complete list of environment variables and their descriptions, see the [Environment Variables Guide](../../docs/getting-started/environment-variables.md).\n\n```bash\n# Supported providers: OpenAI, VoyageAI, Gemini, Ollama\nEMBEDDING_PROVIDER=OpenAI\n```\n\n<details>\n<summary><strong>1. OpenAI Configuration (Default)</strong></summary>\n\nOpenAI provides high-quality embeddings with excellent performance for code understanding.\n\n```bash\n# Required: Your OpenAI API key\nOPENAI_API_KEY=sk-your-openai-api-key\n\n# Optional: Specify embedding model (default: text-embedding-3-small)\nEMBEDDING_MODEL=text-embedding-3-small\n\n# Optional: Custom API base URL (for Azure OpenAI or other compatible services)\nOPENAI_BASE_URL=https://api.openai.com/v1\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`openai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/openai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [OpenAI Platform](https://platform.openai.com/api-keys)\n2. Sign in or create an account\n3. Generate a new API key\n4. Set up billing if needed\n\n</details>\n\n<details>\n<summary><strong>2. VoyageAI Configuration</strong></summary>\n\nVoyageAI offers specialized code embeddings optimized for programming languages.\n\n```bash\n# Required: Your VoyageAI API key\nVOYAGEAI_API_KEY=pa-your-voyageai-api-key\n\n# Optional: Specify embedding model (default: voyage-code-3)\nEMBEDDING_MODEL=voyage-code-3\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`voyageai-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/voyageai-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [VoyageAI Console](https://dash.voyageai.com/)\n2. Sign up for an account\n3. Navigate to API Keys section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>3. Gemini Configuration</strong></summary>\n\nGoogle's Gemini provides competitive embeddings with good multilingual support.\n\n```bash\n# Required: Your Gemini API key\nGEMINI_API_KEY=your-gemini-api-key\n\n# Optional: Specify embedding model (default: gemini-embedding-001; supports gemini-embedding-2)\nEMBEDDING_MODEL=gemini-embedding-001\n\n# Optional: Custom API base URL (for custom endpoints)\nGEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta\n```\n\n**Available Models:**\nSee `getSupportedModels` in [`gemini-embedding.ts`](https://github.com/zilliztech/claude-context/blob/master/packages/core/src/embedding/gemini-embedding.ts) for the full list of supported models.\n\n**Getting API Key:**\n\n1. Visit [Google AI Studio](https://aistudio.google.com/)\n2. Sign in with your Google account\n3. Go to \"Get API key\" section\n4. Create a new API key\n\n</details>\n\n<details>\n<summary><strong>4. Ollama Configuration (Local/Self-hosted)</strong></summary>\n\nOllama allows you to run embeddings locally without sending data to external services.\n\n```bash\n# Required: Specify which Ollama model to use\nEMBEDDING_MODEL=nomic-embed-text\n\n# Optional: Specify Ollama host (default: http://127.0.0.1:11434)\nOLLAMA_HOST=http://127.0.0.1:11434\n\n# Optional: Override embedding dimension to skip runtime dimension detection\nEMBEDDING_DIMENSION=768\n```\n\n**Setup Instructions:**\n\n1. Install Ollama from [ollama.com](https://ollama.com/)\n2. Pull the embedding model:\n\n   ```bash\n   ollama pull nomic-embed-text\n   ```\n\n3. Ensure Ollama is running:\n\n   ```bash\n   ollama serve\n   ```\n\n</details>\n\n#### Get a free vector database on Zilliz Cloud\n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get an API key.\n\n![](../../assets/signup_and_get_apikey.png)\n\nCopy your Personal Key to replace `your-zilliz-cloud-api-key` in the configuration examples.\n\n```bash\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n\n# Optional: increase timeout for Milvus collection-limit pre-check on slow clusters (default: 15000)\nMILVUS_COLLECTION_LIMIT_CHECK_TIMEOUT_MS=30000\n```\n\n#### Embedding Batch Size\n\nYou can set the embedding batch size to optimize the performance of the MCP server, depending on your embedding model throughput. The default value is 100.\n\n```bash\nEMBEDDING_BATCH_SIZE=512\n```\n\n#### Custom File Processing (Optional)\n\nYou can configure custom file extensions and ignore patterns globally via environment variables:\n\n```bash\n# Additional file extensions to include beyond defaults\nCUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig\n\n# Additional ignore patterns to exclude files/directories\nCUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**\n```\n\nThese settings work in combination with tool parameters - patterns from both sources will be merged together.\n\n#### Custom Collection Name (Optional)\n\nUse this when you want a human-readable prefix on collection names in Milvus/Zilliz instead of the bare hash:\n\n```bash\n# Creates code_chunks_my_project_<pathHash> or hybrid_code_chunks_my_project_<pathHash>\nCODE_CHUNKS_COLLECTION_NAME_OVERRIDE=my_project\n```\n\nThe per-codebase `<pathHash>` suffix is preserved even when the override is set, so the same MCP server can still index multiple repos without collapsing them onto one collection. The override value is sanitized to letters, numbers, and underscores, and truncated to keep the full name within Milvus's 255-char limit. If you unset the variable later, Claude Context switches back to the plain `code_chunks_<pathHash>` naming.\n\n#### Trigger File Watcher (Optional)\n\nIn addition to the periodic background sync, the MCP server watches a sentinel file at `~/.context/.sync-trigger` and starts an immediate re-index whenever the file is modified. This lets external tools (Claude Code `PostToolUse` hooks, editor save hooks, CI scripts, etc.) request a sync on demand instead of waiting for the next polling tick.\n\n```bash\n# Default: watcher enabled. Set to false to disable filesystem watching entirely\n# (useful on read-only filesystems or sandboxed environments).\nCLAUDE_CONTEXT_TRIGGER_WATCHER=true\n```\n\nExample — Claude Code hook that re-indexes after every Edit/Write:\n\n```json\n\"hooks\": {\n  \"PostToolUse\": [\n    { \"matcher\": \"Edit|Write\", \"hooks\": [\n      { \"type\": \"command\", \"command\": \"touch ~/.context/.sync-trigger\" }\n    ]}\n  ]\n}\n```\n\nNotes:\n- The trigger fires a debounced re-index (2 s window) so rapid touches collapse to a single sync.\n- Triggered syncs go through the same global cross-process lock as background sync, so when multiple MCP processes share `$HOME` only one process performs the work per trigger.\n- The trigger file's *contents* are ignored — only the modification event matters.\n\n#### Background Sync Configuration (Optional)\n\nBy default, the MCP server runs startup + periodic background sync for compatibility with existing installations. The global cross-process sync lock ensures only one local MCP process performs a sync cycle at a time.\n\nYou can tune or disable periodic polling with environment variables:\n\n```bash\n# Default: true. Set to false to disable startup + periodic polling.\nCLAUDE_CONTEXT_BACKGROUND_SYNC=false\n\n# Optional: control how often sync runs (default: 300000 = 5 minutes)\nCLAUDE_CONTEXT_SYNC_INTERVAL_MS=60000\n```\n\nFor multi-instance local stdio setups, set `CLAUDE_CONTEXT_BACKGROUND_SYNC=false` and keep the trigger watcher enabled. That avoids idle polling while still allowing external tools to request immediate re-indexing by touching `~/.context/.sync-trigger`.\n\n## Usage with MCP Clients\n\n<details>\n<summary><strong>Claude Code</strong></summary>\n\nUse the command line interface to add the Claude Context MCP server:\n\n```bash\n# Add the Claude Context MCP server\nclaude mcp add claude-context -e OPENAI_API_KEY=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\n\n```\n\nSee the [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) for more details about MCP server management.\n\n</details>\n\n<details>\n<summary><strong>OpenAI Codex CLI</strong></summary>\n\nCodex CLI uses TOML configuration files:\n\n1. Create or edit the `~/.codex/config.toml` file.\n\n2. Add the following configuration:\n\n```toml\n# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.\n[mcp_servers.claude-context]\ncommand = \"npx\"\nargs = [\"@zilliz/claude-context-mcp@latest\"]\nenv = { \"OPENAI_API_KEY\" = \"your-openai-api-key\", \"MILVUS_TOKEN\" = \"your-zilliz-cloud-api-key\" }\n# Optional: override the default 10s startup timeout\nstartup_timeout_ms = 20000\n```\n\n3. Save the file and restart Codex CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Gemini CLI</strong></summary>\n\nGemini CLI requires manual configuration through a JSON file:\n\n1. Create or edit the `~/.gemini/settings.json` file.\n\n2. Add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file and restart Gemini CLI to apply the changes.\n\n</details>\n\n<details>\n<summary><strong>Qwen Code</strong></summary>\n\nCreate or edit the `~/.qwen/settings.json` file and add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cursor</strong></summary>\n\nGo to: `Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`\n\nPasting 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](https://cursor.com/docs/context/mcp) for more info.\n\n**OpenAI Configuration (Default):**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"OpenAI\",\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**VoyageAI Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"VoyageAI\",\n        \"VOYAGEAI_API_KEY\": \"your-voyageai-api-key\",\n        \"EMBEDDING_MODEL\": \"voyage-code-3\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Gemini Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Gemini\",\n        \"GEMINI_API_KEY\": \"your-gemini-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n**Ollama Configuration:**\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"EMBEDDING_PROVIDER\": \"Ollama\",\n        \"EMBEDDING_MODEL\": \"nomic-embed-text\",\n        \"OLLAMA_HOST\": \"http://127.0.0.1:11434\",\n        \"EMBEDDING_DIMENSION\": \"768\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Void</strong></summary>\n\nGo to: `Settings` -> `MCP` -> `Add MCP Server`\n\nAdd the following configuration to your Void MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"code-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Claude Desktop</strong></summary>\n\nAdd to your Claude Desktop configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Windsurf</strong></summary>\n\nWindsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>VS Code</strong></summary>\n\nThe Claude Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary><strong>Cherry Studio</strong></summary>\n\nCherry 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:\n\n1. Navigate to **Settings → MCP Servers → Add Server**.\n2. Fill in the server details:\n   - **Name**: `claude-context`\n   - **Type**: `STDIO`\n   - **Command**: `npx`\n   - **Arguments**: `[\"-y\", \"@zilliz/claude-context-mcp@latest\"]`\n   - **Environment Variables**:\n     - `OPENAI_API_KEY`: `your-openai-api-key`\n     - `MILVUS_TOKEN`: `your-zilliz-cloud-api-key`\n3. Save the configuration to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Cline</strong></summary>\n\nCline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:\n\n1. Open Cline and click on the **MCP Servers** icon in the top navigation bar.\n\n2. Select the **Installed** tab, then click **Advanced MCP Settings**.\n\n3. In the `cline_mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n4. Save the file.\n\n</details>\n\n<details>\n<summary><strong>Augment</strong></summary>\n\nTo configure Claude Context MCP in Augment Code, you can use either the graphical interface or manual configuration.\n\n#### **A. Using the Augment Code UI**\n\n1. Click the hamburger menu.\n\n2. Select **Settings**.\n\n3. Navigate to the **Tools** section.\n\n4. Click the **+ Add MCP** button.\n\n5. Enter the following command:\n\n   ```\n   npx @zilliz/claude-context-mcp@latest\n   ```\n\n6. Name the MCP: **Claude Context**.\n\n7. Click the **Add** button.\n\n------\n\n#### **B. Manual Configuration**\n\n1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel\n2. Select Edit Settings\n3. Under Advanced, click Edit in settings.json\n4. Add the server configuration to the `mcpServers` array in the `augment.advanced` object\n\n```json\n\"augment.advanced\": { \n  \"mcpServers\": [ \n    { \n      \"name\": \"claude-context\", \n      \"command\": \"npx\", \n      \"args\": [\"-y\", \"@zilliz/claude-context-mcp@latest\"] \n    } \n  ] \n}\n```\n\n</details>\n\n<details>\n<summary><strong>Roo Code</strong></summary>\n\nRoo Code utilizes a JSON configuration file for MCP servers:\n\n1. Open Roo Code and navigate to **Settings → MCP Servers → Edit Global Config**.\n\n2. In the `mcp_settings.json` file, add the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"claude-context\": {\n      \"command\": \"npx\",\n      \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n      \"env\": {\n        \"OPENAI_API_KEY\": \"your-openai-api-key\",\n        \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n      }\n    }\n  }\n}\n```\n\n3. Save the file to activate the server.\n\n</details>\n\n<details>\n<summary><strong>Zencoder</strong></summary>\n\nZencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.\n\n1. Go to the Zencoder menu (...)\n2. From the dropdown menu, select `Tools`\n3. Click on the `Add Custom MCP`\n4. Add the name (i.e. `Claude Context` and server configuration from below, and make sure to hit the `Install` button\n\n```json\n{\n    \"command\": \"npx\",\n    \"args\": [\"@zilliz/claude-context-mcp@latest\"],\n    \"env\": {\n      \"OPENAI_API_KEY\": \"your-openai-api-key\",\n      \"MILVUS_ADDRESS\": \"your-zilliz-cloud-public-endpoint\",\n      \"MILVUS_TOKEN\": \"your-zilliz-cloud-api-key\"\n    }\n}\n\n```\n\n5. Save the server by hitting the `Install` button.\n\n</details>\n\n<details>\n<summary><strong>LangChain/LangGraph</strong></summary>\n\nFor LangChain/LangGraph integration examples, see [this example](https://github.com/zilliztech/claude-context/blob/643796a0d30e706a2a0dff3d55621c9b5d831807/evaluation/retrieval/custom.py#L88).\n\n</details>\n\n<details>\n<summary><strong>Other MCP Clients</strong></summary>\n\nThe server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:\n\n```bash\nnpx @zilliz/claude-context-mcp@latest\n```\n\n</details>\n\n## Features\n\n- 🔌 **MCP Protocol Compliance**: Full compatibility with MCP-enabled AI assistants and agents\n- 🔍 **Hybrid Code Search**: Natural language queries using advanced hybrid search (BM25 + dense vector) to find relevant code snippets\n- 📁 **Codebase Indexing**: Index entire codebases for fast hybrid search across millions of lines of code\n- 🔄 **Incremental Indexing**: Efficiently re-index only changed files using Merkle trees for auto-sync\n- 🧩 **Intelligent Code Chunking**: AST-based code analysis for syntax-aware chunking with automatic fallback\n- 🗄️ **Scalable**: Integrates with Zilliz Cloud for scalable vector search, no matter how large your codebase is\n- 🛠️ **Customizable**: Configure file extensions, ignore patterns, and embedding models\n- ⚡ **Real-time**: Interactive indexing and searching with progress feedback\n\n## Available Tools\n\n### 1. `index_codebase`\n\nIndex a codebase directory for hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to index\n- `force` (optional): Force re-indexing even if already indexed (default: false)\n- `splitter` (optional): Code splitter to use - 'ast' for syntax-aware splitting with automatic fallback, 'langchain' for character-based splitting (default: \"ast\")\n- `customExtensions` (optional): Additional file extensions to include beyond defaults (e.g., ['.vue', '.svelte', '.astro']). Extensions should include the dot prefix or will be automatically added (default: [])\n- `ignorePatterns` (optional): Additional ignore patterns to exclude specific files/directories beyond defaults (e.g., ['static/**', '*.tmp', 'private/**']) (default: [])\n\n### 2. `search_code`\n\nSearch the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to search in\n- `query` (required): Natural language query to search for in the codebase\n- `limit` (optional): Maximum number of results to return (default: 10, max: 50)\n- `extensionFilter` (optional): List of file extensions to filter results (e.g., ['.ts', '.py']) (default: [])\n\n### 3. `clear_index`\n\nClear the search index for a specific codebase.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to clear index for\n\n### 4. `get_indexing_status`\n\nGet the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.\n\n**Parameters:**\n\n- `path` (required): Absolute path to the codebase directory to check status for\n\n**What the status output means:**\n\n- Progress is **phase-based**, not a direct file-count ratio. The MCP server reports coarse milestones for collection preparation, file scanning, and file processing / embedding work.\n- Because indexing runs in the background and progress is persisted periodically, percentages can jump quickly on large repositories or appear unchanged for a while during long embedding batches.\n- File and chunk statistics are written when an indexing run finishes successfully. During active indexing, `get_indexing_status` intentionally reports progress rather than live file/chunk totals.\n- Codebases are keyed by their **absolute path**. Indexing `/repo`, a symlinked path to the same repo, and a second clone will create separate tracked entries.\n- If a completed entry shows `0 files, 0 chunks`, that usually means the local snapshot metadata is stale rather than the vector database being queried live. Re-indexing, or clearing and re-indexing that exact absolute path, refreshes the stored stats.\n\nFor a deeper explanation, see the [asynchronous indexing workflow guide](../../docs/dive-deep/asynchronous-indexing-workflow.md) and the [troubleshooting FAQ](../../docs/troubleshooting/faq.md).\n\n## Contributing\n\nThis package is part of the Claude Context monorepo. Please see:\n\n- [Main Contributing Guide](../../CONTRIBUTING.md) - General contribution guidelines  \n- [MCP Package Contributing](CONTRIBUTING.md) - Specific development guide for this package\n\n## Related Projects\n\n- **[@zilliz/claude-context-core](../core)** - Core indexing engine used by this MCP server\n- **[VSCode Extension](../vscode-extension)** - Alternative VSCode integration\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Official MCP documentation\n\n## License\n\nMIT - See [LICENSE](../../LICENSE) for details\n\n<!-- File: packages/vscode-extension/README.md (Tokens: ~1579 | Category: plugin-manifest) -->\n# Semantic Code Search VSCode Extension\n\n[![Visual Studio Marketplace](https://img.shields.io/visual-studio-marketplace/v/zilliz.semanticcodesearch?label=VS%20Code%20Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\nA code indexing and semantic search VSCode extension powered by [Claude Context](https://github.com/zilliztech/claude-context).\n\n> 📖 **New to Claude Context?** Check out the [main project README](https://github.com/zilliztech/claude-context/blob/master/README.md) for an overview and setup instructions.\n\n\n![img](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdtCtT9Qi6o5mGVoxzX50r8Nb6zDFcjvTQR7WZ-xMbEsHEPPhSYAFVJ7q4-rETzxJ8wy1cyZmU8CmtpNhAU8PGOqVnE2kc2HCn1etDg97Qsh7m89kBjG4ZT7XBgO4Dp7BfFZx7eow?key=qYdFquJrLcfXCUndY-YRBQ)\n\n## Features\n\n- 🔍 **Semantic Search**: Intelligent code search based on semantic understanding, not just keyword matching\n- 📁 **Codebase Indexing**: Automatically index entire codebase and build semantic vector database\n- 🎯 **Context Search**: Search related code by selecting code snippets\n- 🔧 **Multi-platform Support**: Support for OpenAI, VoyageAI, Gemini, and Ollama as embedding providers\n- 💾 **Vector Storage**: Integrated with Milvus vector database for efficient storage and retrieval\n\n## Requirements\n\n- **VSCode Version**: 1.74.0 or higher\n\n## Installation\n\n### From VS Code Marketplace\n\n1. **Direct Link**: [Install from VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=zilliz.semanticcodesearch)\n\n2. **Manual Search**:\n   - Open Extensions view in VSCode (Ctrl+Shift+X or Cmd+Shift+X on Mac)\n   - Search for \"Semantic Code Search\"\n   - Click Install\n\n## Quick Start\n\n### Configuration\nThe first time you open Claude Context, you need to click on Settings icon to configure the relevant options.\n\n#### Embedding Configuration\nConfigure your embedding provider to convert code into semantic vectors.\n\n**OpenAI Configuration:**\n- `Embedding Provider`: Select \"OpenAI\" from the dropdown\n- `Model name`: Choose the embedding model (e.g., `text-embedding-3-small`, `text-embedding-3-large`)\n- `OpenAI API key`: Your OpenAI API key for authentication\n- `Custom API endpoint URL`: Optional custom endpoint (defaults to `https://api.openai.com/v1`)\n\n**Other Supported Providers:**\n- **Gemini**: Google's state-of-the-art embedding model with Matryoshka representation learning\n- **VoyageAI**: Alternative embedding provider with competitive performance  \n- **Ollama**: For local embedding models\n\n#### Code Splitter Configuration\nConfigure how your code is split into chunks for indexing.\n\n**Splitter Settings:**\n- `Splitter Type`: Choose between \"AST Splitter\" (syntax-aware) or \"LangChain Splitter\" (character-based)\n- `Chunk Size`: Maximum size of each code chunk (default: 1000 characters)\n- `Chunk Overlap`: Number of overlapping characters between chunks (default: 200 characters)\n\n> **Recommendation**: Use AST Splitter for better semantic understanding of code structure.\n\n\n#### Zilliz Cloud configuration\nGet a free Milvus vector database on Zilliz Cloud. \n\nClaude Context needs a vector database. You can [sign up](https://cloud.zilliz.com/signup?utm_source=github&utm_medium=referral&utm_campaign=2507-codecontext-readme) on Zilliz Cloud to get a free Serverless cluster.\n\n![](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/signup_and_create_cluster.jpeg)\n\nAfter creating your cluster, open your Zilliz Cloud console and copy both the **public endpoint** and your **API key**.  \nThese will be used as `your-zilliz-cloud-public-endpoint` and `your-zilliz-cloud-api-key` in the configuration examples.\n\n![Zilliz Cloud Dashboard](https://raw.githubusercontent.com/zilliztech/claude-context/master/assets/zilliz_cloud_dashboard.jpeg)\n\nKeep both values handy for the configuration steps below.\n\nIf you need help creating your free vector database or finding these values, see the [Zilliz Cloud documentation](https://docs.zilliz.com/docs/create-cluster) for detailed instructions.\n\n```bash\nMILVUS_ADDRESS=your-zilliz-cloud-public-endpoint\nMILVUS_TOKEN=your-zilliz-cloud-api-key\n``` \n\n### Usage\n\n1. **Set the Configuration**:\n   - Open VSCode Settings (Ctrl+, or Cmd+, on Mac)\n   - Search for \"Semantic Code Search\"\n   - Set the configuration\n\n2. **Index Codebase**:\n   - Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)\n   - Run \"Semantic Code Search: Index Codebase\"\n\n3. **Start Searching**:\n   - Open Semantic Code Search panel in sidebar\n   - Enter search query or right-click on selected code to search\n\n## Commands\n\n- `Semantic Code Search: Semantic Search` - Perform semantic search\n- `Semantic Code Search: Index Codebase` - Index current codebase\n- `Semantic Code Search: Clear Index` - Clear the index\n\n## Configuration\n\n- `semanticCodeSearch.embeddingProvider.provider` - Embedding provider (OpenAI/VoyageAI/Gemini/Ollama)\n- `semanticCodeSearch.embeddingProvider.model` - Embedding model to use\n- `semanticCodeSearch.embeddingProvider.apiKey` - API key for embedding provider\n- `semanticCodeSearch.embeddingProvider.baseURL` - Custom API endpoint URL (optional, for OpenAI and Gemini)\n- `semanticCodeSearch.embeddingProvider.outputDimensionality` - Output dimension for Gemini (supports 3072, 1536, 768, 256)\n- `semanticCodeSearch.milvus.address` - Milvus server address\n\n## Contributing\n\nThis VSCode extension is part of the Claude Context monorepo. Please see:\n- [Main Contributing Guide](https://github.com/zilliztech/claude-context/blob/master/CONTRIBUTING.md) - General contribution guidelines\n- [VSCode Extension Contributing](https://github.com/zilliztech/claude-context/blob/master/packages/vscode-extension/CONTRIBUTING.md) - Specific development guide for this extension\n\n## Related Packages\n\n- **[@zilliz/claude-context-core](https://github.com/zilliztech/claude-context/tree/master/packages/core)** - Core indexing engine used by this extension\n- **[@zilliz/claude-context-mcp](https://github.com/zilliztech/claude-context/tree/master/packages/mcp)** - Alternative MCP server integration\n\n## Tech Stack\n\n- TypeScript\n- VSCode Extension API  \n- Milvus Vector Database\n- OpenAI/VoyageAI Embeddings\n\n## License\n\nMIT - See [LICENSE](https://github.com/zilliztech/claude-context/blob/master/LICENSE) for details\n</yakaai_skills>"}