Before you start
You need:- Administrator deployment access through Jamf, Mosyle, Kandji, Intune, SCCM, or another system that runs scripts as root or Administrator/SYSTEM.
- Your control-plane URL, tenant name, and gateway URL. The control-plane URL opens your TrueFoundry console; the gateway URL receives model requests. Copy the gateway base URL from your organization’s Playground code snippet, including any path such as
/api/llm. - Gateway model IDs that employees can use. Configure model and MCP permissions through Access Control. For Codex, use a suitable Virtual Model with a bare OpenAI model slug, such as
gpt-5.4; see Codex model configuration. - Permission for employees to create PATs for manual onboarding. If your tenant requires a team owner, decide whether to set
auth.pat_teamor let employees select a team during sign-in. - Optional MCP servers and Skills already registered in TrueFoundry. Use the exact registry names and grant employees access. See MCP servers and Skills Registry.
tfy-local-ai-setup v2.2.0, which includes standalone --config, manual PAT onboarding, MCP discovery, and additional clients. Review the release notes before changing the pin.
How the rollout works
Deploy your first configuration
1. Prepare the TOML file
Save the following asmdm.toml in your MDM deployment package. Replace the URLs, tenant, and model IDs. This example configures Claude Code, Codex, and OpenCode; add claude-desktop to tools on macOS/Windows if required.
api-key selects per-user authentication; it does not ask you to embed an API key in this file. Keep tokens and client secrets out of the TOML. The example starts without MCP servers or Skills so you can verify model access first, then add them.
The explicit tools list configures those clients even if they are not installed yet. Omit a client’s ID to leave it out of the rollout. For Linux, leave out Claude Desktop.
2. Prepare the Claude Code policy template
Save this asbase-settings.json alongside mdm.toml in your deployment package. This starter policy requires approval before writes and pushes and denies reads of SSH files. Review it with your security team and adjust it for your organization.
3. Deploy the files and setup tool
Use your MDM to delivermdm.toml and base-settings.json to the administrator-controlled directory in the relevant tab. Make both files readable by users and writable only by administrators. Do the same for any parent directories created for the deployment.
Run the corresponding script as root or Administrator/SYSTEM. These scripts expect both input files to have already been delivered; they download the pinned binary only when it is missing or the saved release pin differs.
- macOS
- Linux
- Windows
/Library/Application Support/TrueFoundry/. Save this script in your MDM and run it as root. It supports Apple Silicon and Intel Macs.Preview the configuration before applying it
Preview the configuration before applying it
--dry-run:4. Ask employees to sign in
After the first privileged run has saved the organization policy, give employees the following instructions. Run in a normal terminal as the employee, without sudo or elevation:- macOS and Linux
- Windows
auth.pat_team, select an available team when prompted. To specify one explicitly, append --pat-team=engineering. The server checks whether the employee can create a PAT for that team.
The command reuses a valid managed PAT on subsequent runs. An expired or revoked PAT requires sign-in to create a replacement. A temporary network or verification error does not create another PAT; retry when connectivity returns.
On completion, the command reports that user setup is complete and administrator-owned updates finish on the next MDM run. Trigger that run for your pilot, then open a new terminal and restart the configured clients. If no user is signed in, user-owned work waits until a user session is available.
5. Verify the connection
- Check the MDM log. Confirm the post-login run completed. Exit
0indicates success or a clean no-op; exit1indicates an error. Pending manual onboarding can still produce a successful scheduled run, so check the full onboarding sequence. - Send a model request in each selected client. Ask:
Reply exactly TFY-CHAT-OK. Do not use tools.Confirm there is no authentication or model error. - Confirm the route. Open AI Gateway → Request Logs in TrueFoundry and find the request under the expected user and model. A response alone does not prove it went through the gateway.
- Check optional MCP servers and Skills. Authorize MCP servers in each client, then try a harmless read operation. Check the client’s Skills list; Desktop Skills require manual upload.
Supported clients
Managed means setup writes administrator-owned machine configuration. User means setup writes the employee’s configuration and reconciles it on later runs; users can edit those files. Skills are per-user even for managed clients.managedMcpServers needs Claude Code 2.1.259+. Claude Desktop managed MCP connectors need Desktop 1.2581.0+. On Windows, Codex gateway enforcement through requirements.toml needs Codex 0.156.0+; the companion machine config.toml supplies defaults on older versions, which users can override.TOML configuration reference
Pass this file through--config=/absolute/path/mdm.toml. It is separate from personal mode’s ~/.tf/config.toml and the generated agents-policy.json. TOML and JSON are supported; YAML is not supported by the full MDM loader. Unknown keys are rejected before authentication or configuration writes.
Connection and client selection
Authentication
Shared models, MCP servers, and Skills
Client model fields
Additional client options and accepted API values
Additional client options and accepted API values
Precedence and unsupported fields
Explicit command-line flags override corresponding TOML values. For example,--codex-default-model=gpt-5.4 changes Codex’s model for that run. Keep scheduled overrides in your deployment package so the next run does not revert them.
--mcp-serverreplaces only the shared MCP list; per-client lists remain.--no-mcpsuppresses the shared list and preserves per-client overrides.--no-skillsremoves MDM-installed Skills, including per-client selections.--agentreplaces the additional-client selection from the file; Claude Code, Codex, and Desktop retain their separate selection flags. Use--claude-desktop=false, for example, to deselect Desktop.--agents-configis the older partial input mode. It cannot be combined with--config.[[mcp.custom]]is not propagated through the MDM policy in v2.2.0. Register the server in the gateway and use its registry name instead.[restrictions]is not accepted by the full MDM--configparser in v2.2.0. Use the prompt-blocking CLI flags.
Practical examples
The following snippets replace or extend the matching sections of the baseline TOML. Do not append a second copy of an existing table.Give clients different MCP servers and Skills
Discover each employee’s accessible MCP servers
Replace the baseline[mcp] table with:
USE_MCP_SERVER permission to build each user’s list. Discovery refreshes on scheduled runs without opening a browser; it does not initiate MCP OAuth consent. A per-client mcp_servers list still overrides discovery.
Failed or incomplete discovery retains existing MCP configuration. A successful discovery with no accessible servers removes previously discovered entries. The gateway continues checking authorization on requests independently of client refresh. Restart clients that need it to pick up changes.
Add another model-list client
Addqwen-code to the top-level tools list, then add:
[defaults]. Both inherit the baseline API-key/manual login method. Choose gateway model IDs and a wire protocol supported by your actual models.
Other authentication methods
OIDC
Create a public native OIDC client on your TrueFoundry control plane. With a PAT whose owner can manage tenant settings, send:data.id from the response as the client ID. Replace the baseline authentication table with:
issuer from <issuer>/.well-known/openid-configuration. Omit login = "manual" and any API-key overrides when using this all-OIDC example. Do not instruct these employees to run login --mdm; that command is for manual PAT policy.
Claude Code receives apiKeyHelper; Codex receives an auth command pointing to the installed binary. Their first runtime sign-in opens a browser; subsequent requests reuse cached tokens or refresh them. Desktop uses its own native session. v2.2.0 defaults Desktop to access_token with openid profile email offline_access scopes; TrueFoundry rejects an ID token as the gateway bearer token.
MCP discovery and authenticated Skill downloads still require usable credentials. Complete sign-in before expecting those operations to succeed on scheduled runs. Primary clients can override auth independently; all selected additional clients must agree on a single auth mode.
Automatic device login
Keepmode = "api-key" and remove login = "manual". The privileged run authenticates in the logged-in employee’s context, first trying their saved device-login refresh token. It can open a browser if sign-in is needed. Hourly runs keep the generated credentials current.
This flow uses ~/.tf/refresh-token and ~/.tf/access-token, separately from the manual PAT store and OIDC’s ~/.tf/oidc-* caches. The login --mdm command applies only to manual PAT policy.
Advanced client controls
These options are CLI flags, not additional TOML keys. Add them to the wrapper’s binary invocation as needed.Apply a Claude Code settings template
Use--settings-file=/absolute/path/base-settings.json to select your organization’s permission and sandbox policy. The binary merges gateway, model, auth, and MCP settings into that template. With no explicit template it reuses an existing managed settings file, otherwise its built-in baseline applies.
Review the baseline before rollout: it includes denied shell/network and sensitive-file operations, approval rules, managed-only permission/hook rules, 14-day transcript retention, and a sandbox configuration with proxy ports 8080/8081. Supply your own template when those proxy services or restrictions do not match your environment.
The starter template above provides a complete example without a sandbox proxy.
For Claude Code, gateway MCP entries are additive. To restrict other MCP servers, configure allowedMcpServers/deniedMcpServers in your template. Deploy the template under administrator ownership, alongside the TOML. Review any Anthropic server-managed policies with your Claude administrator because they can change the effective policy.
Block new prompts in a client
Run as root/Administrator, independently or alongside setup:.exe from an elevated PowerShell terminal and omit sudo. Hooks block prompt submission, not launching apps, manual editing, Cursor Tab completion, or other clients. Claude Code’s fail-closed hook requires 2.1.295+; Codex hooks can require trust review through /hooks. Restart the client or start a new session after a change. Native Windows hooks do not cover WSL clients.
Other CLI options
[1m] model suffix does not substitute for Desktop’s model capability entries. Test tuning with your Desktop version before rollout.
Operate the rollout
Update the administrator-controlled TOML through MDM, then trigger the wrapper or wait for its hourly schedule. Keep changes to the release pin, TOML, settings templates, and CLI flags in the same deployment package. Restart clients that read configuration only at launch.Files and credentials
~/.tf/personal-mdm-<account-hash>-pat.
API-key mode can write credentials into generated client configuration. Protect those files and avoid sharing their contents. User reconciliation state, including pending work, is in ~/.tf/mdm-user.json. Skill bundles are cached under ~/.tf/cache/skills/<tenant>/<version-id> and installed into each client’s Skills directory. Desktop ZIPs are staged under ~/.tf/skills/claude-desktop.
For a safe policy inspection, check selected IDs without printing generated credentials:
Failure and removal behavior
- Employee has not signed in: manual mode saves intent and leaves credential-dependent work pending. Ask the employee to run
login --mdm, then trigger the privileged run. - Credential verification or discovery fails: existing credential-dependent/MCP settings are retained for retry. Read logs for pending work; a successful initial scheduled run is not proof of completed onboarding.
- Discovery succeeds with an empty result: previously discovered MCP entries are removed. This differs from a failed discovery.
- MCP or Skill selection changes: later reconciliation removes entries installed by this tool that are no longer selected. Pinned Skills stay at the chosen version; unpinned references can update on later runs. Cached bundles are reused, although registry metadata checks can still occur.
- A client is removed from
tools: tracked additional-client settings are cleaned up through reconciliation. Do not assume this removes the primary clients’ legacy managed files. To decommission Claude Code, Codex, or Desktop, stop scheduled reapplication and explicitly remove the protected files/registry policy through your MDM’s administrator workflow.
uninstall is not an MDM decommissioning workflow. Remove configured prompt restrictions with --unblock-agent before retiring the binary. Revoke PATs in TrueFoundry when access is no longer needed.
FAQ
Why does login --mdm say there is no organization policy?
Why does login --mdm say there is no organization policy?
Why is the client still unauthenticated after the employee signs in?
Why is the client still unauthenticated after the employee signs in?
Does the scheduled run open a browser or renew the one-year PAT?
Does the scheduled run open a browser or renew the one-year PAT?
auth.login = "manual", scheduled runs do not open a browser and do not mint replacement PATs. They reuse the saved PAT. When it expires or is revoked, the employee runs login --mdm again. Automatic device login and OIDC have different refresh behavior.Can employees override settings or use other providers?
Can employees override settings or use other providers?
Does discovering or deploying an MCP server sign the employee into it?
Does discovering or deploying an MCP server sign the employee into it?
Can I deploy a custom MCP URL or a local stdio server in this TOML?
Can I deploy a custom MCP URL or a local stdio server in this TOML?
mcp.custom. Register supported remote servers in the gateway and reference their names. Local server controls are client-specific; Desktop local MCP can be disabled with its CLI flag.Why do Desktop Skills need an upload?
Why do Desktop Skills need an upload?
~/.tf/skills/claude-desktop. Upload them through Desktop’s Skills UI. Other supported clients receive Skills in their own directories; deploying a new ZIP does not replace a previously uploaded Desktop Skill inside the app.What happens when nobody is logged in?
What happens when nobody is logged in?
Can employees also use personal setup?
Can employees also use personal setup?
What should I collect before contacting support?
What should I collect before contacting support?