Configuration
Lucerna picks up an optional config file from your project root to configure embedding and reranking providers for the CLI and MCP server without writing any integration code.
Place a lucerna.config.ts at the project root — the MCP server and all CLI commands pick it up automatically:
import { CloudflareEmbeddings, VoyageReranker } from '@upstart.gg/lucerna';
export default { embeddingFunction: new CloudflareEmbeddings(), rerankingFunction: new VoyageReranker(),};You can also pass providers as CLI flags instead of a config file:
npx @upstart.gg/lucerna mcp-server --embedder cloudflare --reranker voyagenpx @upstart.gg/lucerna mcp-server --config /path/to/lucerna.config.tsSupported filenames (checked in order):
lucerna.config.tslucerna.config.jslucerna.config.mjs
The file must export a default object that satisfies LucernaConfig:
import type { LucernaConfig } from '@upstart.gg/lucerna';import { VoyageReranker } from '@upstart.gg/lucerna';
export default { // Use Cloudflare for embeddings (reads CLOUDFLARE_* env vars automatically) embeddingFunction: 'cloudflare', // ← shorthand; see Built-in Providers rerankingFunction: new VoyageReranker(),} satisfies LucernaConfig;How config is applied
Section titled “How config is applied”The config file is loaded by both lucerna mcp-server and all other CLI commands. CLI flags always take priority over config file settings:
| Priority | Source |
|---|---|
| 1 (highest) | --no-semantic flag (disables embeddings entirely) |
| 2 | --embedder / --reranker CLI flags |
| 3 | lucerna.config.ts / .js |
| 4 (lowest) | Auto-detection from environment variables |
Pointing to a custom path
Section titled “Pointing to a custom path”If your config isn’t at the project root, pass --config:
lucerna mcp-server /path/to/project --config /path/to/my.config.tslucerna index /path/to/project --config ./configs/lucerna.dev.tsType reference
Section titled “Type reference”interface LucernaConfig { /** * Custom embedding function, or `false` to disable semantic search. * Omit to use the default (auto-detected from env vars). */ embeddingFunction?: EmbeddingFunction | false;
/** * Custom reranking function, or `false` to disable reranking. * Omit to use no reranking (the default). */ rerankingFunction?: RerankingFunction | false;}