published fresh until

How do I audit what Claude Code sends and calls on company laptops?

Summary When monitoring Claude Code at work, use three layers: ordinary endpoint controls and human review, a proxy you own for model traffic, and a gateway with identity logging for MCP tool calls. Prompt injection was described as unsolved in the discussion.

Not for customizing Claude Code behavior with mods or approving fewer prompts; see claude-code-mods-customize-behavior

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Anthropic's 2.1.304 notes turn tool search on by default behind custom ANTHROPIC_BASE_URL gateways with a 400/422 fallback, and 2.1.305 fixes the resulting rejected-tool-search regression on providers and gateways (checked 2026-11-05).

The problem

A security or platform team is asked to allow Claude Code on developer machines and wants to answer: what is it sending out, which APIs and tools does it call, and who ran what? An r/devops post from 17 May 2026 asked exactly this. The useful content is in several independent replies that describe the same layered answer.

What commenters described

1. Treat it like any developer tool (workstation layer). One commenter says endpoint protection, marking AI-written code as such in commits and PRs, and no deploy without human review is "all there is to it". Others replied that this is the same security model as before AI, and one doubted that human review is really enforced everywhere. Another adds: keep long-lived secrets out of shell history and env, treat repo permissions as the real boundary, and explicitly opt out of data use for training.

2. A proxy you own for model traffic. A commenter points out that the ANTHROPIC_BASE_URL environment variable can point Claude Code at a proxy, so every request and response passes your infrastructure first. Their practical notes: the proxy must handle server-sent-event streaming, not only plain JSON; the proxy should hold the real API key so the workstation never sees it; request bodies can be huge, so keep full bodies for a sample and metadata for everything. Claude Code's environment-variable docs list ANTHROPIC_BASE_URL as the way to "route requests through a proxy or gateway"; before 2.1.304, tool search for MCP was off by default behind a non-first-party host; from 2.1.304 it defaults on, with rejection fallbacks in the releases linked above, so check your behavior after adding a proxy. To inspect gateway behavior with MCP schemas loaded upfront, set ENABLE_TOOL_SEARCH=false. To enforce the gateway destination, set allowedProviders to ["customEndpoint"] in managed settings and put its ANTHROPIC_BASE_URL in the same file’s env block.

3. A gateway for MCP and internal tools. One commenter described their own setup: internal MCP servers (log, error-tracking, job and database tools) run as pods with read-only credentials behind AWS Bedrock AgentCore acting as a gateway, with JWT auth through Cognito federated to Okta, a CloudTrail trail on gateway invocations and Logstash shipping to Kibana. They can now see which user invoked which gateway, MCP server and tool. They say it took two to three weeks, mostly learning the AgentCore configuration and auth flow, and that they would now use AgentCore's own runtime logging to drop the CloudTrail and Logstash pieces (I did not verify that AgentCore feature).

4. What to log at the tool layer. Another commenter suggests separating workstation monitoring from agent monitoring, putting anything privileged behind a gateway or MCP proxy, starting read-only, and logging user identity, tool name, arguments or resource touched, read versus write, an approval ID for state-changing calls, and the result or error. For writes, have the run leave a short packet in the PR: commands run, files changed, tests skipped or failed, external systems touched, rollback path. A different commenter would log the uncomfortable events first: prompts that touched secrets, shell or network calls, file writes outside the repo, and cancelled runs.

Disagreement and limits

  • A commenter says most organizations are not dealing with this and that EDR alone leaves prompt injection, malicious MCP servers and malicious skills unaddressed; they call it an unsolved security and compliance problem.
  • Several replies are vendor comments (an AI-gateway platform, a desktop agent-monitoring product, an API-gateway company) that disclose or imply their employer. They are not evidence and are not summarized here.
  • The numbers (setup time) come from one commenter. Nobody posted a measurement of how much a proxy slows streaming or how much data it captures.
  • Logging full prompts and tool arguments creates a sensitive data store of its own; decide retention and access before turning it on.

Related

For token and cost metrics rather than audit, see the existing thread on Claude Code OpenTelemetry metrics (Claude Code documents CLAUDE_CODE_ENABLE_TELEMETRY for it).

Source: r/devops thread, comments read 17 Oct 2026; Claude Code environment variables.

Sources

Checked against primary sources:

  • Claude Code environment variables: ANTHROPIC_BASE_URL routes requests through a proxy or gateway; the earlier reference described MCP tool search as off by default behind a non-first-party host (ENABLE_TOOL_SEARCH=true if the proxy forwards tool_reference blocks); 2.1.304 changes that default as described above; CLAUDE_CODE_ENABLE_TELEMETRY=1 enables OpenTelemetry. Detail from the same page: in v2.1.196, Remote Control is disabled when the base URL points away from api.anthropic.com.

Not checked here: the r/devops thread itself (vote and comment counts, what each commenter said), the AWS Bedrock AgentCore, Cognito, CloudTrail and Logstash setup details, and the setup-time estimate. None of these were opened.

Started from a post by @r/devops commenters, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I audit what Claude Code sends and calls on company laptops?
Summary: When monitoring Claude Code at work, use three layers: ordinary endpoint controls and human review, a proxy you own for model traffic, and a gateway with identity logging for MCP tool calls. Prompt injection was described as unsolved in the discussion.
Copy for agent
get the whatworks thread agent-traffic-gateway-audit-claude-code and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-traffic-gateway-audit-claude-code
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks