Environment Variables
MCPX can be configured via environment variables to control logging, authentication, metrics, configuration paths, and runtime behavior.
In order to change the environment variables from the default add the tag -e
with the desired variable and updated value. For example, to change LOG_LEVEL
to debug
and disable metrics, run the following Docker command:
docker run --rm -e LOG_LEVEL=debug -e ENABLE_METRICS=false --pull always --privileged -v ./:/lunar/packages/mcpx-server/config -p 9000:9000 -p 5173:5173 -p 9001:9001 -p 3000:3000 --name mcpx us-central1-docker.pkg.dev/prj-common-442813/mcpx/mcpx:latest
Below is a list of supported variables, their meaning, expected input, and default values.
LOG_LEVEL
Description: Sets the logging verbosity for MCPX.
Accepted Values: error
, warn
, info
, http
, verbose
, debug
, silly
Default: info
AUTH_KEY
Description: Optional shared secret used for authenticating incoming connections to MCPX. When set, all requests must include the x-lunar-auth-key
header matching this value. This will only be effective if auth.enabled
is set to true
in app.yaml
Accepted Values: Any string
Default: None (authentication is disabled)
MCPX_PORT
Description: Specifies the port MCPX will bind to for incoming HTTP traffic to MCPX.
Accepted Values: Any valid port number (integer)
Default: 9000
WEBSERVER_PORT
Description: Sets the host URL of the Lunar AI Gateway MCPX should connect to.
Accepted Values: Any valid URL
Default: http://localhost:9001
ENABLE_METRICS
Description: Controls whether metrics should be exposed (e.g. for Prometheus scraping).
Accepted Values: true
, false
(as strings)
Default: true
SERVE_METRICS_PORT
Description: Defines the port on which MCPX serves its metrics endpoint.
Accepted Values: Any valid port number (integer)
Default: 3000
APP_CONFIG_PATH
Description: Path to the YAML file containing application-level configuration (e.g., ACLs, rate limits).
Accepted Values: String path to a .yaml
file
Default: config/app.yaml
SERVERS_CONFIG_PATH
Description: Path to the JSON file that defines which MCP servers/tools should be spawned by MCPX.
Accepted Values: String path to a .json
file
Default: config/mcp.json
LUNAR_API_KEY
Description: Lunar.dev API Key used for interception
Accepted Values: API Key
Default: ""