Gateway Configuration Reference (mvgc.yaml)

Complete reference for all mvgc.yaml settings and corresponding environment variables for the Free Gateway and Self-Hosted Gateway.


Table of Contents


Config file location

The gateway searches for mvgc.yaml in the following order:

PrioritySource
1MVGC_CONFIG=/path/to/mvgc.yaml environment variable
2./mvgc.yaml in the current working directory
3/opt/homebrew/etc/mvgc/mvgc.yaml (Homebrew, Apple Silicon)
4/usr/local/etc/mvgc/mvgc.yaml (Homebrew, Intel Mac)
5/etc/mvgc/mvgc.yaml (Linux deb/rpm packages)
6Default — env vars and built-in defaults only

A missing config file is not an error. Every setting has a built-in default and can be configured via environment variable instead.


Precedence rules

For every setting: environment variable > config file value > built-in default.

Setting an environment variable always overrides the config file, even if the config file has a more specific value. This lets secrets and deployment-specific overrides stay out of the file while keeping general configuration in YAML.


.env file support

The gateway reads a .env file (or MVGC_ENV_FILE if set) before applying any other configuration. Lines follow KEY=VALUE format; comments start with #. Existing environment variables are never overwritten; .env entries are applied only for variables that are not already set in the shell or service manager environment.

# .env
DATABASE_URL=postgres://mvgc:secret@db:5432/mvgc?sslmode=require
MVGC_ADMIN_TOKEN=your-admin-token

gateway — listener and identity

Controls the HTTP listener address, TLS, node identity, CORS, and workload defaults.

YAML keyEnv varTypeDefaultDescription
listen_addrMVGC_LISTEN_ADDRstring127.0.0.1:7080HTTP listen address. Defaults to loopback; set to :7080 or a specific interface for network access.
node_idMVGC_NODE_IDstringnode-local-devUnique identifier for this gateway node. Appears in execution records and the Control Plane node registry.
org_idMVGC_ORG_IDstring""Organization ID from the Axemere console. Required for Self-Hosted Gateway (CP-connected mode).
admin_tokenMVGC_ADMIN_TOKENstring""Token for admin API authentication (X-Admin-Token header). Required in all deployments.
default_workload_idMVGC_DEFAULT_WORKLOAD_IDstringdefaultWorkload ID used for requests that do not include a workload_id.
credentials_dirMVGC_CREDENTIALS_DIRstringconfigs/credentialsDirectory containing credential definition YAML files.
workloads_dirMVGC_WORKLOADS_DIRstringconfigs/workloadsDirectory containing workload definition YAML files (embedded mode only).
proxy_enabledMVGC_PROXY_ENABLEDbooltrueEnable the transparent HTTP/HTTPS forward proxy. Required for MITM interception mode.
cors_originsMVGC_CORS_ORIGINSlist[]Allowed CORS origins. Empty = CORS disabled. Comma-separated via env var (e.g. https://app.example.com,https://dev.example.com).
allowed_connection_typesMVGC_ALLOWED_CONNECTION_TYPESlist[] (all)Restrict accepted connection types. Values: direct_api, connect_proxy. Empty = all types allowed. Comma-separated via env var.
tls_certMVGC_TLS_CERTstring""Path to PEM-encoded TLS certificate for the listener. Must be paired with tls_key.
tls_keyMVGC_TLS_KEYstring""Path to PEM-encoded TLS private key for the listener. Must be paired with tls_cert.
tls_autoMVGC_TLS_AUTOboolfalseIssue a TLS certificate for the listener from the MITM CA (requires proxy_enabled: true and tls_hostname).
tls_hostnameMVGC_TLS_HOSTNAMEstring""Hostname used in the auto-issued TLS certificate (required when tls_auto: true).
allow_plaintextMVGC_ALLOW_PLAINTEXTboolfalseAllow plain HTTP when binding to a non-loopback address. Required when TLS is handled by a load balancer or ingress controller.
pac_proxy_addrMVGC_PAC_PROXY_ADDRstring""Listen address for the ambient PAC proxy listener (e.g. 127.0.0.1:7081).
pac_proxy_enabled(YAML only)boolfalseEnable the ambient PAC proxy listener. Configure only via YAML.
cors_enabledboolDeprecated. Use cors_origins instead.

database — Postgres connection

YAML keyEnv varTypeDefaultDescription
urlDATABASE_URLstring""Required. Postgres connection string. Format: postgres://user:password@host:port/dbname?sslmode=require
max_open_connsMVGC_DB_MAX_OPEN_CONNSint25Maximum simultaneous open connections to Postgres.
max_idle_connsMVGC_DB_MAX_IDLE_CONNSint10Maximum idle connections retained in the pool.
conn_max_lifetimeMVGC_DB_CONN_MAX_LIFETIMEduration5mMaximum connection lifetime before recycling. Go duration string (e.g. 5m, 1h).

Schema migrations run automatically on startup: no manual step is required.


policies — policy engine

YAML keyEnv varTypeDefaultDescription
dirMVGC_POLICIES_DIRstringconfigs/policiesDirectory containing policy YAML bundle files.
cache_ttlMVGC_POLICY_CACHE_TTLduration5mHow long policy bundles are cached in memory. Stale bundles are served during Control Plane outages.
bundle_idMVGC_BUNDLE_IDstringdefaultPolicy bundle identifier to load from the Control Plane. Self-Hosted Gateway only. Only set this when using a non-default bundle.

records — execution logging

YAML keyEnv varTypeDefaultDescription
log_fileMVGC_RECORD_LOG_FILEstring/tmp/mvgc-records.jsonlPath for the append-only JSONL execution record log. The gateway rotates the file on SIGUSR1 (for use with logrotate).
queue_sizeMVGC_RECORD_QUEUE_SIZEint1000Buffer size for the async record write queue. When full, the gateway returns HTTP 503.
workersMVGC_RECORD_WORKERSint4Background worker threads draining the record write queue.

security — key management

YAML keyEnv varTypeDefaultDescription
key_dirMVGC_KEY_DIRstring./keysDirectory for the node Ed25519 key pair (auto-generated on first start). Protect this directory as you would any secret.
delegation_verify_keyMVGC_DELEGATION_VERIFY_KEYstring""Path to the PEM public key for delegation token verification. Required when using delegation tokens.

control_plane — Control Plane connection

Self-Hosted Gateway only. Leave this section empty for Free Gateway (embedded mode).

Setting addr is what activates CP-connected mode. Without it, all other fields in this section are ignored.

YAML keyEnv varTypeDefaultDescription
addrMVGC_CP_ADDRstring""Control Plane gRPC address. Setting this enables CP-connected mode (e.g. us.cp.axemere.ai:9090).
bootstrap_tokenMVGC_BOOTSTRAP_TOKENstring""One-time registration token from the Axemere console. Used on first connection to provision the node.
ca_certMVGC_CP_CA_CERTstring""Path to the CA certificate PEM for verifying the CP's TLS certificate. Not required for us.cp.axemere.ai (uses a publicly-trusted cert).
node_certMVGC_NODE_CERTstring""Path to the client certificate PEM for mutual TLS (mTLS) node authentication.
node_cert_keyMVGC_NODE_CERT_KEYstring""Path to the client certificate private key (paired with node_cert).
hash_submit_intervalMVGC_HASH_SUBMIT_INTERVALduration10sInterval for retrying pending Merkle hash submissions to the CP.
key_refresh_intervalMVGC_KEY_REFRESH_INTERVALduration5mHow often to refresh signing keys from the CP keyring.
bundle_id(same as policies.bundle_id)stringdefaultAlias: prefer setting policies.bundle_id.
no_tlsMVGC_CP_NO_TLSboolfalseDisable TLS on the CP gRPC connection. Development only.
skip_tls_verifyMVGC_CP_SKIP_TLS_VERIFYboolfalseSkip TLS certificate verification for the CP connection. Development only.

To connect to the Axemere Control Plane:

  1. Sign in to console.axemere.aiGateways+ Enroll Gateway.
  2. Click Generate Token and copy it (this is the value for bootstrap_token) along with your Organization ID.
  3. Set in mvgc.yaml:
gateway:
  org_id: "org_abc123"

control_plane:
  addr: "us.cp.axemere.ai:9090"
  bootstrap_token: "btkn_..."

connectors — upstream HTTP

Controls how the gateway makes outbound calls to AI providers.

YAML keyEnv varTypeDefaultDescription
timeoutMVGC_CONNECTOR_TIMEOUTduration30sTimeout for non-streaming upstream calls. Streaming requests run until the client disconnects.
max_concurrentMVGC_CONNECTOR_MAX_CONCURRENTint50Maximum concurrent outbound connections across all connectors.
http_idle_conn_timeoutMVGC_HTTP_IDLE_CONN_TIMEOUTduration90sHTTP keep-alive idle connection timeout.
credential_cache_ttlMVGC_CREDENTIAL_CACHE_TTLduration5mHow long credentials are cached in memory (CP-connected mode).
allow_generic_httpMVGC_ALLOW_GENERIC_HTTPbooltrueAllow the generic HTTP connector as a fallback for uncatalogued providers. Set to false to restrict outbound calls to known AI provider connectors only.

SSRF protection: The HTTP connector blocks connections to RFC-1918 private ranges, loopback, and link-local addresses by default. To allow specific private hosts (e.g. on-premise model servers), set:

MVGC_HTTP_CONNECTOR_TRUSTED_HOSTS=my-model.internal,gpu-server.corp.example.com

This env var has no YAML equivalent.


risk — anomaly detection

The risk scorer compares current request rate and cost against a rolling baseline. Exceeding a threshold sets a risk signal that policies can evaluate.

YAML keyEnv varTypeDefaultDescription
rate_thresholdMVGC_RISK_RATE_THRESHOLDfloat3.0Request rate spike multiplier. A value of 3.0 means "3× the baseline rate triggers the risk signal."
cost_thresholdMVGC_RISK_COST_THRESHOLDfloat3.0Cost anomaly multiplier. Same interpretation as rate_threshold.
window_sizeMVGC_RISK_WINDOW_SIZEduration5mRolling window for baseline calculation.
business_hoursMVGC_RISK_BUSINESS_HOURSstring""Business hours spec in HH:MM-HH:MM,TZ format (e.g. 09:00-17:00,America/New_York). Requests outside business hours trigger the time_of_day risk signal.

approvals — human-in-the-loop

YAML keyEnv varTypeDefaultDescription
enabledMVGC_APPROVAL_ENABLEDbooltrueWhen true, policies with require_approval return HTTP 202 (pending) and pause execution. When false, require_approval returns HTTP 403 (rejected immediately).
ttlMVGC_APPROVAL_TTLduration24hHow long an approval request remains pending before auto-expiring.

metrics — Prometheus

YAML keyEnv varTypeDefaultDescription
enabledMVGC_METRICS_ENABLEDbooltrueEnable Prometheus metrics at GET /metrics. Exposes mvgc_* business metrics alongside Go runtime metrics.

export — SIEM integration

Push execution events to external destinations in addition to the record log file.

YAML keyEnv varTypeDefaultDescription
webhook_urlMVGC_EXPORT_WEBHOOK_URLstring""HTTPS endpoint to receive execution events as JSON (Splunk HEC, Datadog Logs, custom ingest). Must be http:// or https:// without embedded credentials.
webhook_tokenMVGC_EXPORT_WEBHOOK_TOKENstring""Bearer token sent in the Authorization header for webhook requests.
syslog_addrMVGC_EXPORT_SYSLOG_ADDRstring""Syslog server address. Format: tcp://host:port or udp://host:port.

All three destinations are independent and can be combined. The webhook URL is validated at startup; invalid URLs disable that destination with a warning.


discovery — domain tracking

When enabled, the gateway counts every unique domain passing through the forward proxy and exposes the list via the admin API. Useful for auditing what AI providers developers are reaching before formal configuration.

YAML keyEnv varTypeDefaultDescription
enabledMVGC_DISCOVERY_ENABLEDboolfalseEnable domain discovery mode. Counts are kept in memory and reset on restart.

telemetry — anonymous usage reporting

The gateway sends anonymous aggregate usage statistics to Axemere (active connector count, approximate request volume, version). No execution content or identifiable data is included.

YAML keyEnv varTypeDefaultDescription
enabledMVGC_TELEMETRY_ENABLEDbooltrueEnable anonymous usage telemetry. Set to false to opt out completely.
intervalMVGC_TELEMETRY_INTERVALduration1hHow often to send telemetry reports.

transparent_proxy — MITM forward proxy

Configures the HTTPS MITM interception mode. Requires gateway.proxy_enabled: true (the default).

When managed_domains is non-empty, the gateway intercepts HTTPS CONNECT tunnels to listed domains, applies the full execution pipeline (policy, budget, attribution, records), then re-establishes the upstream TLS connection. All other domains are forwarded as opaque TCP tunnels.

Clients must trust the Axemere proxy CA certificate. Retrieve it from GET /v1/proxy/ca.crt on the gateway.

YAML keyEnv varTypeDefaultDescription
managed_domainsMVGC_MANAGED_DOMAINSlist[]Hostnames and wildcard patterns to intercept (e.g. api.openai.com, *.anthropic.com). Comma-separated via env var.
passthrough_observed_domainsMVGC_PASSTHROUGH_OBSERVED_DOMAINSlist[]Domains that use passthrough-observed mode instead of MITM. Use for cert-pinned hosts you cannot add to the trust store. Comma-separated via env var.
passthrough_idle_timeoutMVGC_PASSTHROUGH_IDLE_TIMEOUTduration120sFires an interim execution record when no bytes travel in either direction for this duration (passthrough-observed mode).
passthrough_max_intervalMVGC_PASSTHROUGH_MAX_INTERVALduration10mFires an interim execution record unconditionally at this interval (passthrough-observed mode).
default_workload_id(YAML only)string""Workload ID for CONNECT tunnel attribution when no provider_defaults entry matches. Overrides gateway.default_workload_id for transparent-proxy traffic.
provider_defaults(YAML only)map{}Per-provider workload and project attribution for CONNECT tunnels. See example below.

provider_defaults example

transparent_proxy:
  managed_domains:
    - api.openai.com
    - api.anthropic.com

  provider_defaults:
    api.openai.com:
      workload_id: "wl_openai-prod"
      project_id:  "prj_backend-team"
    api.anthropic.com:
      workload_id: "wl_anthropic-prod"
      project_id:  "prj_data-science"

CA certificate management

The MITM CA key and certificate are stored in MVGC_DATA_DIR (default: ~/.config/mvgc-gateway/) as ca.key and ca.crt. They are auto-generated on first start. To use an existing CA:

Env varDescription
MVGC_DATA_DIRData directory for auto-generated CA files (default: ~/.config/mvgc-gateway/).
MVGC_PROXY_CA_KEYPath to an existing CA private key PEM. Disables auto-generation.
MVGC_PROXY_CA_CERTPath to an existing CA certificate PEM. Disables auto-generation.
MVGC_PROXY_CA_KEY_TYPEKey algorithm: ecdsa (P-256, default) or rsa (2048-bit).
MVGC_PROXY_LEAF_CERT_TTLTTL for dynamically issued leaf certificates (default: 24h).

env — environment variable injection

The env map injects key-value pairs into the process environment at startup. Entries are applied only when the variable is not already set; existing environment variables always win.

env:
  DATABASE_URL: "postgres://mvgc:secret@db:5432/mvgc?sslmode=require"
  OPENAI_API_KEY: "sk-..."

This is equivalent to setting those variables in the system environment. Use it to consolidate all gateway configuration in a single YAML file without needing a separate .env file or service manager EnvironmentFile.


Env-only settings

These settings have no YAML equivalent and can only be configured via environment variable.

Env varDefaultDescription
MVGC_CONFIGPath to the mvgc.yaml config file. Overrides all automatic search paths.
MVGC_ENV_FILE.envPath to a .env file to load before all other configuration.
MVGC_CP_TOKEN""Bearer token for Control Plane admin gRPC authentication. Set only when the CP runs with MVGC_CP_ADMIN_TOKEN. Self-Hosted Gateway only.
MVGC_KEYS_SECRET_NAMEmvgc-gateway-keysCloud secret name for the gateway key pair (used in cloud deployments).
MVGC_HTTP_CONNECTOR_TRUSTED_HOSTS""Comma-separated hostnames that bypass SSRF private-IP checks. Use for on-premise model servers.
MVGC_CUSTOM_CONNECTORS_FILE""Path to a custom connectors YAML file. Reloaded automatically on SIGHUP.
MVGC_REDIS_ADDR""Redis connection URL for distributed budget enforcement across multiple gateway instances (e.g. redis://host:6379). When empty, budget enforcement is gateway-local only.
MVGC_ALERT_POLL_INTERVAL60mHow often the gateway polls for budget threshold alerts. Set to 0 to disable.
RESEND_API_KEY""Resend transactional email API key for email alert channels. When empty, email alerts are skipped with a warning.
MVGC_PUBLIC_URL""Externally reachable gateway URL (e.g. https://gw.example.com). Used to build unsubscribe links in email alerts.

Complete example

# mvgc.yaml — complete Self-Hosted Gateway example
# Load order: env var > this file > built-in defaults
# Secrets can remain as environment variables; they override file values.

gateway:
  listen_addr: ":7080"                  # bind all interfaces
  node_id:     "node-prod-01"
  # org_id: set via MVGC_ORG_ID env var
  # admin_token: set via MVGC_ADMIN_TOKEN env var
  proxy_enabled: true
  cors_origins:
    - "https://app.example.com"
  default_workload_id: "wl_default"
  credentials_dir: "/etc/mvgc/credentials"

database:
  # url: set via DATABASE_URL env var
  max_open_conns: 25
  max_idle_conns:  10

policies:
  dir:     "/etc/mvgc/policies"
  cache_ttl: "5m"

records:
  log_file:   "/var/log/mvgc/records.jsonl"
  queue_size: 2000
  workers:    8

security:
  key_dir: "/var/lib/mvgc/keys"

control_plane:
  addr: "us.cp.axemere.ai:9090"
  # bootstrap_token: set via MVGC_BOOTSTRAP_TOKEN env var (one-time, remove after first start)
  hash_submit_interval: "10s"
  key_refresh_interval: "5m"

connectors:
  timeout:         "30s"
  max_concurrent:  50
  allow_generic_http: false   # restrict to catalogued AI providers only

risk:
  rate_threshold: 3.0
  cost_threshold: 3.0
  window_size:    "5m"
  business_hours: "09:00-18:00,America/New_York"

approvals:
  enabled: true
  ttl:     "24h"

metrics:
  enabled: true

export:
  webhook_url:   "https://siem.example.com/ingest"
  # webhook_token: set via MVGC_EXPORT_WEBHOOK_TOKEN env var

discovery:
  enabled: false

telemetry:
  enabled:  true
  interval: "1h"

transparent_proxy:
  managed_domains:
    - api.openai.com
    - api.anthropic.com
    - generativelanguage.googleapis.com
  provider_defaults:
    api.openai.com:
      workload_id: "wl_openai"
    api.anthropic.com:
      workload_id: "wl_anthropic"

env:
  # Inject additional environment variables that this file makes available
  # to the gateway process. Existing env vars (set by the shell or service
  # manager) always win; these are applied only when the variable is unset.
  OPENAI_API_KEY: "sk-..."

Minimal Free Gateway example (no Control Plane):

gateway:
  listen_addr: "127.0.0.1:7080"
  node_id:     "node-dev"
  # admin_token: set via MVGC_ADMIN_TOKEN env var

database:
  # url: set via DATABASE_URL env var

transparent_proxy:
  managed_domains:
    - api.openai.com
    - api.anthropic.com