> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MDM configuration reference

> Every mdm.toml field, tfy-local-ai-setup CLI flag, client version requirement, and file path for MDM rollouts to the TrueFoundry AI Gateway, with defaults and accepted values.

This page lists every option for an [MDM rollout](https://www.truefoundry.com/docs/ai-gateway/mdm-setup.md). The overview's [`mdm.toml` template](https://www.truefoundry.com/docs/ai-gateway/mdm-setup#deploy-to-a-pilot-device) contains most fields on this page, commented out, ready to uncomment; the rest are under [Additional agent options](#fields). For guidance on when to use them, see the overview, [Claude Code and Claude Desktop](https://www.truefoundry.com/docs/ai-gateway/mdm/claude.md), and [Codex](https://www.truefoundry.com/docs/ai-gateway/mdm/codex.md).

## File format

Pass the file to the binary with `--config=/absolute/path/mdm.toml`.

* The format follows the file extension: `.json` is read as JSON, `.yaml` and `.yml` are rejected, and anything else is read as TOML.
* Unknown keys fail validation, except inside `agents.claude-code.managed_settings`, which follows Claude Code's own schema.
* Explicit CLI flags override the matching file values.
* Never put tokens, refresh tokens, or client secrets in the file.

This file is separate from personal setup's `~/.tf/config.toml` and from the `agents-policy.json` file that the binary generates.

## Fields

> [accordion] Connection and sign-in
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `control_plane_url` | String; required | HTTPS TrueFoundry control-plane URL, the address of your TrueFoundry console |
> | `tenant_name` | String; required | Your tenant name |
> | `gateway_url` | String; required | Gateway base URL, including any path such as `/api/llm` |
> | `auth.mode` | String; `"api-key"` | `"api-key"` for per-employee device login, or `"oidc"` |
> | `auth.oidc.issuer` | String; required for OIDC | Exact HTTPS OIDC issuer |
> | `auth.oidc.client_id` | String; required for OIDC | Public client ID. No client secret |
> | `agents.<id>.auth` | String; inherits `auth.mode` | `"api-key"` or `"oidc"`. Claude Code, Codex, and Claude Desktop can differ; all other agents must use the same mode |

> [accordion] Agents and models
>
> Each `[agents.<id>]` table deploys that agent. For the IDs, see [Supported agents](https://www.truefoundry.com/docs/ai-gateway/mdm-setup.md#supported-agents).
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `agents.claude-code.models.opus`, `.sonnet`, `.haiku` | Strings | Gateway model for each Claude tier. Defaults: `claude-code/claude-opus`, `claude-code/claude-sonnet`, `claude-code/claude-haiku`. Add `[1m]` to request 1M context from a model that supports it |
> | `agents.claude-desktop.models.opus`, `.sonnet`, `.haiku` | Strings; inherit Claude Code's | Desktop tier models |
> | `agents.codex.model` | String; required | Codex's default model. Use a Virtual Model with a bare OpenAI slug, such as `gpt-5.4` |
> | `agents.codex.auth_mode` | String; `"api-key"` | `"chatgpt-subscription"` bills ChatGPT Business or Enterprise seats: it sends the TrueFoundry credential in `x-tfy-api-key` and turns on ChatGPT sign-in in Codex. Requires `api-key` auth |
> | `agents.<id>.models` | String array; required | Gateway models offered by OpenCode, Qwen Code, Gemini CLI, Grok Build, Pi, GitHub Copilot CLI, Goose, or VS Code. Must not be empty |
> | `agents.<id>.default_model` | String; first in `models` | The model the agent starts with. Must be in `models` |
>
> **How agent tables work:**
>
> * **A table deploys the agent.** At least one agent table is required, and agents are never detected automatically. To stop managing an agent, delete its table.
> * **Before installation:** Claude Code, Codex, Claude Desktop, and agents with managed settings (OpenCode, Qwen Code, Gemini CLI's managed file, and Grok Build on macOS and Linux) are configured even before they are installed. Agents configured through user settings are configured on the first run after installation.
> * **Cursor monitoring only:** add `[agents.cursor]` with `mcp_servers = []` and `skills = []`.

> [accordion] MCP servers and Skills
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `mcp_servers` | String array; `[]` | `["@all"]`: every usable server each employee can access, checked again on every run; needs an existing sign-in. A list: gateway registry names, matching `^[A-Za-z0-9_-]+$`; each becomes `<gateway>/<tenant>/mcp/<name>/server`. `[]`: none. `"@all"` cannot be combined with names, `--mcp-server`, or `--no-mcp` |
> | `skills` | String array; `[]` | `["@all"]`: every published Skill each employee can access, at its latest version. A list: `[repo/]name[:version]` references; pin a version or follow the latest. `[]`: none. `"@all"` cannot be combined with names, `--skill`, or `--no-skills` |
> | `agents.<id>.mcp_servers`, `agents.<id>.skills` | String arrays | Replace the shared selection for that agent. Omitted: inherit. `[]`: deploy nothing. `"@all"` is not accepted here |
>
> Custom (non-registry) MCP servers are not applied in MDM rollouts. Register them in the gateway and use their registry names.

> [accordion] Claude Code policy and gateway overrides
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `agents.claude-code.managed_settings` | Table; optional | Claude Code's managed-settings schema. Replaces the existing policy or the built-in baseline. Only Claude Code supports an inline table |
> | `agents.claude-code.gateway` | Optional HTTPS URL | Gateway for Claude Code only. Default: `gateway_url` |
> | `agents.codex.gateway` | Optional HTTPS URL | Gateway for Codex only. Default: `gateway_url` |
> | `agents.claude-desktop.gateway` | Optional HTTPS URL | Gateway for Claude Desktop only. Default: `gateway_url` |
>
> For the Claude Code policy, see [Set the Claude Code policy](https://www.truefoundry.com/docs/ai-gateway/mdm/claude.md#set-the-claude-code-policy). For a Codex template, use the `--codex-settings-file` flag. On Windows it applies only to `config.toml`, not `requirements.toml`.

> [accordion] Claude Desktop
>
> All fields are under `agents.claude-desktop`.
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `tool_search_enabled` | Optional boolean | Turn tool search on or off. Omitted: the app's default |
> | `prefer_1m_context` | Optional boolean | Desktop's global 1M context preference |
> | `context.<tier>.supports_1m` | Optional boolean | Declare 1M support for `opus`, `sonnet`, or `haiku` |
> | `context.<tier>.prefer_1m` | Optional boolean | Prefer 1M for that tier. Requires `supports_1m = true` |
> | `history_import.enabled` | Boolean; `false` | Allow claude.ai history import. The other `history_import` fields apply only when this is `true` |
> | `history_import.encoding` | String; `"json-string"` | macOS preference encoding: `"json-string"` or `"native-dict"`. Windows always uses JSON |
> | `history_import.export_enabled` | Boolean; `true` | Show **Export** |
> | `history_import.banner_behavior` | String; `"detect"` | `"off"`, `"detect"`, or `"show"` |
> | `history_import.automatic_3p` | Boolean; `false` | Beta. Import earlier third-party sessions without asking. Also requires `deploymentOrganizationUuid`, which this tool does not set |
>
> Desktop inference headers use the `--desktop-header` flag; a `headers` key fails validation.

> [accordion] Prompt blocking
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `restrictions.blocked_agents` | String array; optional | Agents whose prompts are blocked: `claude-code`, `codex`, or `cursor`. `[]` removes every block. Omitted: keep the blocks from the last run |
> | `restrictions.message` | Optional string | Message shown when a prompt is blocked. Default: "Your organization has disabled this application. Please use an approved alternative or contact your administrator." |

> [accordion] Cursor monitoring
>
> | Field | Type and default | Meaning |
> | - | - | - |
> | `monitoring.cursor.enabled` | Boolean; `false` | Install Cursor activity-monitoring hooks. `false` or an omitted table removes hooks this tool installed |
> | `monitoring.cursor.require_login` | Boolean; `false` | Block Cursor agent prompts and tool and MCP calls when no credential is available. Has no effect unless monitoring is enabled |

> [accordion] Additional agent options
>
> These keys go in an agent's `[agents.<id>]` table. Set only the keys an agent supports; others fail validation.
>
> | Agent | Extra keys | Accepted `api` values |
> | - | - | - |
> | OpenCode | `headers`, `gateway_only`, `context_window`, `max_tokens` | |
> | Qwen Code | `headers`, `api`, `context_window` | `chat-completions`, `responses` |
> | Grok Build | `headers`, `api`, `context_window`, `max_tokens` | `chat_completions`, `responses`, `messages` |
> | Pi | `headers`, `api`, `context_window`, `max_tokens` | `openai-completions`, `openai-responses`, `anthropic-messages` |
> | Gemini CLI | `headers`, `provider_account` | |
> | GitHub Copilot CLI | `headers`, `api`, `context_window`, `max_tokens` | `completions`, `responses` |
> | Goose | `headers`, `context_window` | |
> | VS Code | `headers`, `api`, `utility_model`, `insiders`, `context_window`, `max_tokens` | `chat-completions`, `responses`, `messages` |
>
> * **`headers`:** extra request headers, as an array of `"Name: Value"` strings, for example to tag requests in Request Logs.
> * **`gateway_only`** (OpenCode): `true` hides every other provider, so employees can pick only gateway models. Default: `false`.
> * **`utility_model`** (VS Code): the model VS Code uses for background tasks such as titles and summaries. `"mainAgent"` (default) uses the gateway model in use, `"copilot"` uses GitHub Copilot's model, and `"none"` turns these tasks off.
> * **`api`:** the API the agent uses to call the gateway. The default, the first value in each row, works for most gateway models. Choose `responses` (`openai-responses` in Pi) for OpenAI models that are served only through the Responses API, and `messages` (`anthropic-messages` in Pi) to call Claude models through the Anthropic Messages API.
> * **`context_window` and `max_tokens`:** the context window and the largest reply, in tokens, that the agent assumes. Under MDM, one value applies to every model of that agent, and the defaults are 128000 and 16384; MDM runs do not read each model's own limits. Set them when your models have a smaller context window than 128000, or when you want longer replies than 16384 tokens.
> * **`provider_account`** (Gemini CLI): the gateway's Gemini provider account. When set, Gemini CLI calls Gemini models through the native Gemini API at `<gateway>/gemini/<account>/proxy`.
> * **`insiders`** (VS Code): `true` configures VS Code Insiders instead of VS Code. Default: `false`.

## Older file layout

Files written for earlier releases, with `url`, `tenant`, and `tools`, still work. The binary reads a file in the current layout when it contains `control_plane_url`; the two layouts cannot be mixed in one file.

| Older layout | Current layout |
| - | - |
| `url`, `tenant`, `gateway` | `control_plane_url`, `tenant_name`, `gateway_url` |
| `tools = ["claude-code", "codex"]` | An `[agents.claude-code]` and an `[agents.codex]` table |
| `[defaults]` `models`, `default_model` | `models` and `default_model` in each agent's table |
| `[mcp]` `servers = [...]`, `discovery = "all-accessible"` | `mcp_servers = [...]`, `mcp_servers = ["@all"]` |
| `[skills]` `names = [...]`, `discovery = "all-accessible"` | `skills = [...]`, `skills = ["@all"]` |
| `agents.claude-code.opus_model`, `sonnet_model`, `haiku_model` | `agents.claude-code.models.opus`, `.sonnet`, `.haiku`. The same for Claude Desktop |

## CLI flags

Keep routine configuration in the TOML file. Add these flags to the binary's command in your script when needed:

| Flag | Purpose |
| - | - |
| `--config` | Path to `mdm.toml`. Cannot be combined with the older `--agents-config` input |
| `--dry-run` | Print changes without writing managed files. Can still sign the employee in, and its output can contain credentials |
| `--log-file`, `--debug` | Append to a log file; add diagnostic output |
| `--settings-file` | Claude Code policy as a JSON file. If the path cannot be read, the built-in baseline is used |
| `--codex-settings-file` | Codex template as a TOML file |
| `--desktop-header='Name: Value'` | Add a Claude Desktop inference header. Repeatable |
| `--force-login-org=<UUID>` | Restrict Claude Desktop sign-in to a Claude organization. Repeatable |
| `--disable-deployment-mode-chooser` | With Desktop OIDC, stop employees from switching to a personal Claude.ai profile |
| `--claude-desktop-allow-local-mcp=false` | Block employees' local (stdio) MCP servers in Claude Desktop |
| `--oidc-scopes`, `--oidc-bearer-token-type` | Claude Desktop OIDC values. Keep the defaults for TrueFoundry |
| `--wsl` | Also configure Claude Code and Codex in the employee's WSL distributions. See [WSL](https://www.truefoundry.com/docs/ai-gateway/mdm-setup.md#windows-subsystem-for-linux) |
| `--block-agent=claude-code,codex,cursor`, `--block-message="..."` | Add agents to the `[restrictions]` list, or replace its message. Persists across runs |
| `--unblock-agent=cursor` | Remove an agent from the blocked list |
| `--refresh-token-file`, `--access-token-file` | Override the employee's device-login token cache paths |

Prompt blocks stop new submissions, not launching the app, manual edits, or Cursor Tab completions, and native Windows hooks do not cover WSL.

## Client version requirements

| Agent | Feature | Minimum version |
| - | - | - |
| Claude Code | Managed MCP servers (`managedMcpServers`) | 2.1.259 |
| Claude Code | Prompt blocks that fail closed | 2.1.295 |
| Claude Desktop | Managed MCP connectors | 1.2581.0 |
| Claude Desktop | Tool search | 1.21459.0 |
| Claude Desktop | History import | 1.10628.0 |
| Claude Desktop | OIDC sign-in (`external-idp`) | 2.7032.0 |
| Codex on Windows | Enforcement through `requirements.toml` | 0.156.0 |

Older versions ignore the setting, and Codex on Windows falls back to `config.toml`, which employees can override.

## Files written

> [accordion] Managed files (locked, administrator-only)
>
> | Item | macOS | Linux | Windows |
> | - | - | - | - |
> | Organization policy and state | `/Library/Application Support/TrueFoundry/` | `/etc/truefoundry/` | `%ProgramFiles%\TrueFoundry\` |
> | Claude Code | `/Library/Application Support/ClaudeCode/managed-settings.json` | `/etc/claude-code/managed-settings.json` | `C:\Program Files\ClaudeCode\managed-settings.json` |
> | Codex | `/etc/codex/managed_config.toml` | `/etc/codex/managed_config.toml` | `%ProgramData%\OpenAI\Codex\requirements.toml` and `config.toml` |
> | Codex hooks | `/etc/codex/hooks.json` | `/etc/codex/hooks.json` | `%ProgramData%\OpenAI\Codex\hooks.json` |
> | Claude Desktop | `/Library/Managed Preferences/<user>/com.anthropic.claudefordesktop.plist` | Not supported | `HKLM\SOFTWARE\Policies\Claude` |
> | Cursor hooks | `/Library/Application Support/Cursor/hooks.json` | `/etc/cursor/hooks.json` | `%ProgramData%\Cursor\hooks.json` |
> | OpenCode | `/Library/Application Support/opencode/` | `/etc/opencode/` | `%ProgramData%\opencode\` |
> | Qwen Code | `/Library/Application Support/QwenCode/settings.json` | `/etc/qwen-code/` | `%ProgramData%\qwen-code\` |
> | Gemini CLI | `/Library/Application Support/GeminiCli/settings.json` | `/etc/gemini-cli/` | `%ProgramData%\gemini-cli\` |
> | Grok Build | `/etc/grok/requirements.toml` and `managed_config.toml` | `/etc/grok/requirements.toml` and `managed_config.toml` | User configuration only |
>
> The organization policy directory holds `agents-policy.json` (configuration, never credentials), `agents-state.json`, `cursor-monitoring.json`, and, for prompt blocks, `agent-blocking.json` with its `tfy-agent-blocking.sh` or `.ps1` script.

> [accordion] Employee files
>
> | File | Contents |
> | - | - |
> | `~/.tf/refresh-token`, `~/.tf/access-token` | Device-login credentials |
> | `~/.tf/oidc-*` | OIDC credentials |
> | `~/.tf/locks/` | Lock files that keep concurrent token refreshes from conflicting |
> | `~/.tf/mdm-user.json` | Record of user settings and Skills this tool applied |
> | `~/.claude/skills`, `~/.codex/skills`, and each other agent's Skills folder, such as `~/.gemini/skills` or `~/.cursor/skills` | Deployed Skills |
> | `~/.tf/skills/claude-desktop/` | Claude Desktop Skill ZIPs for upload |
> | The employee's shell rc file, such as `~/.zshrc` or `~/.bashrc` | A TrueFoundry block, for agents that read the gateway or credential from environment variables, such as Gemini CLI |
> | Each agent's user configuration | User settings for agents without managed settings |
>
> The first time the binary edits an existing user file, it keeps the original next to it as a `.bak` copy.

With device login, managed agent files contain the employee's credential. When you contact support, share your TOML and log errors, not token files, dry-run output, or generated agent files.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.