Skip to content
Documentation

Environment Variables

updated

Configure CLI behavior with environment variables instead of repeating flags or editing meldoc.config.yml.

Variables

Variable Default Description
MELDOC_TOKEN — API token for CLI operations (integration token mdc_..., CLI secret mld.*.*, or JWT)
MELDOC_CONFIG_FILE meldoc.config.yml in the repo root Config file path override
MELDOC_CONFIG_FILE_NAME — Config file name, resolved against the project root by the MCP server
NO_BROWSER — Set to any value to suppress auto-opening the browser during meldoc auth login
MELDOC_MCP_TOKEN — Token for the MCP server (meldoc mcp serve); falls back to MELDOC_TOKEN. See Authentication

To set the workspace, put workspaceAlias in meldoc.config.yml or pass --workspace on commands that accept it.

Token priority

Meldoc resolves authentication in this order (highest priority first):

  1. --token CLI flag
  2. token field in meldoc.config.yml
  3. MELDOC_TOKEN environment variable
  4. ~/.meldoc/credentials.json (stored by meldoc auth login)

MELDOC_TOKEN

Used for all API operations: push, pull, delete, ci, migrate.

export MELDOC_TOKEN="mld.workspace.secret"
meldoc push

The CLI accepts these token formats:

Format Example HTTP header sent
Integration token mdc_... X-Cli-Secret
CLI secret mld.workspace.secret123 X-Cli-Secret
JWT eyJhbGciOiJIUzI1NiJ9... Authorization: Bearer

Whichever format you use, the CLI also sends X-Workspace-Alias and X-Project-Alias whenever workspaceAlias and projectAlias are set in meldoc.config.yml.

MELDOC_MCP_TOKEN

A separate token for the MCP server’s remote API tools (docs_search, docs_get, docs_list, docs_tree, docs_create, docs_update, docs_delete, projects_list and the rest). If it is not set, the MCP server falls back to MELDOC_TOKEN.

Use it to give an AI assistant read-only access while keeping a write-capable token for your own CLI operations:

export MELDOC_TOKEN="mld.workspace.readwrite"      # CLI push/pull
export MELDOC_MCP_TOKEN="mld.workspace.readonly"   # MCP docs browsing

MELDOC_CONFIG_FILE

Override the default config file location. A relative path is resolved against the current working directory.

export MELDOC_CONFIG_FILE="/path/to/custom-config.yml"

MELDOC_CONFIG_FILE_NAME is the same idea for the MCP server, and it takes a file name rather than a path:

export MELDOC_CONFIG_FILE_NAME="meldoc.config.yml"

The server joins that name to the project root once it knows what the root is. Use it when the config is not in a place you can name in advance — an MCP client configuration is written before anyone knows which directory the editor will open, so an absolute path there only works from one checkout, and a relative one only works when the client happens to start in the right directory.

NO_BROWSER

Suppress auto-opening the browser during meldoc auth login. The authorization link is printed either way — with NO_BROWSER set, the CLI just leaves it for you to open manually.

NO_BROWSER=1 meldoc auth login

CI environment variables

meldoc ci works out which commit to diff against by reading your CI provider’s own variables, in this order — the first one that is set wins:

GITHUB_EVENT_BEFORE -> CI_COMMIT_BEFORE_SHA -> BITBUCKET_COMMIT~1 -> HEAD~1

HEAD~1 is the fallback when none is set, which is why a shallow clone with a single commit can make a run look like it changed everything. Override with meldoc ci --base <commit>.

What’s next?

Configuration — Project configuration file reference.

CI/CD Integration — CI/CD token setup and pipeline examples.