Skip to content

feat(claude-code): turn off claude.ai connectors in both variants - #313

Open
gatezh wants to merge 5 commits into
claude-code/firewall-claude-hostsfrom
claude-code/no-claudeai-connectors
Open

gatezh wants to merge 5 commits into
claude-code/firewall-claude-hostsfrom
claude-code/no-claudeai-connectors

Conversation

@gatezh

@gatezh gatezh commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

What

Both claude-code templates set ENABLE_CLAUDEAI_MCP_SERVERS=false in containerEnv, so Claude Code in the container doesn't fetch the connectors on the signed-in claude.ai account.

Why

For claude.ai-authenticated users, Claude Code fetches the account's connectors by default (Gmail, Drive and the rest, plus Anthropic's own such as Claude Docs) and routes them through mcp-proxy.anthropic.com (network requirements). A project container should get MCP servers from its plugins, its .mcp.json and the image's managed settings. Personal mailbox and drive tools don't belong next to project code, and in the sandbox the agent runs with permission prompts skipped. A downstream project has run this setting in its default variant without problems.

Mechanism

The docs say ENABLE_CLAUDEAI_MCP_SERVERS=false and disableClaudeAiConnectors: true have the same effect on the connectors Claude Code fetches itself, in terminal and VS Code sessions. Whichever one turns the connectors off, the other can't turn them back on.

  • Chosen: env var in the templates' containerEnv. It reaches every process in the container, both the extension host and terminals. It stays inside the container, and a project that wants its connectors back deletes one line.
  • Rejected: disableClaudeAiConnectors in the image's managed-settings.json. The setting is any-source-true, so no project could undo a managed true without rebuilding the image.
  • Rejected: disableClaudeAiConnectors in the template's .claude/settings.json. The env-vars docs recommend this for per-project use. But a project's settings file also applies to Claude Code on the host in the same repo, not just inside the container.

Changes

  • claude-code/.devcontainer/devcontainer.json and claude-code/.devcontainer/claude-sandbox/devcontainer.json: the env var, with a short why-comment.
  • claude-code/README.md: a "claude.ai connectors are off" note under the MCP section. It covers what's turned off, what still loads, how to opt back in, and why this isn't the native setting.

Notes

  • Sandbox: a setup-token token can't fetch connectors anyway (docs), so in the sandbox the variable matters only when someone signs in there instead. fix(claude-code, claude-bun): sync the firewall's Claude hosts with the network requirements #314 documents that sign-in works through the firewall, and mcp-proxy.anthropic.com shares api.anthropic.com's IP, so connectors would load there without this line.
  • Checks: both files parse as JSON once comments are stripped, and containerEnv.ENABLE_CLAUDEAI_MCP_SERVERS is "false" in each. The Claude Code 2.1.332 binary in the published image reads the variable. Nothing in the image changes, so verify-image.sh and CI are unaffected.
  • Wiki: a fresh clone mentions neither connectors nor containerEnv, so nothing goes stale.
  • Downstream: projects pick this up through the devcontainer-upstream-sync audit, which tracks devcontainer.json as framework-track.

Claude Code fetches the connectors on the signed-in claude.ai account (Gmail,
Drive, ...) by default. A project container should get MCP from its plugins
and the image's managed settings only, so both templates set
ENABLE_CLAUDEAI_MCP_SERVERS=false in containerEnv.

Template, not managed settings: disableClaudeAiConnectors is any-source-true,
so a managed `true` would leave no project a way to turn connectors back on.
…alone

The comment said a project container gets MCP from its plugins only, and the
README from plugins and managed settings only; the project's .mcp.json loads
too. Both now say the variable turns off every connector Claude Code fetches,
Anthropic's own Claude Docs included. The README also says why the native
disableClaudeAiConnectors setting, which the docs suggest per project, isn't
used: a project .claude/settings.json follows the repo to the host.
# Conflicts:
#	claude-code/.devcontainer/claude-sandbox/devcontainer.json
@gatezh
gatezh changed the base branch from master to claude-code/firewall-claude-hosts November 27, 2026 20:22
@gatezh
gatezh added this pull request to stack #321 November 27, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant