claude-code - 💡(How to fix) Fix Claude should proactively connect token env vars to empty Bearer slots in settings files [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56224Fetched 2026-05-06 06:33:51
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Timeline (top)
commented ×1

When Claude Code is activated remotely and asked to investigate available MCP tools, Claude does not proactively check ~/.claude/settings.json for MCP server configuration, nor does it connect token env vars it has already observed to empty Bearer token slots in that file — even though both facts are visible and the connection is straightforward. This behaviour has been reproduced across multiple independent sessions.

Root Cause

This is a general reasoning gap: Claude should connect related evidence it has already gathered rather than waiting to be prompted. The settings file and the env vars are both in Claude's context. The fact that it recurred in a second independent session confirms this is a systematic behaviour gap, not an isolated miss.

RAW_BUFFERClick to expand / collapse

Summary

When Claude Code is activated remotely and asked to investigate available MCP tools, Claude does not proactively check ~/.claude/settings.json for MCP server configuration, nor does it connect token env vars it has already observed to empty Bearer token slots in that file — even though both facts are visible and the connection is straightforward. This behaviour has been reproduced across multiple independent sessions.

What happened

In a remote session:

  1. MCP_TOKEN=<value> and N8N_TOOLS_TOKEN=<value> were present in the environment.
  2. ~/.claude/settings.json contained "Authorization": "Bearer " (empty) for both MCP servers.
  3. The MCP servers' tools were absent from the session.

Claude did not check the settings file until explicitly prompted, and did not connect the env vars to the empty token slots until a second prompt. The user had to guide the investigation step by step. This occurred again in a follow-up session after the issue was first observed, confirming it is consistent and reproducible — not a one-off.

Expected behaviour

When investigating why an MCP server's tools are unavailable, Claude should:

  1. Check Claude Code settings files (~/.claude/settings.json, project .claude/settings.json) as a first step — this is where MCP server configuration always lives.
  2. When env vars whose names contain TOKEN, KEY, or SECRET are observed, check whether any correspond to an empty credential slot in any config file already read — using the naming convention server-nameUPPER_SNAKE_CASE_TOKEN as a first pass, then fuzzy word-overlap matching.
  3. Report the mismatch and proposed fix proactively, before asking the user what to do next.

Why this matters

This is a general reasoning gap: Claude should connect related evidence it has already gathered rather than waiting to be prompted. The settings file and the env vars are both in Claude's context. The fact that it recurred in a second independent session confirms this is a systematic behaviour gap, not an isolated miss.

Environment

  • Claude Code version: 2.1.42
  • Platform: Linux 6.18.5
  • Entrypoint: remote_trigger (Claude Code on the web)

Labels

claude mcp model-behaviour

extent analysis

TL;DR

Claude Code needs to be updated to proactively check the ~/.claude/settings.json file for MCP server configuration and connect observed token environment variables to empty Bearer token slots.

Guidance

  • Review the Claude Code version 2.1.42 to identify potential gaps in its logic for checking settings files and connecting environment variables to credential slots.
  • Verify that the ~/.claude/settings.json file is being read correctly and that the environment variables MCP_TOKEN and N8N_TOOLS_TOKEN are being observed by Claude Code.
  • Consider implementing a fuzzy word-overlap matching approach to connect environment variables to empty credential slots in the settings file, as described in the expected behavior.
  • Test the updated logic in a controlled environment to ensure it proactively checks the settings file and connects environment variables to credential slots without requiring user prompts.

Example

No code snippet is provided as the issue description does not include specific code details.

Notes

The issue appears to be a systematic behavior gap in Claude Code, and addressing it may require updates to the code's logic for handling settings files and environment variables.

Recommendation

Apply a workaround by explicitly prompting Claude Code to check the ~/.claude/settings.json file and connect environment variables to credential slots until the underlying issue is addressed in a future version of Claude Code.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Claude should proactively connect token env vars to empty Bearer slots in settings files [1 comments, 2 participants]