[BUG] claude.ai MCP connectors not available in -p / --print mode
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?
MCP servers connected via claude.ai native connectors (HTTP-based, OAuth-authenticated) show as "Connected" in claude mcp list but are completely unavailable when Claude Code runs in any non-interactive mode. The init message in stream-json output shows "mcp_servers":[], and the model has zero access to MCP tools.
This affects all programmatic invocation paths: --print, --output-format stream-json, and piped stdin.
What Should Happen?
MCP servers that are connected and healthy (verified via claude mcp list) should also be available when using -p / --print mode or --input-format stream-json. The mcp_servers array in the stream-json init message should list the same servers that appear in interactive mode.
Error Messages/Logs
Steps to Reproduce
- Confirm MCP servers are connected:
claude mcp list
Output:
rube
Type: project
Status: connected
Protocol: HTTP (Streamable)
URL: https://rube.app/mcp
Tools: 11
claude_ai_Rube
Type: claude_ai
Status: connected
Protocol: HTTP (Streamable)
Tools: 11
claude_ai_Granola
Type: claude_ai
Status: connected
Protocol: HTTP (Streamable)
Tools: 4
claude_ai_Slack
Type: claude_ai
Status: connected
Protocol: HTTP (Streamable)
Tools: 12
- Run in print mode -- no MCP tools available:
claude -p "List every tool you have access to that starts with mcp" --dangerously-skip-permissions
Result: Model lists only 17 core tools (Read, Write, Edit, Bash, Glob, Grep, etc.). Zero MCP tools.
- Verify via stream-json init message:
claude -p "hello" --output-format stream-json --verbose --dangerously-skip-permissions
Init message contains:
{"type":"system","subtype":"init","mcp_servers":[], ...}
- Also tested and confirmed broken:
claude --input-format stream-json with JSON piped via stdin
echo "test" | claude (piped stdin, non-TTY)
claude -p --mcp-config '{"mcpServers":{"rube":{"type":"http","url":"https://rube.app/mcp"}}}' -- tools appear in --mcp-config listing but mcp_servers:[] persists in init
- Confirm it works interactively: Launch claude in a TTY terminal (VSCode integrated terminal). Same machine, same config. MCP servers connect and all tools are available.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.14
Platform
Other
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
Claude subscription (not API key)
MCP server type: claude_ai (HTTP, OAuth-authenticated via claude.ai)
Impact
This blocks programmatic use of Claude Code for any workflow that depends on MCP tools. Our use case: wrapping existing CLI slash commands with a Slack bot so a team can invoke them without terminal access. The commands require Rube MCP (Dropbox, Gmail, Calendar, Sheets) to function.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗