[BUG] [regression] HTTP MCP server with Bearer token shows "needs-auth" in claude -p mode since 2.1.83 (worked in 2.1.81)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Bug Description
HTTP MCP server configured with a Bearer token in headers shows status needs-auth
and no MCP tools are available when running claude -p (headless/print mode).
The same configuration works correctly in interactive mode.
Regression
- Last working version: 2.1.81
- Broken since: 2.1.83
- Platform: macOS
MCP Configuration (~/.claude.json)
{
"mcpServers": {
"myserver": {
"type": "http",
"url": "https://example.com/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
Reproduction
claude -p "list mcp tools" --verbose --output-format stream-json
Actual (2.1.83+)
mcp_servers: [{ "name": "myserver", "status": "needs-auth" }]
No MCP tools available — Claude falls back to WebFetch/WebSearch.
Notes
This is a Bearer token setup, NOT OAuth — no auth flow should be needed.
In 2.1.81, status was "connected" and tools loaded correctly.
What Should Happen?
Expected
mcp_servers: [{ "name": "myserver", "status": "connected" }]
MCP tools available in session.
Error Messages/Logs
Steps to Reproduce
#works
claude mcp list
#does not work
claude -p "list mcp tools" \
--verbose \
--output-format stream-json \
2>/dev/null | python3 -c "
import sys, json
for line in sys.stdin:
try:
d = json.loads(line.strip())
if d.get('type') == 'system':
print('mcp_servers:', d.get('mcp_servers'))
print('mcp tools:', [t for t in d.get('tools',[]) if 'mcp' in t][:3])
except: pass
"
---
2.1.81: mcp_servers: [{'name': 'server-name', 'status': 'connected'}]
2.1.83+: mcp_servers: [{'name': 'server-name', 'status': 'needs-auth'}]
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.81
Claude Code Version
2.1.81
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗