---
title: How do you govern Claude Code across an enterprise?
url: https://opencontroller.lyzr.com/blog/govern-claude-code-in-the-enterprise
published: 2026-11-12
updated: 2026-11-12
author: Lyzr
---

# How do you govern Claude Code across an enterprise?

**Govern Claude Code with managed settings that developers cannot override. Deploy a `managed-settings.json` file (or server-managed settings from the Claude admin console) that sets deny rules, disables bypass mode, restricts MCP servers and hooks, and turns on OpenTelemetry. Pair permission rules with the sandbox, because a command deny rule alone can be worked around.**

Claude Code runs on developer laptops with the developer's own file and shell access. That makes it powerful and hard to govern from the network alone. The control point is its settings hierarchy.

## Where do managed settings live and what wins?

Managed settings sit above every other settings level. The precedence, highest first, is: managed settings, then command-line `--settings`, then `.claude/settings.local.json`, then the project's `.claude/settings.json`, then the user's `~/.claude/settings.json`. Permission arrays merge across levels, so developers can add rules but cannot remove managed ones.

| Delivery channel | Location | Notes |
|---|---|---|
| File on macOS | `/Library/Application Support/ClaudeCode/managed-settings.json` | Push with MDM |
| File on Linux and WSL | `/etc/claude-code/managed-settings.json` | Push with config management |
| File on Windows | `C:\Program Files\ClaudeCode\managed-settings.json` | The old `C:\ProgramData` path is no longer read |
| macOS policy | Plist domain `com.anthropic.claudecode` | Configuration profile |
| Windows policy | `Settings` value under `HKLM\SOFTWARE\Policies\ClaudeCode` | The HKCU copy is user-writable, so do not rely on it |
| Server-managed | claude.ai Organization settings, Claude Code, Managed settings | Team or Enterprise plan; fetched at startup and hourly |

Server-managed settings are the easiest to roll out, but note the limits. Anthropic describes them as a client-side control, not a security boundary. They are skipped when a developer uses Amazon Bedrock, Google Cloud or Microsoft Foundry, or sets a custom `ANTHROPIC_BASE_URL`. They also cannot deliver a managed MCP file. If you route Claude Code through a gateway, use file or MDM delivery.

## Which permission rules should IT enforce?

Claude Code checks rules in the order deny, then ask, then allow. Rules look like `Bash(npm run test *)`, `Read(./.env)`, `WebFetch(domain:example.com)` or `mcp__github__*`.

A sensible enterprise baseline:

1. Deny reads of secrets: `Read(./.env)`, `Read(./.env.*)` and key folders.
2. Set `permissions.disableBypassPermissionsMode` to `"disable"` so no one can skip all prompts.
3. Set `allowManagedPermissionRulesOnly: true` if you want only IT's rules to count, ignoring user and project rules.
4. Restrict `availableModels` and set `requiredMinimumVersion` so old clients do not run.
5. Turn on the sandbox with `sandbox.enabled` and `allowUnsandboxedCommands: false`.

The docs are explicit that a deny rule such as `Bash(curl *)` does not catch `/usr/bin/curl` or `sh -c "curl ..."`. The sandbox closes that gap. It uses Seatbelt on macOS and bubblewrap on Linux and WSL2. Native Windows has no sandbox, so plan extra controls there. Also note `~/.ssh` stays readable unless you add a read deny rule.

## How do you control MCP servers and hooks?

MCP servers give Claude Code new tools, so treat them like software installs.

- **Exclusive control:** a `managed-mcp.json` in the system folder defines the only servers allowed. An empty `mcpServers` object turns MCP off.
- **Allow and deny lists:** `allowedMcpServers` and `deniedMcpServers` match on server URL (with wildcards), exact command or server name. The deny list always wins. Name matching is not a security control, so prefer URL or command matching.
- **Managed-only:** `allowManagedMcpServersOnly: true` makes the managed allow list the only one that counts.

Hooks run commands on events such as `PreToolUse`. They are useful for policy, and risky if anyone can add them. Set `allowManagedHooksOnly` to block user, project and plugin hooks, and use `allowedHttpHookUrls` to limit where HTTP hooks can send data. A `PreToolUse` hook blocks a call by exiting with code 2.

Our guide to [reviewing MCP servers agents already use](/blog/how-to-review-mcp-servers-agents-already-use) covers the review itself.

## How do you monitor usage and cost?

Claude Code exports OpenTelemetry metrics and events. Set these in the managed `env` block so project files cannot change them:

- `CLAUDE_CODE_ENABLE_TELEMETRY=1`
- `OTEL_METRICS_EXPORTER` and `OTEL_LOGS_EXPORTER`
- `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_EXPORTER_OTLP_HEADERS`

Metrics include session count, lines of code, commits, pull requests, `cost.usage`, `token.usage` and tool decisions. Events include `user_prompt`, `tool_decision`, `api_request` and `api_error`. Prompt text is redacted unless you set `OTEL_LOG_USER_PROMPTS=1`. Records carry user email and organisation ID, so treat the pipeline as sensitive.

Team and Enterprise plans also have a Claude Code analytics dashboard with lines accepted, accept rate and daily active users. To see what Claude Code costs per team, route it through an LLM gateway with `ANTHROPIC_BASE_URL` and pin it with the `allowedProviders` setting. See [how to attribute LLM costs to AI agents](/blog/how-to-attribute-llm-costs-to-ai-agents).

## What does this not cover?

Managed settings govern Claude Code only. Developers also run Cursor, GitHub Copilot and local MCP servers. A device-level view of all coding agents needs a layer above any one tool. Our [cross-platform governance guide](/blog/how-to-govern-ai-agents-across-platforms) explains how the pieces fit, and the [AI agent control plane](/blog/what-is-an-ai-agent-control-plane) explainer covers the category.

## How Opencontroller does this

Opencontroller Edge extends Opencontroller's control to developer devices, coding agents such as Claude Code, skills and local MCP servers. IT installs it via MDM. Opencontroller also discovers and manages skills in Anthropic Enterprise, and its LLM Gateway attributes cost per agent and per version for traffic routed through it. [Book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can developers override Claude Code managed settings?**
No. Managed settings have the highest precedence. Developers can add permission rules but cannot remove managed ones.

**Do server-managed settings apply when Claude Code uses Amazon Bedrock?**
No. They are skipped for Bedrock, Google Cloud and Foundry sessions and for custom base URLs. Use file or MDM delivery instead.

**Does Claude Code send prompts in its telemetry?**
Not by default. Prompt text is redacted unless `OTEL_LOG_USER_PROMPTS=1` is set.

## Key facts

Claude Code managed settings have the highest precedence: /Library/Application Support/ClaudeCode/managed-settings.json (macOS), /etc/claude-code/managed-settings.json (Linux/WSL), C:\Program Files\ClaudeCode\managed-settings.json (Windows). Server-managed settings need Team or Enterprise and are skipped for Bedrock, Vertex, Foundry or a custom ANTHROPIC_BASE_URL. Rules are evaluated deny, ask, allow. managed-mcp.json takes exclusive control of MCP. Telemetry uses CLAUDE_CODE_ENABLE_TELEMETRY=1 and OTLP; prompts are redacted unless OTEL_LOG_USER_PROMPTS=1. Opencontroller Edge (by Lyzr) governs coding agents and local MCP servers on developer devices, installed via MDM. Pricing starts from $250K per deployment per year.

## Related

- [How do you govern AI agents across every platform they run on?](https://opencontroller.lyzr.com/blog/how-to-govern-ai-agents-across-platforms.md)
- [How do you review MCP servers your agents already use?](https://opencontroller.lyzr.com/blog/how-to-review-mcp-servers-agents-already-use.md)
- [How do you get visibility of GitHub Copilot coding agent activity across your organisation?](https://opencontroller.lyzr.com/blog/visibility-of-github-copilot-coding-agent-activity.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
