Skip to content

Configuration

mcpr can be configured three ways. Priority order: CLI args > environment variables > mcpr.toml > defaults.

mcpr looks for mcpr.toml in the current directory, then parent directories.

mcp = "http://localhost:9000"
mcp = "http://localhost:9000"
widgets = "http://localhost:4444"
mcp = "http://localhost:9000"
widgets = "./widgets/dist"
mcp = "http://localhost:9000"
no_tunnel = true
port = 3000
mcp = "http://localhost:9000"
relay_url = "https://relay.yourdomain.com"
mcp = "http://localhost:9000"
widgets = "http://localhost:4444"
csp = ["cdn.example.com", "api.example.com"]
csp_mode = "extend" # "extend" (default) or "override"
mcp = "http://localhost:9000"
[cloud]
token = "mcpr_xxxxxxxx"
server = "my-proxy"
mcp = "http://localhost:9000"
widgets = "http://localhost:4444"
port = 3000
# no_tunnel = true # uncomment for production (disables tunnel)
tunnel_token = "tok_abc123..."
csp = ["cdn.example.com"]
csp_mode = "extend"
[cloud]
token = "mcpr_xxxxxxxx"
server = "my-proxy"

On first run, mcpr generates a tunnel_token and appends it to mcpr.toml. This keeps your tunnel URL stable across restarts. You don’t need to set it manually.

VariableDescription
MCPR_RELAY_URLCustom relay server URL
MCPR_CLOUD_TOKENCloud sync token (from cloud.mcpr.app)
MCPR_AUTH_PROVIDERAuth provider URL (relay mode)
MCPR_AUTH_PROVIDER_SECRETAuth provider shared secret (relay mode)
mcp = "http://localhost:9000"
no_tunnel = true
no_tui = true
port = 8080
drain_timeout = 25
log_format = "json"
admin_bind = "0.0.0.0:9901"
[cloud]
token = "mcpr_xxxxxxxx"
server = "prod-1"

Use mcpr validate to check your config file without starting the proxy:

Terminal window
mcpr validate # checks ./mcpr.toml
mcpr validate -c /etc/mcpr/mcpr.toml # checks a specific file

Exit code 0 means the config is valid. Exit code 1 means there are errors.

See config_examples/ in the repository for ready-to-use templates:

  • tunnel.toml — development with tunnel
  • no-tunnel.toml — local or production without tunnel
  • relay.toml — running your own relay server

For the full CLI flag reference, see CLI Reference.