Configuration Reference
This reference lists every configuration field of Mitrity Gateway and Mitrity MCP Sidecar, with its type and default, and the environment variables that override the core fields.
Both binaries read a YAML config file. Pass the path of the file with the --config flag:
mitrity-gateway --config /etc/mitrity/mitrity-gateway.yaml
mitrity-mcp-sidecar --config /path/to/mitrity-mcp-sidecar.yaml
The gateway binary is mitrity-gateway in its image and in the Helm chart, and mitrity-mcp-gateway as published for download. The Deployment Guide installs the download under that name. The commands on this page work the same under either name.
Mitrity Gateway Fields
Mitrity Gateway reads its configuration from mitrity-gateway.yaml.
Core
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
gateway_id | string | Yes | -- | Unique identifier for this gateway instance. Shown in audit logs and the dashboard |
api_key | string | Yes | -- | API key from the MITRITY dashboard (Settings > API Keys) |
control_plane.base_url | string | Yes | -- | URL of the MITRITY control plane (https://api.mitrity.com) |
Upstreams
Define the MCP servers that the gateway aggregates tools from.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
upstreams[] | list | Yes | -- | List of upstream MCP server definitions |
upstreams[].name | string | Yes | -- | Human-readable name for this upstream (e.g., filesystem, database) |
upstreams[].command | string | Yes | -- | Path to the upstream MCP server binary |
upstreams[].args | list of strings | No | [] | Arguments to pass to the upstream MCP server command |
upstreams[].env | map | No | {} | Environment variables to set for the upstream process |
upstreams:
- name: "filesystem"
command: "/usr/local/bin/mcp-filesystem"
args: ["--root", "/data"]
- name: "database"
command: "/usr/local/bin/mcp-postgres"
args: ["--connection-string", "postgres://..."]
Native Tools
Define HTTP API endpoints as tools, next to the MCP upstreams.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
native_tools[] | list | No | [] | List of native HTTP API tool definitions |
native_tools[].name | string | Yes | -- | Tool name exposed to agents |
native_tools[].description | string | No | -- | Human-readable description of the tool |
native_tools[].method | string | Yes | -- | HTTP method (GET, POST, PUT, DELETE) |
native_tools[].url | string | Yes | -- | Target URL for the HTTP request |
native_tools[].headers | map | No | {} | Static headers to include with every request |
native_tools:
- name: "get_weather"
description: "Get current weather for a location"
method: "GET"
url: "https://api.weather.example.com/current"
headers:
Authorization: "Bearer ${WEATHER_API_KEY}"
Credentials
Credential definitions for upstream authentication. The gateway holds the credentials and never shares them with agents.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
credentials | map | No | {} | Named credential definitions referenced by upstreams and native tools |
credentials:
weather_api:
type: "api_key"
value: "${WEATHER_API_KEY}"
database:
type: "connection_string"
value: "${DATABASE_URL}"
Governed shell (exec)
The exec block enables the gateway's first-party sandboxed shell: the shell__execute tool (action type shell:execute). This table is the key reference. The design, the policy knobs, the sandbox modes and the egress allowlist are on the Governed Shell page.
The gateway validates the block at boot, exactly as it validates upstreams. With an invalid block, the gateway refuses to start, and mitrity-gateway doctor names the field.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
exec.enabled | boolean | No | false | Serve shell__execute (evaluated as shell:execute). When false the tool is absent from tools/list. Refused on Windows and on a host with no shell (the distroless image) |
exec.shell | string | When enabled | -- | Absolute path; the basename must be bash or sh; must exist and be executable. No shell metacharacters |
exec.default_cwd | string | When enabled | -- | Absolute, existing directory. The working directory when a call names none, and the single writable root when the policy's workspace_roots is empty |
exec.sandbox.backend | string | No | auto | auto, bubblewrap (Linux), seatbelt (macOS) or none. none is honoured only when the policy says sandbox_required: false |
exec.sandbox.bwrap_path | string | No | bwrap on PATH | Linux: the bubblewrap binary, version 0.5.0 or newer |
exec.sandbox.seccomp | string | No | required | Linux: required (no filter means no sandbox), preferred (run as bubblewrap_no_seccomp, notified) or off |
exec.sandbox.tmpfs_size_bytes | integer | No | 268435456 | Cap on the private tmpfs (bubblewrap 0.7.0 or newer); 16 MiB to 4 GiB |
exec.sandbox.settings_file | string | No | -- | A sandbox-runtime settings document, applied as narrowing only. Keys that would widen the sandbox are boot errors |
exec.sandbox.deny_read | string[] | No | [] | Extra deny-read paths on top of the mandatory set |
exec.sandbox.allow_unix_sockets | string[] | No | [] | macOS only; each path is recorded on the event as a relaxation |
exec.limits.max_timeout_seconds | integer | No | 3600 | Ceiling over the policy's exec_timeout_seconds; 1 to 3600 |
exec.limits.stdout_max_bytes / stderr_max_bytes | integer | No | 1048576 | Retained bytes per stream; 4 KiB to 16 MiB. The rest is read and discarded, and the total produced is still recorded |
exec.limits.stdin_max_bytes | integer | No | 1048576 | 0 (stdin refused) to 16 MiB |
exec.limits.max_pids | integer | No | 256 | Process cap: cgroup pids.max when delegated, else RLIMIT_NPROC |
exec.limits.max_file_bytes | integer | No | 268435456 | RLIMIT_FSIZE, per file; at least 1 MiB |
exec.limits.memory_max_bytes | integer | No | 0 | 0 = unbounded; a positive value needs a delegated cgroup v2 |
exec.limits.max_concurrent | integer | No | 4 | Concurrent executions per gateway; an excess call fails to start with concurrency_limit |
exec.egress.allowed_ports | integer[] | No | [443, 80] | Ports an allowlist entry without a :port suffix may reach |
exec.egress.denied_addresses | string[] | No | [] | Extra CIDRs an allowed name must not resolve to |
exec.env.inherit | string[] | No | [PATH, HOME, LANG, "LC_*", TZ, TERM] | Names copied from the gateway's environment |
exec.env.set | map | No | PATH (system default), TERM=dumb | Fixed values; PATH here is the sandbox PATH |
exec.env.agent_settable | string[] | No | [] | Keys the tool's env argument may set. Never PATH, HOME, TMPDIR or any name on the refused list (LD_*, DYLD_*, BASH_ENV, *_PROXY, MITRITY_*, …) |
exec.credentials.env | map | No | -- | NAME: "${credential:<id>}", injected into every execution by an agent holding the grant |
exec.credentials.files[] | list | No | -- | {id, path, format, mode}, materialised under $MITRITY_CRED_DIR for every execution. path is relative with no ..; format is one of raw, json, dotenv, kv; mode defaults to 0400 and is at most 0600 |
Logging
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
logging.level | string | No | info | Log verbosity: debug, info, warn, error |
logging.format | string | No | json | Log output format: json or text |
Cache
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
cache.profile_ttl | duration | No | 5m | How long to cache mission profiles locally before re-fetching from the control plane |
cache.max_entries | integer | No | 1000 | Maximum number of cached mission profiles |
Full Mitrity Gateway config example
gateway_id: "gateway-001"
api_key: "sk-..."
control_plane:
base_url: "https://api.mitrity.com"
upstreams:
- name: "filesystem"
command: "/usr/local/bin/mcp-filesystem"
args: ["--root", "/data"]
- name: "database"
command: "/usr/local/bin/mcp-postgres"
args: ["--connection-string", "${DATABASE_URL}"]
native_tools:
- name: "get_weather"
description: "Get current weather for a location"
method: "GET"
url: "https://api.weather.example.com/current"
headers:
Authorization: "Bearer ${WEATHER_API_KEY}"
credentials:
weather_api:
type: "api_key"
value: "${WEATHER_API_KEY}"
logging:
level: "info"
format: "json"
cache:
profile_ttl: "5m"
max_entries: 1000
Mitrity MCP Sidecar Fields
Mitrity MCP Sidecar reads its configuration from mitrity-mcp-sidecar.yaml.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
api_key | string | Yes | -- | API key from the MITRITY dashboard (Settings > API Keys) |
control_plane.base_url | string | Yes | -- | URL of the MITRITY control plane (https://api.mitrity.com) |
upstream_command | string | Yes | -- | Path to the upstream MCP server binary that the sidecar will wrap |
upstream_args | list of strings | No | [] | Arguments to pass to the upstream MCP server command |
agent_id | string | Yes | -- | Identifier for the agent using this sidecar. Appears in audit logs and enables per-agent governance |
logging.level | string | No | info | Log verbosity: debug, info, warn, error |
logging.format | string | No | json | Log output format: json or text |
cache.profile_ttl | duration | No | 5m | How long to cache mission profiles locally before re-fetching from the control plane |
cache.max_entries | integer | No | 1000 | Maximum number of cached mission profiles |
The sidecar launches the upstream MCP server as a child process and talks to it over stdio. It intercepts tools/call JSON-RPC 2.0 requests from the MCP client and evaluates them against your governance policies. It forwards allowed calls to the upstream server, and returns a JSON-RPC error for denied calls.
Full Mitrity MCP Sidecar config example
api_key: "sk-..."
control_plane:
base_url: "https://api.mitrity.com"
upstream_command: "/usr/local/bin/some-mcp-server"
upstream_args: ["--mode", "stdio"]
agent_id: "my-agent"
logging:
level: "info"
format: "json"
cache:
profile_ttl: "5m"
max_entries: 1000
Environment Variable Overrides
You can override the core configuration fields with environment variables. An environment variable takes precedence over the value in the YAML config file.
Mitrity Gateway
| Environment Variable | Config Field | Description |
|---|---|---|
MITRITY_GATEWAY_ID | gateway_id | Gateway instance identifier |
MITRITY_GATEWAY_API_KEY | api_key | API key for control plane authentication |
MITRITY_GATEWAY_CONTROL_PLANE_URL | control_plane.base_url | Control plane URL |
MITRITY_GATEWAY_LOG_LEVEL | logging.level | Log verbosity |
MITRITY_GATEWAY_LOG_FORMAT | logging.format | Log output format |
Mitrity MCP Sidecar
| Environment Variable | Config Field | Description |
|---|---|---|
MITRITY_MCP_AGENT_ID | agent_id | Agent identifier for this sidecar |
MITRITY_MCP_API_KEY | api_key | API key for control plane authentication |
MITRITY_MCP_CONTROL_PLANE_URL | control_plane.base_url | Control plane URL |
MITRITY_MCP_LOG_LEVEL | logging.level | Log verbosity |
MITRITY_MCP_LOG_FORMAT | logging.format | Log output format |
Environment variable overrides are useful for injecting secrets in containerized deployments, without writing them to the config file. Both binaries are stdio MCP servers launched by the agent's MCP client. So the variables belong on the process that spawns them, which is the agent's container:
docker run -it \
-e MITRITY_GATEWAY_API_KEY=sk-your-key \
-v /path/to/mitrity-gateway.yaml:/etc/mitrity/config.yaml \
your-agent-image
The agent then launches mitrity-mcp-gateway --config /etc/mitrity/config.yaml from inside that container, and the gateway inherits the environment. The deployment guide explains why a detached gateway container is not a supported topology.
Related Documentation
- Integration Modes: an overview of Mitrity Gateway and Mitrity MCP Sidecar
- Deployment Guide: installation and deployment options
- Governance Coverage: what the configured binaries govern, and what they do not
- Writing Policies: how to write governance policies