Configuration
mcpr can be configured three ways. Priority order: CLI args > environment variables > mcpr.toml > defaults.
Config file
Section titled “Config file”mcpr looks for mcpr.toml in the current directory, then parent directories.
MCP server only
Section titled “MCP server only”mcp = "http://localhost:9000"MCP server + widgets
Section titled “MCP server + widgets”mcp = "http://localhost:9000"widgets = "http://localhost:4444"Static widgets from disk
Section titled “Static widgets from disk”mcp = "http://localhost:9000"widgets = "./widgets/dist"Local only (no tunnel)
Section titled “Local only (no tunnel)”mcp = "http://localhost:9000"no_tunnel = trueport = 3000Custom relay
Section titled “Custom relay”mcp = "http://localhost:9000"relay_url = "https://relay.yourdomain.com"CSP configuration
Section titled “CSP configuration”mcp = "http://localhost:9000"widgets = "http://localhost:4444"csp = ["cdn.example.com", "api.example.com"]csp_mode = "extend" # "extend" (default) or "override"Cloud sync
Section titled “Cloud sync”mcp = "http://localhost:9000"
[cloud]token = "mcpr_xxxxxxxx"server = "my-proxy"Full example
Section titled “Full example”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"Auto-generated fields
Section titled “Auto-generated fields”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.
Environment variables
Section titled “Environment variables”| Variable | Description |
|---|---|
MCPR_RELAY_URL | Custom relay server URL |
MCPR_CLOUD_TOKEN | Cloud sync token (from cloud.mcpr.app) |
MCPR_AUTH_PROVIDER | Auth provider URL (relay mode) |
MCPR_AUTH_PROVIDER_SECRET | Auth provider shared secret (relay mode) |
Docker / Kubernetes (production)
Section titled “Docker / Kubernetes (production)”mcp = "http://localhost:9000"no_tunnel = trueno_tui = trueport = 8080drain_timeout = 25log_format = "json"admin_bind = "0.0.0.0:9901"
[cloud]token = "mcpr_xxxxxxxx"server = "prod-1"Validating config
Section titled “Validating config”Use mcpr validate to check your config file without starting the proxy:
mcpr validate # checks ./mcpr.tomlmcpr validate -c /etc/mcpr/mcpr.toml # checks a specific fileExit code 0 means the config is valid. Exit code 1 means there are errors.
Config templates
Section titled “Config templates”See config_examples/ in the repository for ready-to-use templates:
tunnel.toml— development with tunnelno-tunnel.toml— local or production without tunnelrelay.toml— running your own relay server
For the full CLI flag reference, see CLI Reference.
