Skip to main content
This page covers the Claude-specific parts of an MDM rollout. Start with the MDM overview to create the deployment script, then use these options in its TOML block. Claude Code is supported on macOS, Linux, and Windows. Claude Desktop is supported on macOS and Windows. Claude Web has no device configuration to manage; see Claude Web.

What gets written

Claude Code applies managed settings above project and user settings, so employees cannot override the gateway, models, or policy:
The binary writes the gateway URL, the tier models, the employee’s sign-in, and gateway MCP servers into these files on every run. Sign-in depends on the method you chose:
Policies in Claude’s Admin Console (Settings → Policies) do not reach sessions routed through a gateway. Put your Claude Code policy in mdm.toml instead.

Set the Claude Code policy

[agents.claude-code.managed_settings] takes any key from Claude Code’s settings reference, including nested permissions, env, sandbox, and MCP policy keys. The starter in the overview uses this policy:
Do not set ANTHROPIC_BASE_URL, the model variables, or credentials here. The binary adds them after loading your policy.
Your table replaces the built-in policy; it does not add to it. Without a managed_settings table, the binary uses a built-in baseline: the ask rules above plus Bash(curl:*), Bash(wget:*), and Read(**/.env.*), the other settings above, and Claude Code’s sandbox enabled with proxy ports 8080 and 8081. Write a table whenever that baseline does not match your environment, and include every rule you want.
To keep the policy in a JSON file instead, pass --settings-file=/path/to/policy.json to the binary. Precedence is --settings-file, then the inline table, then the existing managed file, then the baseline. If the --settings-file path cannot be read, the binary silently uses the baseline, so check the path on a pilot device.

Restrict MCP servers to the gateway

Gateway MCP servers from [mcp] are added to managedMcpServers in managed-settings.json, alongside servers employees add themselves. This requires Claude Code 2.1.259 or later. To allow only servers behind your gateway, add an allowlist to the policy:
Earlier MDM scripts wrote an exclusive managed-mcp.json that blocked every other server. This setup does not, so add allowedMcpServers if you relied on that behavior.
For other controls, such as blocking Claude.ai connectors or web search, see Govern Claude’s MCP traffic.

Choose models

Claude Code uses three tiers. The defaults are:
Keep a recognizable Claude model name in each ID, because Claude Code uses it to decide which features to enable. See Model configuration.
  • Use Virtual Models so you can change routing or add fallbacks in TrueFoundry without redeploying the script. See Virtual Models.
  • To request 1M context in Claude Code, add the [1m] suffix, for example opus_model = "claude-code/claude-opus[1m]", for models that support it.

Add Claude Desktop

Add claude-desktop to tools. Desktop uses the Claude Code tier models unless you override them:
The binary pins Desktop’s model picker to these models and turns off model discovery.
  • MCP servers from [mcp] appear under Customize → Connectors, where each employee selects Connect to authorize them. This requires Desktop 1.2581.0 or later. To allow only remote servers, pass --claude-desktop-allow-local-mcp=false to the binary, which blocks employees’ local (stdio) servers.
  • Skills are staged as ZIP files in ~/.tf/skills/claude-desktop. Employees upload them through Desktop’s Skills settings with code execution enabled. A newly staged ZIP does not update a Skill that was already uploaded.
  • Restrict sign-in with binary flags: --force-login-org=<Claude org UUID> (repeatable) limits sign-in to your Claude organizations, and with OIDC, --disable-deployment-mode-chooser stops employees from leaving the gateway profile for a personal Claude.ai account.
  • Inference headers are added with the repeatable --desktop-header='Name: Value' flag. A headers key in TOML fails validation.
With OIDC, Desktop requires version 2.7032.0 or later. See Set up OIDC sign-in.

Turn on tool search and 1M context

Tool search loads only tool names into each session and fetches a tool’s schema when Claude needs it, so many connectors no longer crowd the context window. This setting is the only switch: Desktop removes ENABLE_TOOL_SEARCH from sessions when it is unset, so employees cannot turn it on themselves.
Tool search sends the tool-search-tool-2025-10-19 beta header. Anthropic accepts it directly, but Bedrock, Vertex, and Azure-hosted Claude models drop beta headers that are not allowed for that provider, and the request then fails with HTTP 400. Test with one group first. See Forwarding Anthropic beta features.
1M context: set supports_1m and prefer_1m only for tiers whose gateway models support 1M context. Desktop uses these settings rather than Claude Code’s [1m] suffix.

Let employees import claude.ai history

This adds the Import wizard under Settings → Import & export, so employees can bring claude.ai conversations and projects into Desktop. Replies in imported conversations come from your gateway models, and the transcript is replayed as context, so choose models with enough context.
  • Requires Desktop 1.10628.0 or later.
  • For Team or Enterprise workspaces, a workspace owner must also turn on Allow members to export their own data in claude.ai.
  • The Sign in to claude.ai path needs network access to claude.ai. Importing a downloaded .zip file does not.
  • Terminal Claude Code history is not imported.
  • If import stays unavailable on macOS, try encoding = "native-dict".
Optional fields: export_enabled (default true) shows Export, banner_behavior ("detect", "show", or "off") controls the import prompt, and automatic_3p (beta, default false) imports earlier third-party sessions without asking. Turn on automatic_3p only with your organization’s agreement, because employees are never prompted. It also requires deploymentOrganizationUuid in Desktop’s managed preferences, which this tool does not set. See Anthropic’s import documentation.

Use a Claude Enterprise or Team subscription

To bill Claude Code usage to employees’ Claude seats instead of an API key, create the Anthropic model account with an empty API key, as described in Subscription passthrough. Then point the tiers at that account’s models:
Use device login for this setup. The binary sends the TrueFoundry credential in X-TFY-API-KEY, and each employee runs /login in Claude Code once and chooses their Claude account, so the two sign-ins are independent.
  • A Virtual Model can have only one empty-key Anthropic target.
  • If the account has an API key, the gateway uses it and bills the key instead of the seat.
  • For a 401 or 403: if the Claude session expired, the employee runs /login again; if the TrueFoundry sign-in expired, trigger the MDM script again.
Claude Desktop cannot use subscription passthrough.

Verify the deployment

  1. Check the managed files are locked. See Check that the settings are locked.
  2. Check sign-in in managed-settings.json. With device login, look for X-TFY-API-KEY in ANTHROPIC_CUSTOM_HEADERS and no apiKeyHelper. With OIDC, look for apiKeyHelper containing --_print-oidc-token and no token.
  3. Check Claude Desktop’s preferences. With OIDC, look for inferenceCredentialKind set to external-idp and inferenceIdpOidc with "bearerTokenType":"access_token". With device login, look for inferenceGatewayApiKey.
  4. Send a test request from Claude Code and Claude Desktop, then find both in AI Gateway → Request Logs. In Claude Code, /model should list your gateway models.

Windows Subsystem for Linux

Claude Code inside WSL reads the distribution’s own /etc/claude-code, not the Windows configuration. Add --wsl to the binary’s command to also configure the employee’s WSL distributions. See the WSL caveats, which apply to both agents. Verify with wsl.exe -d Ubuntu cat /etc/claude-code/managed-settings.json.

Data retention

transcriptRetentionDays in the Claude Code policy deletes local transcripts; 7 to 14 days is a common choice. Anthropic-side retention, Zero Data Retention, and compliance are configured with Anthropic; see Claude’s data retention documentation.

Troubleshooting