# Configuration

Godelgate reads one YAML file, `godelgate.yaml` by default (set `GODELGATE_CONFIG` to change it). Every `${VAR}` in the file is replaced with that environment variable before parsing; unset variables become empty. The file is read once at startup.

## Full example

```yaml
servers:
  - name: github
    command: npx
    args: [-y, "@modelcontextprotocol/server-github"]
    env: { GITHUB_PERSONAL_ACCESS_TOKEN: "${GITHUB_TOKEN}" }
    labels:
      "get_*": [private]
      "search_*": [untrusted]
      "create_*": [egress]
  - name: docs
    url: https://mcp.example.com/mcp
    headers: { Authorization: "Bearer ${DOCS_TOKEN}" }
  - name: acme
    builtin: demo

users:
  - name: alice
    key: ${ALICE_KEY}
    groups: [engineering]

policy:
  default: allow
  trifecta: block
  approvalTimeoutSeconds: 300
  rules:
    - tool: "github__delete_*"
      action: approve
      reason: "deleting things needs a human"

admin:
  token: ${GODELGATE_ADMIN_TOKEN}

demo:
  public: false
```

## `servers[]`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | string | required | `a-z`, `0-9` and `-`; unique. Tool prefix. |
| `command` | string | | Start a local stdio server |
| `args` | string[] | `[]` | Arguments for `command` |
| `env` | map | `{}` | Extra environment for `command` |
| `url` | URL | | Remote Streamable HTTP server |
| `headers` | map | `{}` | Headers for `url` requests |
| `builtin` | `demo` | | Built-in demo server |
| `labels` | map of glob → labels | `{}` | Labels: `private`, `untrusted`, `egress` |
| `autoLabels` | `{read, write}` | | Labels for tools no pattern matches, chosen by the tool's `readOnlyHint` |
| `openapi` | `{spec, baseUrl?}` | | A REST API from its OpenAPI document; see [REST APIs](/docs/openapi) |
| `isolation.docker` | `{image, network, memory, cpus}` | | Run a `command` server in a locked-down container; see [Isolated local servers](/docs/isolation) |

Each server needs exactly one of `command`, `url`, `openapi` or `builtin`. See [MCP servers](/docs/mcp-servers).

## `users[]`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | string | required | Name in the audit log |
| `key` | string | required | Bearer key, at least 16 characters |
| `groups` | string[] | `[]` | Groups for rules |

See [Users and keys](/docs/users-and-keys).

## `policy`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `default` | `allow` \| `deny` \| `approve` | `allow` | Decision when no rule matches |
| `trifecta` | `block` \| `approve` \| `off` | `block` | What to do when a call completes the trifecta |
| `approvalTimeoutSeconds` | integer | `300` | How long an approval can wait |
| `rules[].tool` | glob | required | Matches `server__tool` |
| `rules[].action` | `allow` \| `deny` \| `approve` | required | |
| `rules[].groups` | string[] | everyone | Limit the rule to these groups |
| `rules[].when` | `{arg, op, value}[]` | | Conditions on the call's arguments; see [Policy rules](/docs/policy#conditions-on-arguments) |
| `rules[].reason` | string | | Shown to the agent and logged |
| `dlp.redactResults` | `secrets` \| `secrets_and_pii` \| `off` | `secrets` | What to hide in tool results; see [Data protection](/docs/data-protection) |
| `dlp.blockSecretsInArgs` | boolean | `true` | Deny calls whose arguments contain a secret |

See [Policy rules](/docs/policy) and [Lethal-trifecta containment](/docs/trifecta).

## `admin`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `token` | string | `GODELGATE_ADMIN_TOKEN`, else random | Token for `/app` and `/api/*`. A random token is printed at startup if none is set. |

## `demo`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `public` | boolean | `false` | Serve the unauthenticated attack demo at `POST /api/demo`, rate-limited to 10 runs per minute per IP. It uses its own in-memory gate. |

## `cloud`

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | `false` | Turn on public sign-up at `/signup` and Cloud workspaces. Leave it off for a private self-hosted gate. |
| `publicUrl` | URL | | Where people reach the gate, for OAuth sign-ins to servers. `GODELGATE_PUBLIC_URL` overrides it. |
| `passwords` | boolean | `true` | Allow email and password sign-up and sign-in. Set `false` to make Google the only way in; it stays on if Google sign-in isn't set up. |

## Validation

Godelgate refuses to start, and prints the problem, if the file is invalid: an unknown action, a key shorter than 16 characters, a server with zero or several of `command`/`url`/`builtin`, or a duplicate server name.
