Model Context Protocol (MCP) integration for Code Context - A powerful MCP server that enables AI assistants and agents to index and search codebases using semantic search.
Check out the main project README for an overview and setup instructions.
Model Context Protocol (MCP) allows you to integrate Code Context with your favorite AI coding assistants, e.g. Claude Code.
Before using the MCP server, make sure you have:
- API key for your chosen embedding provider (OpenAI, VoyageAI, Gemini, Ollama, or DashScope setup)
- Hologres vector database instance
💡 Setup Help: See the main project setup guide for detailed installation instructions.
Code Context MCP supports multiple embedding providers. Choose the one that best fits your needs:
📋 Quick Reference: For a complete list of environment variables and their descriptions, see the Environment Variables Guide.
# Supported providers: OpenAI, VoyageAI, Gemini, Ollama, DashScope
EMBEDDING_PROVIDER=OpenAI1. OpenAI Configuration (Default)
OPENAI_API_KEY=sk-your-openai-api-key
EMBEDDING_MODEL=text-embedding-3-small
OPENAI_BASE_URL=https://api.openai.com/v1Available Models:
See getSupportedModels in openai-embedding.ts for the full list.
2. VoyageAI Configuration
VOYAGEAI_API_KEY=pa-your-voyageai-api-key
EMBEDDING_MODEL=voyage-code-33. Gemini Configuration
GEMINI_API_KEY=your-gemini-api-key
EMBEDDING_MODEL=gemini-embedding-0014. Ollama Configuration (Local/Self-hosted)
EMBEDDING_MODEL=nomic-embed-text
OLLAMA_HOST=http://127.0.0.1:114345. DashScope Configuration (阿里云百炼)
DASHSCOPE_API_KEY=sk-your-dashscope-api-key
EMBEDDING_MODEL=text-embedding-v4Available Models:
See getSupportedModels in dashscope-embedding.ts for the full list.
Configure your Hologres connection:
HOLOGRES_HOST=your-hologres-instance.hologres.aliyuncs.com
HOLOGRES_PORT=80
HOLOGRES_DATABASE=your-database-name
HOLOGRES_USER=your-access-id
HOLOGRES_PASSWORD=your-access-secretEMBEDDING_BATCH_SIZE=512CUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig
CUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**Claude Code
claude mcp add code-context-hologres -e OPENAI_API_KEY=your-openai-api-key -e HOLOGRES_HOST=your-hologres-host -e HOLOGRES_PORT=80 -e HOLOGRES_DATABASE=your-database-name -e HOLOGRES_USER=your-access-id -e HOLOGRES_PASSWORD=your-hologres-password -- npx code-context-mcp-hologres@latestCursor / Windsurf / VS Code / Claude Desktop / Gemini CLI / Qwen Code / Void / Cline / Roo Code / Cherry Studio
{
"mcpServers": {
"code-context-hologres": {
"command": "npx",
"args": ["-y", "code-context-mcp-hologres@latest"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key",
"HOLOGRES_HOST": "your-hologres-host",
"HOLOGRES_PORT": "80",
"HOLOGRES_DATABASE": "your-database-name",
"HOLOGRES_USER": "your-access-id",
"HOLOGRES_PASSWORD": "your-hologres-password"
}
}
}
}OpenAI Codex CLI
[mcp_servers.code-context-hologres]
command = "npx"
args = ["code-context-mcp-hologres@latest"]
env = { "OPENAI_API_KEY" = "your-openai-api-key", "HOLOGRES_HOST" = "your-hologres-host", "HOLOGRES_PORT" = "80", "HOLOGRES_DATABASE" = "your-database-name", "HOLOGRES_USER" = "your-access-id", "HOLOGRES_PASSWORD" = "your-hologres-password" }
startup_timeout_ms = 20000Augment
"augment.advanced": {
"mcpServers": [
{
"name": "code-context-hologres",
"command": "npx",
"args": ["-y", "code-context-mcp-hologres@latest"]
}
]
}LangChain/LangGraph
For LangChain/LangGraph integration examples, see this example.
Other MCP Clients
npx code-context-mcp-hologres@latest- 🔌 MCP Protocol Compliance: Full compatibility with MCP-enabled AI assistants and agents
- 🔍 Hybrid Code Search: Natural language queries using advanced hybrid search (BM25 + dense vector)
- 📁 Codebase Indexing: Index entire codebases for fast hybrid search
- 🔄 Incremental Indexing: Efficiently re-index only changed files using Merkle trees
- 🧩 Intelligent Code Chunking: AST-based code analysis for syntax-aware chunking
- 🗄️ Scalable: Integrates with Hologres for scalable vector search
- 🛠️ Customizable: Configure file extensions, ignore patterns, and embedding models
- ⚡ Real-time: Interactive indexing and searching with progress feedback
Index a codebase directory for hybrid search (BM25 + dense vector).
Parameters:
path(required): Absolute path to the codebase directory to indexforce(optional): Force re-indexing (default: false)splitter(optional): Code splitter - 'ast' or 'langchain' (default: "ast")customExtensions(optional): Additional file extensions (default: [])ignorePatterns(optional): Additional ignore patterns (default: [])
Search the indexed codebase using natural language queries.
Parameters:
path(required): Absolute path to the codebase directoryquery(required): Natural language querylimit(optional): Maximum results (default: 10, max: 50)extensionFilter(optional): File extension filter (default: [])
Clear the search index for a specific codebase.
Parameters:
path(required): Absolute path to the codebase directory
Get the current indexing status of a codebase.
Parameters:
path(required): Absolute path to the codebase directory
This package is part of the Code Context monorepo. Please see:
- Main Contributing Guide - General contribution guidelines
- MCP Package Contributing - Specific development guide for this package
- code-context-core-hologres - Core indexing engine used by this MCP server
- VSCode Extension - Alternative VSCode integration
- Model Context Protocol - Official MCP documentation
MIT - See LICENSE for details