Learn / Securing AI coding assistants in an organisation
Lesson 6 of 69 minReviewed
Inventory, telemetry and the fleet incident
Know which agents, versions and MCP servers run on which machines, export the telemetry that shows what they did, and rehearse the response when one of them turns out to be compromised.
Policy only covers the tools you know about. The MCP project's guidance for administrators starts from two facts: local MCP servers are ordinary software your users install, and you will not be asked first. Its recommended starting posture is a continuous inventory of client configuration files, which live in known locations, plus a short allowlist of approved servers [1].
What to inventory
| Fact | Why you need it |
|---|---|
| AI coding tools and exact versions | Match vendor advisories and minimum safe versions to machines |
| MCP servers per client, with source and pinned version | Find every instance when a server or its SDK gets an advisory [1] |
| Risky settings: bypass modes, auto-approve, broad allow rules | Spot machines where prompts no longer stand between injected text and the shell |
| Literal secrets in agent and MCP configs | Client config files are a predictable location for tokens [1] |
Telemetry from the agent itself
Claude Code exports metrics and events over OpenTelemetry once CLAUDE_CODE_ENABLE_TELEMETRY=1 and an exporter are set [2]. Administrators can set these variables for everyone through the managed settings env block; Claude Code ignores exporter variables in a repository's .claude/settings.json and .claude/settings.local.json, and removes conflicting developer-set endpoint variables when managed settings define one [2].
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://collector.example.com:4317"
}
}Content is off by default. Prompts are redacted unless OTEL_LOG_USER_PROMPTS=1; OTEL_LOG_TOOL_DETAILS=1 adds tool parameters such as Bash commands and MCP server and tool names [2]. The claude_code.tool_decision event records whether each tool call was accepted or rejected, the source of that decision (configuration, a hook, or the user approving once or permanently) and the permission mode [2]. With tool details on, the same events show which MCP servers people actually use, which Anthropic's MCP administration guide recommends for seeing which servers users actually connect to [3].
Useful alerts from this data: sessions in bypassPermissions, Bash commands that touch credential stores, newly seen MCP servers, and permanent user approvals for broad commands. Logging tool details means logging commands and paths from developers' work, so set retention and tell developers what is collected.
The fleet incident
When a widely used local server, or the SDK inside it, turns out to be vulnerable or malicious, the MCP guidance lists the work [1]:
- Find every instance, using the inventory.
- Block the server's egress at the proxy or firewall while you respond.
- Rotate every credential the affected configurations passed to it.
- Push the fixed, pinned version through your approved channel.
The same sequence fits a compromised AI tool release or extension. Keeping SBOMs for the servers you approve shortens step one when the advisory names an SDK rather than a server [1].
Try it on ThreatDeck
- Fleet view Collect scanner results from your machines and see which advisories hit which hosts.
- threatdeck scan Inventory AI coding tools, versions, MCP servers and risky settings locally, with JSON or SARIF output for CI and MDM.
- Detection: Claude Code Bash reads secrets Query Claude Code telemetry for tool calls that read credential stores.
- Team alerts Send new advisories for the AI tools and MCP packages you run to Slack, Teams or Discord.
Self-check
4 questionsPick an answer to see whether it is right and why. Only your score is saved, in this browser.
-
Prompt text is redacted by default. Turning it on is an explicit privacy decision, as is
OTEL_LOG_TOOL_DETAILS, which adds commands and MCP tool names. -
A repository cannot point telemetry at an endpoint of its choosing, and managed settings remove conflicting developer-set endpoint variables, so the data reaches your collector.
-
sourcerecords how the decision was made, with values such asconfig,hook,user_permanentanduser_temporary. It is the field to filter when reviewing standing approvals. -
You cannot block, rotate or patch what you cannot find. The guidance orders the steps: find instances, block egress, rotate credentials, push the fixed pinned version.
References
- MCP Local Server Security. Model Context Protocol, 2026-07-28.
- Monitoring (OpenTelemetry). Anthropic (Claude Code docs).
- Control MCP server access for your organization: monitor MCP usage. Anthropic (Claude Code docs).