Skip to main content

05 - Claude Code Managed Settings: Governing Skills, Plugins and MCP

Skills, plugins and MCP servers in an organization: what managed settings control, how to inspect a plugin and how to validate the policy file.

What do you think about this article?

05 - Claude Code Managed Settings: Governing Skills, Plugins and MCP
Claude Skills & MCPPhoto:Matheus BertelliPexels

At a Glance

Skills, plugins and MCP servers in an organization: what managed settings control, how to inspect a plugin and how to validate the policy file.

A skill, a plugin and an MCP server look like three ways of giving tools to an assistant, but to the person who has to approve them in an organization they are three different surfaces: a skill enters the context as an instruction, an MCP server is a process or an address that answers calls, and a plugin can carry both, plus shell commands that run on their own. Here I line up what the Claude Code documentation lets you control for each of them, with two test tools: one validates a managed-settings file against the published schema, the other lists what a plugin can execute before you install it. I do not describe any real infrastructure: the plugin, the catalog and the addresses are invented and marked as such.

I start from what the previous four articles covered: skills and their architecture, the SKILL.md with scripts and tests, the MCP protocol and the TypeScript client. There is no more protocol code here: this is the question that comes next, namely who decides what can be loaded.

Three different things, three different risks

The Claude Code plugin documentation is precise about what each component does. Hooks, monitors and the processes of MCP and LSP servers are commands that run with the user's permissions; skills, commands and agents, by contrast, enter Claude's context as instructions and influence what Claude does with the tools it already has. A plugin can contain all of this, and the "Plugin security and trust" page opens with a sentence worth quoting almost verbatim: an installed plugin can execute arbitrary code on the machine, with the user's privileges.

  • Skill: text that steers the model; the risk is that the instructions make it do what it should not, and that the allowed-tools field pre-approves commands without asking.
  • MCP server: a process started on the machine (stdio) or a remote address; the risk is the code it runs and the text it returns, which the model will read.
  • Hooks and bin/: shell commands; the risk is direct execution, outside the permission rules that govern Claude's calls.

The distinction matters because the countermeasures differ. Permission rules and the sandbox cover the tool calls Claude makes; they do not cover, the same page says, the code a plugin runs on its own: hooks, monitors and server processes start outside the sandbox. A review that looks only at the text of the skill and ignores hooks/hooks.json has looked at the least dangerous part.

Looking inside a plugin before installing it

The review procedure the documentation recommends is concrete: check which source the catalog comes from (claude plugin marketplace list), read the "Will install" section in the /plugin panel, then open the files that section does not show, because it tells you a hook exists but not what it launches. There are three: hooks/hooks.json, .mcp.json and the bin/ folder. To automate the first pass, and to make it repeatable in a group review, I wrote a small script that lists exactly those three places plus the permissions pre-approved by skills. The documentation also offers its own command, claude plugin details, which prints an inventory of the components; my script is for places where that command is not available, and it is far less complete.

The test plugin contains the migration-review skill built in the second article, a hook that launches a script after every Write or Edit, and a .mcp.json file with two servers: a local one and a remote one with an invented address (the .invalid domain is reserved and does not resolve).

$ cat plugin-prova/hooks/hooks.json
# Output:
# {
#   "hooks": {
#     "PostToolUse": [
#       {
#         "matcher": "Write|Edit",
#         "hooks": [
#           { "type": "command", "command": "\"${CLAUDE_PLUGIN_ROOT}/bin/dopo-modifica.sh\"" }
#         ]
#       }
#     ]
#   }
# }

$ cat plugin-prova/.mcp.json
# Output:
# {
#   "mcpServers": {
#     "magazzino": { "command": "python3", "args": ["${CLAUDE_PLUGIN_ROOT}/server_magazzino.py"] },
#     "esterno": { "type": "http", "url": "https://mcp.sconosciuto.invalid/api" }
#   }
# }

In the hook the command is wrapped in double quotes because, without args, it is run by a shell, and the documentation warns you to keep the path with ${CLAUDE_PLUGIN_ROOT} as a single word. In .mcp.json the two servers are of opposite natures: magazzino is a process that Claude Code starts on the machine, esterno is an address the client connects to. You judge the first by reading the code it launches, the second by looking at who runs it.

"""List what a plugin can run or inject, reading only its files (nothing is executed)."""
import json
import os
import re
import sys
from pathlib import Path


def leggi_json(percorso):
    return json.loads(percorso.read_text(encoding="utf-8")) if percorso.is_file() else {}


def frontmatter(testo):
    m = re.match(r"---\n(.*?)\n---", testo, re.S)
    return dict(r.split(":", 1) for r in m.group(1).splitlines() if ":" in r) if m else {}


def ispeziona(radice):
    radice = Path(radice)
    manifest = leggi_json(radice / ".claude-plugin" / "plugin.json")
    print(f"plugin: {manifest.get('name', '(no name)')} {manifest.get('version', '(no version)')}")

    for skill in sorted(radice.glob("skills/*/SKILL.md")):
        fm = frontmatter(skill.read_text(encoding="utf-8"))
        permessi = fm.get("allowed-tools", "").strip() or "no pre-approved permissions"
        print(f"skill  {skill.parent.name}: {permessi}")

    for evento, gruppi in leggi_json(radice / "hooks" / "hooks.json").get("hooks", {}).items():
        for gruppo in gruppi:
            for hook in gruppo.get("hooks", []):
                print(f"hook   {evento} [{gruppo.get('matcher', '*')}] {hook.get('type')}: {hook.get('command', hook.get('url', ''))}")

    mcp = leggi_json(radice / ".mcp.json")
    for nome, cfg in mcp.get("mcpServers", mcp).items():
        avvio = cfg.get("url") or " ".join([cfg.get("command", ""), *cfg.get("args", [])])
        print(f"mcp    {nome}: {avvio}")

    for file in sorted((radice / "bin").glob("*")):
        eseguibile = "executable" if os.access(file, os.X_OK) else "not executable"
        print(f"bin    {file.name}: {eseguibile}, goes on the PATH of Claude's shell")


ispeziona(sys.argv[1])

The script only reads files: it executes nothing. The ispeziona function collects four things, and the last two lines of each branch are the ones that matter. For skills it extracts allowed-tools from the frontmatter with a regular expression, and reports when it is missing; for hooks it repeats event, matcher and command; for the .mcp.json file it accepts both the form with the mcpServers key and the one without, as the documentation allows; for bin/ it checks the execute bit. The frontmatter parsing is deliberately naive (key: value lines): a skill with a value spanning several lines would be misread, and that is the case where you should open the file.

$ python3 ispeziona_plugin.py plugin-prova
# Output:
# plugin: revisione-migration 0.1.0
# skill  revisione-migration: Bash(python3 ${CLAUDE_SKILL_DIR}/scripts/check_migration.py *)
# hook   PostToolUse [Write|Edit] command: "${CLAUDE_PLUGIN_ROOT}/bin/dopo-modifica.sh"
# mcp    magazzino: python3 ${CLAUDE_PLUGIN_ROOT}/server_magazzino.py
# mcp    esterno: https://mcp.sconosciuto.invalid/api
# bin    dopo-modifica.sh: executable, goes on the PATH of Claude's shell

The output is what a reviewer would want in front of them: the name and version, the skill with the command it can launch without asking (Bash(python3 ... check_migration.py *), limited to that script), a hook that fires on every edit, two servers of different natures and an executable that goes on the PATH of Claude's shell. None of these lines says whether the plugin is safe: they say what needs to be read. The judgment is left to whoever reads dopo-modifica.sh and server_magazzino.py.

Managed settings: one file for the whole fleet

Organizations control plugins and MCP servers with managed settings, which reach machines in one of three ways: server-managed settings (in the admin console, for Teams or Enterprise organizations), MDM policies, or a managed-settings.json file in a system path. By default only one of them applies: Claude Code uses the first source that supplies a key, in the order server, MDM, file. The practical consequence is that a single unrelated key in the server settings is enough for the plugin keys placed in the local file to be ignored, unless you set managedSourcesBehavior to "merge".

The following file is an invented example (the organization, the catalog and the domains do not exist) that brings together the main keys. It registers an internal catalog and enables one of its plugins, allows adding catalogs only from that source, rejects the flags that load plugins from a local folder, and restricts MCP servers to one approved address.

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "strictKnownMarketplaces": [
    { "source": "github", "repo": "azienda-esempio/plugin-approvati" }
  ],
  "extraKnownMarketplaces": {
    "plugin-approvati": {
      "source": { "source": "github", "repo": "azienda-esempio/plugin-approvati" },
      "autoUpdate": false
    }
  },
  "enabledPlugins": {
    "revisione-migration@plugin-approvati": true
  },
  "disableSideloadFlags": true,
  "allowManagedMcpServersOnly": true,
  "allowedMcpServers": [
    { "serverUrl": "https://mcp.esempio.invalid/magazzino/*" }
  ],
  "deniedMcpServers": [
    { "serverUrl": "https://*.sconosciuto.invalid/*" }
  ],
  "pluginTrustMessage": "Ask the platform team before installing plugins that are not in the internal catalog."
}

Every line has a reason. strictKnownMarketplaces is the list of allowed catalog sources: it registers nothing, it filters. That is why you also need extraKnownMarketplaces, which registers the catalog, and enabledPlugins, which installs and enables it so that the user cannot turn it off (managed settings take precedence over every other level). autoUpdate: false is a prudent choice: with automatic update on, the files you reviewed can change on disk in the background, and the review loses its value. disableSideloadFlags closes the side door: without it, --plugin-dir bypasses the catalog list. For MCP servers the pair allowedMcpServers plus allowManagedMcpServersOnly applies: without the second, the lists from every level are merged, including the user's personal one, which can therefore widen what the administrator's list allows.

I preferred serverUrl to serverName for a reason the documentation states in a warning: the name is the label the user assigns with claude mcp add, not the identity of the server, so anyone can call any server github. A check on the name is not a security check; the address is, for remote servers, and the exact command (serverCommand) for stdio ones. The deniedMcpServers in the example acts before the allow list: the documentation specifies that nothing overrides a match with the block list.

Validating the file: the schema is not enough

A wrong policy file is worse than no file, because it gives false security. A JSON schema for Claude Code settings is published on schemastore (the documentation itself points to it with the $schema line and warns that it can lag behind the most recent versions), and I used it with the jsonschema library. The script checks two things: the errors the schema reports, and the top-level keys the schema does not know.

"""Validate a managed-settings file: published schema + unknown top-level keys."""
import json
import sys
from jsonschema import Draft7Validator

schema = json.load(open("schema_settings.json", encoding="utf-8"))
validatore = Draft7Validator(schema)
note = set(schema["properties"])


def controlla(percorso):
    documento = json.load(open(percorso, encoding="utf-8"))
    problemi = [
        f"{'/'.join(map(str, e.absolute_path)) or '(root)'}: {e.message[:90]}"
        for e in sorted(validatore.iter_errors(documento), key=lambda e: list(e.absolute_path))
    ]
    # the schema allows additional properties: a typo in a key name would pass silently
    problemi += [f"{k}: key unknown to the schema (typo?)" for k in sorted(set(documento) - note)]
    print(f"{percorso}: valid" if not problemi else "\n".join(f"{percorso}: {p}" for p in problemi))
    return not problemi


sys.exit(0 if all([controlla(p) for p in sys.argv[1:]]) else 1)

The second check exists for a reason I found by trying: the schema allows additional properties, so a typo in a key name is not an error. I took the good file, wrote strictKnownMarketplace without the final "s", and the schema declared it valid, while in production the restriction on the catalog would have vanished without any message. The lines on the note set and on the set difference are the ones that fill this gap; the limit is that they only catch typos at the first level, not inside nested objects.

$ python valida_policy.py managed-settings.json sbagliato.json refuso.json
# Output:
# managed-settings.json: valid
# sbagliato.json: allowedMcpServers/0: {'serverUrl': 123} is not valid under any of the given schemas
# sbagliato.json: strictKnownMarketplaces: 'all' is not of type 'array'
# refuso.json: strictKnownMarketplace: key unknown to the schema (typo?)
# exit code: 1

The good file passes. The second contains two real errors (a numeric serverUrl and a list of catalogs written as a string) and the schema reports both; the third is the typo case, which only the key check catches. Exit code 1 is there so you can turn it into a continuous-integration check before distributing the file. The limit stated by the documentation remains: validation says the file is well formed, not that it produces the intended effect. That you check on a machine, with /status (which must show the "Enterprise managed settings" source) and with /plugin, which for a plugin excluded by the list shows the block message.

What the settings do not cover

The page on managing plugins has a section titled after what managed settings cannot enforce, and it is the most useful part for anyone writing a policy. The keys apply to every user who receives the file, so a per-group policy requires different files per group; the catalog list filters sources, not the individual entries inside an allowed catalog (to exclude a plugin you set it to false in enabledPlugins); allowManagedHooksOnly blocks user, project, local and plugin hooks, with the exception of the hooks of plugins that managed settings force-enable in enabledPlugins, as the hooks reference page says (the description in the published schema omits the exception). An allowed, forced plugin can therefore keep running commands: reviewing its files remains necessary.

MCP servers have blind spots too. The servers the organization itself supplies with managedMcpServers skip the allow-list check, and so do the built-in ones; servers passed with --mcp-config are filtered by the lists, and with disableSideloadFlags the flag is rejected altogether (unless the servers are internal to the process). When a server is blocked by a policy, it disappears from /mcp and from claude mcp list with no signal: the documentation advises warning the affected users before a new restriction, otherwise the first report will be "the server no longer works".

Observing what actually runs

Preventive control is not enough: you need to know what has been installed and what is used. Claude Code can export OpenTelemetry events; among them claude_code.plugin_installed and claude_code.plugin_loaded record installations and the plugins active at session start, and with the OTEL_LOG_TOOL_DETAILS=1 variable the names of MCP servers and tools appear too. One detail changes how you read the data: for plugins and catalogs that do not belong to the official and community tiers, the names are replaced by the string third-party if that variable is not set. A dashboard showing only "third-party" is not broken, it is the default configuration.

Underlying risks that no setting removes

Two risks remain regardless. The first is instruction injection: a server that reads web pages, tickets or files written by others returns text that the model will read as if it were trustworthy, and the Claude Code documentation warns that servers that fetch external content can expose you to this risk. The countermeasure is not a filter on the text but damage reduction: tight permissions, human confirmation for irreversible actions and deny rules (deny) for what must never go out, such as network commands for which there is no reason. The second is third-party code: Anthropic, the documentation says, reviews the connectors it lists in its directory against published criteria but does not run a security audit or operate any MCP server, and for plugins it states that it does not control which servers, files or software they contain. The review remains the responsibility of whoever installs.

Frequently asked questions

Is there a central registry of skills from which the organization approves?

For Claude Code, the documented mechanism for distributing skills to a group is the plugin, published in a catalog (marketplace) that the organization manages and restricts with the keys seen above. For MCP servers the documentation says there is no built-in registry to choose from: you publish the approved list elsewhere or distribute the servers as plugins. I did not find in the documentation a "skill registry" format of its own.

Can I restrict the skills of a single user?

A skill's allowed-tools field pre-approves tools only for the turn in which the skill is invoked, and goes through the normal permission flow; with allowManagedPermissionRulesOnly that pre-approval does not apply. To restrict by user or by group you need different settings files per group, because every key applies to anyone who receives the file.

What you can do now

You can tell what a skill, a plugin and an MCP server can do on the machine of whoever installs them, read a plugin with a repeatable inventory before approving it, write a managed-settings file that limits catalogs and servers by address and not by name, and validate it knowing that the schema lets typos through. In the next article I look at the opposite side: how to package a skill in a plugin and distribute it through a catalog, with versions and updates.

Sources

Commenti

Caricamento commenti...

Sign in to comment

New articles and tools on Telegram too

The Telegram channel flags the site's new articles and tools.

Did you like this article?

Explore other content on the blog or discover my projects