MDDB Configuration Reference

Complete reference for all MDDB configuration parameters.

Precedence order: CLI flags > environment variables > YAML config file > defaults

Table of Contents


General / Core

Env VarDefaultTypeDescription
MDDB_CONFIG""stringPath to YAML config file (also -config / -c CLI flag)
MDDB_PATH"mddb.db"stringPath to the BoltDB database file (also --db CLI flag, database.path in YAML)
MDDB_MODE"wr"stringAccess mode: "read", "write", or "wr" (read+write) (also --mode CLI flag, database.mode in YAML)
MDDB_PANEL_MODE"internal"stringPanel mode: "internal" (CORS enabled) or "external" (reverse proxy)
MDDB_CORS_ORIGIN"*"stringCORS Access-Control-Allow-Origin header value
MDDB_METRICS"true"boolEnable Prometheus-compatible /metrics endpoint
MDDB_SEARCH_STATS"true"boolInclude searchStats in search responses

HTTP Server

Env VarDefaultTypeCLI FlagDescription
MDDB_HTTP_ENABLEDtruebool--http-enabledEnable/disable the HTTP API server
MDDB_HTTP_ADDR":11023"string--http-addrHTTP API listen address
MDDB_HTTP_PORTโ€”stringโ€”Plain port number (converted to ":PORT")
MDDB_ADDR":11023"stringโ€”Legacy alias for MDDB_HTTP_ADDR

gRPC Server

Env VarDefaultTypeCLI FlagDescription
MDDB_GRPC_ENABLEDtruebool--grpc-enabledEnable/disable the gRPC server
MDDB_GRPC_ADDR":11024"string--grpc-addrgRPC listen address
MDDB_GRPC_PORTโ€”stringโ€”Plain port number (converted to ":PORT")

MCP (Model Context Protocol)

Env VarDefaultTypeCLI FlagDescription
MDDB_MCP_ENABLEDtruebool--mcp-enabledEnable/disable the MCP server
MDDB_MCP_ADDR":9000"string--mcp-addrMCP HTTP listen address
MDDB_MCP_PORTโ€”stringโ€”Plain port number (converted to ":PORT")
MDDB_MCP_STDIOfalsebool--mcp-stdioRun MCP in stdio mode (for Claude Desktop)
MDDB_MCP_DOMAIN""stringโ€”MCP server domain
MDDB_MCP_CONFIG""stringโ€”Path to YAML with custom MCP tool definitions
MDDB_MCP_BUILTIN_TOOLStrueboolโ€”Set to false to expose only custom YAML tools
MDDB_MCP_MODE"wr"stringโ€”MCP access mode: "read", "write", or "wr"

MCP API Key Authentication

Env VarDefaultTypeDescription
MDDB_MCP_API_KEY_ENABLEDfalseboolEnable API key authentication for MCP endpoints
MDDB_MCP_API_KEYS""stringStatic API keys: key1:name1,key2:name2
MDDB_MCP_API_KEY_CACHE_TTL"5m"durationCache TTL for dynamic API key lookups

MCP Rate Limiting

Env VarDefaultTypeDescription
MDDB_MCP_RATE_LIMIT_ENABLEDfalseboolEnable per-client rate limiting for MCP
MDDB_MCP_RATE_LIMIT_REQUESTS100intMaximum requests per window
MDDB_MCP_RATE_LIMIT_WINDOW"60s"durationRate limit time window
MDDB_MCP_RATE_LIMIT_BURST20intMaximum burst size
MDDB_MCP_RATE_LIMIT_BY"ip"stringRate limit key: "ip", "api_key", or "session"

MCP Logging

Env VarDefaultTypeDescription
MDDB_MCP_LOGGING_ENABLEDfalseboolEnable structured JSON audit logs for MCP requests
MDDB_MCP_LOGGING_LEVEL"info"stringMinimum log level: "debug", "info", "warn", "error"

HTTP/3 (QUIC)

Env VarDefaultTypeCLI FlagDescription
MDDB_HTTP3_ENABLEDfalsebool--http3-enabledEnable HTTP/3 (QUIC) server
MDDB_HTTP3_ADDR":11443"string--http3-addrHTTP/3 listen address
MDDB_HTTP3_PORTโ€”stringโ€”Plain port number (converted to ":PORT")
MDDB_EXTREMEโ€”boolโ€”Legacy alias for MDDB_HTTP3_ENABLED

Authentication

Env VarDefaultTypeDescription
MDDB_AUTH_ENABLEDfalseboolEnable JWT-based authentication
MDDB_AUTH_JWT_SECRET""stringJWT signing secret (required when auth is enabled)
MDDB_AUTH_JWT_EXPIRY"24h"durationJWT token expiry duration
MDDB_AUTH_ADMIN_USERNAME"admin"stringDefault admin username
MDDB_AUTH_ADMIN_PASSWORD""stringDefault admin password

Embedding / Vector Search

Env VarDefaultTypeDescription
MDDB_EMBEDDING_PROVIDER"" (disabled)stringProvider: "openai", "ollama", "voyage", "cohere", or ""
MDDB_EMBEDDING_API_KEY""stringAPI key (for openai/voyage/cohere)
MDDB_EMBEDDING_API_URL(see below)stringAPI base URL
MDDB_EMBEDDING_MODEL(see below)stringEmbedding model name
MDDB_EMBEDDING_DIMENSIONS(see below)intVector dimensionality
MDDB_EMBEDDING_CHUNK_ENABLEDtrueboolEnable text chunking before embedding
MDDB_EMBEDDING_CHUNK_SIZE1500intMaximum chunk size in characters

Provider Defaults

ProviderAPI_URLMODELDIMENSIONS
openaihttps://api.openai.com/v1text-embedding-3-small1536
ollamahttp://localhost:11434nomic-embed-text768
voyagehttps://api.voyageai.com/v1voyage-31024
coherehttps://api.cohere.ai/v1embed-english-v3.01024

Vector Index

Env VarDefaultTypeDescription
MDDB_VECTOR_DEFAULT_ALGORITHM"flat"stringDefault algorithm: "flat", "hnsw", "ivf", "pq", "opq", "sq", "bq"
MDDB_VECTOR_BQ_RERANK_FACTOR10intBinary quantization rerank factor
MDDB_VECTOR_PARALLEL_WORKERSNumCPU (max 16)intNumber of goroutines for parallel vector scoring
MDDB_VECTOR_PARALLEL_MIN_SIZE2048intMinimum collection size to enable parallel search

MCP Server Info

Customize the MCP server profile returned in the initialize response. Useful for identifying your server to LLM clients.

Env VarDefaultTypeDescription
MDDB_MCP_SERVER_NAME"mddbd"stringServer name shown to MCP clients
MDDB_MCP_SERVER_DESCRIPTION""stringHuman-readable server description
MDDB_MCP_SERVER_VENDOR""stringOrganization / vendor name
MDDB_MCP_SERVER_HOMEPAGE""stringURL to server documentation or homepage
MDDB_MCP_INSTRUCTIONS""stringSystem prompt for LLM โ€” tells the AI how to use this server

Or via YAML config:

mcp: serverInfo: name: "my-knowledge-base" description: "Company internal documentation" vendor: "Acme Corp" homepage: "https://docs.acme.com" instructions: | This is the company knowledge base. Use search_documents to find relevant articles before answering questions. Always cite document keys in your responses. Prefer the 'docs' collection for technical questions and 'blog' for product updates.

Server-Sent Events (SSE)

Env VarDefaultTypeDescription
MDDB_SSE_ENABLEDtrueboolEnable SSE event stream at /v1/events
MDDB_SSE_MAX_CLIENTS1000intMaximum total concurrent SSE connections
MDDB_SSE_MAX_PER_IP5intMaximum concurrent SSE connections per IP address

TLS / HTTPS / mTLS

See TLS.md for the full setup guide (cert generation, recipes, troubleshooting).

Env VarDefaultTypeDescription
MDDB_TLS_ENABLEDfalseboolEnable built-in TLS (HTTPS) on the HTTP listener
MDDB_TLS_CERT""stringPath to server TLS certificate (PEM)
MDDB_TLS_KEY""stringPath to server TLS private key (PEM)
MDDB_TLS_CLIENT_CA""stringPath to PEM bundle of trusted client CAs โ€” enables mTLS when set
MDDB_TLS_CLIENT_AUTH"require"stringmTLS mode when MDDB_TLS_CLIENT_CA is set: require (reject anonymous clients) or request (verify only if cert presented)

MinVersion is pinned to TLS 1.2. mTLS is automatically skipped on UDS listeners (filesystem permissions already authenticate the local peer).


Unix Domain Socket transport

MDDB_HTTP_ADDR and MDDB_GRPC_ADDR accept either a TCP host:port (default) or a Unix Domain Socket address of the form unix:/absolute/path.sock. The server creates the socket with owner-only 0600 permissions, removes any stale socket file from a previous run, and unlinks the socket on graceful shutdown.

MDDB_HTTP_ADDR=unix:/var/run/mddb/http.sock \
MDDB_GRPC_ADDR=:11024 \
./mddbd

TLS is automatically disabled on UDS listeners (peer is authenticated by filesystem permissions; API keys / JWT still apply on top). Per-IP rate limits in SSE collapse to a single bucket on UDS โ€” apply application-level rate limiting if you need to differentiate clients.

Clients with native UDS support:

ClientAddress form
Python (services/python-extension/mddb.py)MDDB.connect('unix:/var/run/mddb/http.sock')
PHP (services/php-extension/mddb.php)mddb::connect('unix:/var/run/mddb/http.sock')
Python gRPC (clients/python/)grpc.insecure_channel('unix:/var/run/mddb/grpc.sock')
Node gRPC (clients/nodejs/)new MDDBClient('unix:/var/run/mddb/grpc.sock', creds)
curlcurl --unix-socket /var/run/mddb/http.sock http://localhost/v1/healthz

Profiling

Env VarDefaultTypeDescription
MDDB_PPROF_ENABLEDfalseboolEnable pprof profiling endpoints at /debug/pprof/

HTTP Connection Pool

Env VarDefaultTypeDescription
MDDB_HTTP_POOL_MAX_IDLE100intMax idle connections in shared HTTP pool
MDDB_HTTP_POOL_MAX_PER_HOST10intMax idle connections per target host
MDDB_HTTP_POOL_IDLE_TIMEOUT90intIdle connection timeout in seconds

Full-Text Search (FTS)

Env VarDefaultTypeDescription
MDDB_FTS_STEMMINGtrueboolEnable Porter stemming for FTS indexing and queries
MDDB_FTS_SYNONYMStrueboolEnable synonym expansion in FTS queries
MDDB_FTS_DEFAULT_LANG"en"stringDefault language for stemming and stop words

Temporal Tracking

Env VarDefaultTypeDescription
MDDB_TEMPORALfalseboolEnable document lifecycle event tracking (create/update/access)

When enabled, provides endpoints: POST /v1/temporal/query, POST /v1/temporal/hot, POST /v1/temporal/histogram. Per-collection opt-in via Collection Settings (trackAccess, trackHot).


Spell Correction

Env VarDefaultTypeDescription
MDDB_SPELLfalseboolEnable SymSpell-style spell checker for FTS queries

When enabled, provides endpoints: POST /v1/spell-suggest, POST /v1/spell-cleanup, GET/PUT/DELETE /v1/spell-dictionary. Enable spellCorrect: true on a collection for auto-correction.


Compression

Env VarDefaultTypeDescription
MDDB_COMPRESSION_ENABLEDtrueboolEnable adaptive document compression
MDDB_COMPRESSION_SMALL_THRESHOLD1024int (bytes)Below this: Snappy compression
MDDB_COMPRESSION_MEDIUM_THRESHOLD10240int (bytes)Above this: Zstd compression

Replication

Env VarDefaultTypeDescription
MDDB_REPLICATION_ROLE""stringRole: "leader", "follower", or "" (standalone)
MDDB_NODE_ID""stringUnique node ID (required for replication)
MDDB_REPLICATION_LEADER_ADDR""stringLeader address for follower nodes
MDDB_BINLOG_ENABLEDfalseboolEnable binary log (auto-enabled for leaders)
MDDB_BINLOG_PATH""stringCustom binlog file path

Automation & Triggers

Env VarDefaultTypeDescription
MDDB_AUTOMATIONS"enable"stringSet to "disable" to disable automation manager
MDDB_AUTOMATION_LOGS"enable"stringSet to "disable" to disable log storage
MDDB_AUTOMATION_LOGS_TTL"7d"durationTTL for automation log entries
MDDB_TRIGGERSfalseboolEnable automation triggers on document changes
MDDB_CRONSfalseboolEnable cron scheduler for automations

GraphQL

Env VarDefaultTypeDescription
MDDB_GRAPHQL_ENABLEDfalseboolEnable GraphQL endpoint at /graphql
MDDB_GRAPHQL_PLAYGROUNDtrueboolEnable GraphQL Playground at /playground

CLI Flags

FlagShortTypeDescription
--config-cstringPath to YAML config file
--http-enabledstringEnable HTTP API (true/false)
--http-addrstringHTTP listen address
--grpc-enabledstringEnable gRPC server (true/false)
--grpc-addrstringgRPC listen address
--mcp-enabledstringEnable MCP server (true/false)
--mcp-addrstringMCP listen address
--mcp-stdiostringMCP stdio mode (true/false)
--http3-enabledstringEnable HTTP/3 server (true/false)
--http3-addrstringHTTP/3 listen address

YAML Config File

Pass via --config config.yaml or MDDB_CONFIG=config.yaml.

path: "mddb.db"
mode: "wr" # read, write, wr http: enabled: true addr: ":11023" grpc: enabled: true addr: ":11024" mcp: enabled: true addr: ":9000" stdio: false domain: "" http3: enabled: false addr: ":11443" auth: enabled: false jwtSecret: "" jwtExpiry: "24h" adminUsername: "admin" adminPassword: "" fts: stemmingEnabled: true synonymsEnabled: true compression: enabled: true smallThreshold: 1024 mediumThreshold: 10240 vector: defaultAlgorithm: "flat" bqRerankFactor: 10 parallelWorkers: 0 # 0 = auto (NumCPU, max 16) parallelMinSize: 2048 # min collection size for parallel search temporal: false spell: false mcp: apiKeyEnabled: false apiKeys: "" rateLimitEnabled: false rateLimitRequests: 100 rateLimitWindow: "60s" rateLimitBurst: 20 rateLimitBy: "ip" loggingEnabled: false

Total: 65+ environment variables across 17 categories, 10 CLI flags, full YAML config file support.