Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ MILVUS_ADDRESS=your-zilliz-cloud-public-endpoint
# https://github.com/zilliztech/claude-context/blob/master/assets/signup_and_get_apikey.png
MILVUS_TOKEN=your-zilliz-cloud-api-key

# Milvus database name (optional, defaults to 'default')
MILVUS_DB=your-zilliz-cloud-database-name


# =============================================================================
# Code Splitter Configuration
Expand Down
2 changes: 2 additions & 0 deletions docs/getting-started/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Claude Context supports a global configuration file at `~/.context/.env` to simp
|----------|-------------|---------|
| `MILVUS_TOKEN` | Milvus authentication token. Get [Zilliz Personal API Key](https://github.com/zilliztech/claude-context/blob/master/assets/signup_and_get_apikey.png) | Recommended |
| `MILVUS_ADDRESS` | Milvus server address. Optional when using Zilliz Personal API Key | Auto-resolved from token |
| `MILVUS_DB` | Milvus database name to use | `default` |

### Ollama (Optional)
| Variable | Description | Default |
Expand Down Expand Up @@ -74,6 +75,7 @@ EMBEDDING_PROVIDER=OpenAI
OPENAI_API_KEY=sk-your-openai-api-key
EMBEDDING_MODEL=text-embedding-3-small
MILVUS_TOKEN=your-zilliz-cloud-api-key
MILVUS_DB=default
EOF
```

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/vectordb/milvus-vectordb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface MilvusConfig {
username?: string;
password?: string;
ssl?: boolean;
database?: string;
}


Expand Down Expand Up @@ -45,6 +46,7 @@ export class MilvusVectorDatabase implements VectorDatabase {
username: milvusConfig.username,
password: milvusConfig.password,
token: milvusConfig.token,
database: milvusConfig.database,
ssl: milvusConfig.ssl || false,
});
}
Expand Down
7 changes: 6 additions & 1 deletion packages/mcp/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface ContextMcpConfig {
// Vector database configuration
milvusAddress?: string; // Optional, can be auto-resolved from token
milvusToken?: string;
milvusDatabase?: string; // Optional, defaults to 'default'
}

// Legacy format (v1) - for backward compatibility
Expand Down Expand Up @@ -111,6 +112,7 @@ export function createMcpConfig(): ContextMcpConfig {
console.log(`[DEBUG] GEMINI_API_KEY: ${envManager.get('GEMINI_API_KEY') ? 'SET (length: ' + envManager.get('GEMINI_API_KEY')!.length + ')' : 'NOT SET'}`);
console.log(`[DEBUG] OPENAI_API_KEY: ${envManager.get('OPENAI_API_KEY') ? 'SET (length: ' + envManager.get('OPENAI_API_KEY')!.length + ')' : 'NOT SET'}`);
console.log(`[DEBUG] MILVUS_ADDRESS: ${envManager.get('MILVUS_ADDRESS') || 'NOT SET'}`);
console.log(`[DEBUG] MILVUS_DB: ${envManager.get('MILVUS_DB') || 'NOT SET'}`);
console.log(`[DEBUG] NODE_ENV: ${envManager.get('NODE_ENV') || 'NOT SET'}`);

const config: ContextMcpConfig = {
Expand All @@ -130,7 +132,8 @@ export function createMcpConfig(): ContextMcpConfig {
ollamaHost: envManager.get('OLLAMA_HOST'),
// Vector database configuration - address can be auto-resolved from token
milvusAddress: envManager.get('MILVUS_ADDRESS'), // Optional, can be resolved from token
milvusToken: envManager.get('MILVUS_TOKEN')
milvusToken: envManager.get('MILVUS_TOKEN'),
milvusDatabase: envManager.get('MILVUS_DB') // Optional, defaults to 'default'
};

return config;
Expand All @@ -144,6 +147,7 @@ export function logConfigurationSummary(config: ContextMcpConfig): void {
console.log(`[MCP] Embedding Provider: ${config.embeddingProvider}`);
console.log(`[MCP] Embedding Model: ${config.embeddingModel}`);
console.log(`[MCP] Milvus Address: ${config.milvusAddress || (config.milvusToken ? '[Auto-resolve from token]' : '[Not configured]')}`);
console.log(`[MCP] Milvus Database: ${config.milvusDatabase || 'default'}`);

// Log provider-specific configuration without exposing sensitive data
switch (config.embeddingProvider) {
Expand Down Expand Up @@ -202,6 +206,7 @@ Environment Variables:
Vector Database Configuration:
MILVUS_ADDRESS Milvus address (optional, can be auto-resolved from token)
MILVUS_TOKEN Milvus token (optional, used for authentication and address resolution)
MILVUS_DB Milvus database name (optional, defaults to 'default')

Examples:
# Start MCP server with OpenAI (default) and explicit Milvus address
Expand Down
3 changes: 2 additions & 1 deletion packages/mcp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class ContextMcpServer {
// Initialize vector database
const vectorDatabase = new MilvusVectorDatabase({
address: config.milvusAddress,
...(config.milvusToken && { token: config.milvusToken })
...(config.milvusToken && { token: config.milvusToken }),
...(config.milvusDatabase && { database: config.milvusDatabase })
});

// Initialize Claude Context
Expand Down
7 changes: 6 additions & 1 deletion packages/vscode-extension/src/config/configManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { OpenAIEmbedding, OpenAIEmbeddingConfig, VoyageAIEmbedding, VoyageAIEmbe
export interface MilvusWebConfig {
address: string;
token?: string;
database?: string;
}

export type EmbeddingProviderConfig = {
Expand Down Expand Up @@ -297,12 +298,14 @@ export class ConfigManager {
const config = vscode.workspace.getConfiguration(ConfigManager.CONFIG_KEY);
const address = config.get<string>('milvus.address');
const token = config.get<string>('milvus.token');
const database = config.get<string>('milvus.database');

if (!address) return undefined;

return {
address,
token
token,
database
};
}

Expand All @@ -322,6 +325,7 @@ export class ConfigManager {

await workspaceConfig.update('milvus.address', milvusConfig.address, vscode.ConfigurationTarget.Global);
await workspaceConfig.update('milvus.token', milvusConfig.token ?? undefined, vscode.ConfigurationTarget.Global);
await workspaceConfig.update('milvus.database', milvusConfig.database ?? undefined, vscode.ConfigurationTarget.Global);
}

/**
Expand All @@ -335,6 +339,7 @@ export class ConfigManager {
return {
address: webConfig.address,
token: webConfig.token,
database: webConfig.database,
// Set default values
ssl: webConfig.address.startsWith('https://'), // Enable SSL if https address
// username and password are usually handled via token, so not set
Expand Down