code-context-mcp-hologres
v0.1.9
Published
Model Context Protocol integration for Code Context Hologres
Readme
code-context-mcp-hologres
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.
🚀 Use Code Context as MCP in Claude Code and others
Model Context Protocol (MCP) allows you to integrate Code Context with your favorite AI coding assistants, e.g. Claude Code.
Quick Start
Prerequisites
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.
Prepare Environment Variables
Embedding Provider Configuration
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=OpenAIOPENAI_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.
VOYAGEAI_API_KEY=pa-your-voyageai-api-key
EMBEDDING_MODEL=voyage-code-3GEMINI_API_KEY=your-gemini-api-key
EMBEDDING_MODEL=gemini-embedding-001EMBEDDING_MODEL=nomic-embed-text
OLLAMA_HOST=http://127.0.0.1:11434DASHSCOPE_API_KEY=sk-your-dashscope-api-key
EMBEDDING_MODEL=text-embedding-v4Available Models:
See getSupportedModels in dashscope-embedding.ts for the full list.
Hologres Vector Database Configuration
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
EMBEDDING_BATCH_SIZE=512Custom File Processing (Optional)
CUSTOM_EXTENSIONS=.vue,.svelte,.astro,.twig
CUSTOM_IGNORE_PATTERNS=temp/**,*.backup,private/**,uploads/**Usage with MCP Clients
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@latest{
"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"
}
}
}
}[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 = 20000"augment.advanced": {
"mcpServers": [
{
"name": "code-context-hologres",
"command": "npx",
"args": ["-y", "code-context-mcp-hologres@latest"]
}
]
}For LangChain/LangGraph integration examples, see this example.
npx code-context-mcp-hologres@latestFeatures
- 🔌 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
Available Tools
1. index_codebase
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: [])
2. search_code
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: [])
3. clear_index
Clear the search index for a specific codebase.
Parameters:
path(required): Absolute path to the codebase directory
4. get_indexing_status
Get the current indexing status of a codebase.
Parameters:
path(required): Absolute path to the codebase directory
Contributing
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
Related Projects
- code-context-core-hologres - Core indexing engine used by this MCP server
- VSCode Extension - Alternative VSCode integration
- Model Context Protocol - Official MCP documentation
License
MIT - See LICENSE for details
