Environment Variables Configuration
April 2, 2026 Β· View on GitHub
π― Global Configuration
Code Context supports a global configuration file at ~/.context/.env to simplify MCP setup across different MCP clients.
Benefits:
- Configure once, use everywhere
- No need to specify environment variables in each MCP client
- Cleaner MCP configurations
π Environment Variable Priority
- Process Environment Variables (highest)
- Global Configuration File (
~/.context/.env) - Default Values (lowest)
π§ Required Environment Variables
Embedding Provider
| Variable | Description | Default |
|---|---|---|
EMBEDDING_PROVIDER | Provider: OpenAI, VoyageAI, Gemini, Ollama, DashScope | OpenAI |
EMBEDDING_MODEL | Embedding model name (works for all providers) | Provider-specific default |
OPENAI_API_KEY | OpenAI API key | Required for OpenAI |
OPENAI_BASE_URL | OpenAI API base URL (optional, for custom endpoints) | https://api.openai.com/v1 |
VOYAGEAI_API_KEY | VoyageAI API key | Required for VoyageAI |
GEMINI_API_KEY | Gemini API key | Required for Gemini |
GEMINI_BASE_URL | Gemini API base URL (optional, for custom endpoints) | https://generativelanguage.googleapis.com/v1beta |
DASHSCOPE_API_KEY | DashScope (ιΏιδΊηΎηΌ) API key | Required for DashScope |
DASHSCOPE_BASE_URL | DashScope API base URL (optional) | https://dashscope.aliyuncs.com/compatible-mode/v1 |
π‘ Note:
EMBEDDING_MODELis a universal environment variable that works with all embedding providers. Simply set it to the model name you want to use (e.g.,text-embedding-3-largefor OpenAI,voyage-code-3for VoyageAI, etc.).
Supported Model Names:
OpenAI Models: See
getSupportedModelsinopenai-embedding.tsfor the full list of supported models.VoyageAI Models: See
getSupportedModelsinvoyageai-embedding.tsfor the full list of supported models.Gemini Models: See
getSupportedModelsingemini-embedding.tsfor the full list of supported models.Ollama Models: Depends on the model you install locally.
DashScope Models: See
getSupportedModelsindashscope-embedding.tsfor the full list of supported models.
π For detailed provider-specific configuration examples and setup instructions, see the MCP Configuration Guide.
Vector Database (Hologres)
| Variable | Description | Default |
|---|---|---|
HOLOGRES_HOST | Hologres instance host address | Required |
HOLOGRES_PORT | Hologres port | 80 |
HOLOGRES_DATABASE | Hologres database name | Required |
HOLOGRES_USER | Hologres access ID | Required |
HOLOGRES_PASSWORD | Hologres access secret | Required |
Ollama (Optional)
| Variable | Description | Default |
|---|---|---|
OLLAMA_HOST | Ollama server URL | http://127.0.0.1:11434 |
OLLAMA_MODEL(alternative to EMBEDDING_MODEL) | Model name |
Advanced Configuration
| Variable | Description | Default |
|---|---|---|
HYBRID_MODE | Enable hybrid search (BM25 + dense vector). Set to false for dense-only search | true |
EMBEDDING_BATCH_SIZE | Batch size for processing. Larger batch size means less indexing time | 100 |
SPLITTER_TYPE | Code splitter type: ast, langchain | ast |
CUSTOM_EXTENSIONS | Additional file extensions to include (comma-separated, e.g., .vue,.svelte,.astro) | None |
CUSTOM_IGNORE_PATTERNS | Additional ignore patterns (comma-separated, e.g., temp/**,*.backup,private/**) | None |
π Quick Setup
1. Create Global Config
mkdir -p ~/.context
cat > ~/.context/.env << 'EOF'
EMBEDDING_PROVIDER=OpenAI
OPENAI_API_KEY=sk-your-openai-api-key
EMBEDDING_MODEL=text-embedding-3-small
HOLOGRES_HOST=your-hologres-host
HOLOGRES_PORT=80
HOLOGRES_DATABASE=your-database
HOLOGRES_USER=your-access-id
HOLOGRES_PASSWORD=your-access-secret
EOF
See the Example File for more details.
2. Simplified MCP Configuration
Claude Code:
claude mcp add code-context-hologres -- npx code-context-mcp-hologres@latest
Cursor/Windsurf/Others:
{
"mcpServers": {
"code-context-hologres": {
"command": "npx",
"args": ["-y", "code-context-mcp-hologres@latest"]
}
}
}
π Additional Information
For detailed information about file processing rules and how custom patterns work, see: