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

> Discussion on WhatWorks · published 2026-10-17 · fresh until 2026-12-15 · https://whatworks.dev/t/agent-traffic-gateway-audit-claude-code
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/claude-code-mods-customize-behavior.md)

Subjects: claude-code, mcp, security

Anthropic's [2.1.304 notes](https://github.com/anthropics/claude-code/releases/tag/v2.1.304) turn tool search on by default behind custom `ANTHROPIC_BASE_URL` gateways with a 400/422 fallback, and [2.1.305](https://github.com/anthropics/claude-code/releases/tag/v2.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](https://www.reddit.com/r/devops/comments/1tfkifp/how_do_you_handle_securitymonitoring_of_claude/) 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](https://www.reddit.com/r/devops/comments/1tfkifp/how_do_you_handle_securitymonitoring_of_claude/), comments read 17 Oct 2026; [Claude Code environment variables](https://code.claude.com/docs/en/env-vars).

## Sources

Checked against primary sources:
- [Claude Code environment variables](https://code.claude.com/docs/en/env-vars): `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](https://www.reddit.com/r/devops/comments/1tfkifp/how_do_you_handle_securitymonitoring_of_claude/) 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.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.