[FEATURE] Cloud-hosted MCP tools (mcp__claude_ai_*) unavailable in pipe mode (-p) / SDK mode
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Cloud-hosted MCP tools (mcp__claude_ai_* — Slack, Notion, Indeed, Vercel, Gmail, Calendar, Snowflake, etc.) are completely unavailable when Claude Code runs in pipe mode (-p) or via the @anthropic-ai/claude-code SDK.
These tools work perfectly in interactive CLI mode (entrypoint: "cli") but are stripped from the system prompt in pipe/SDK mode (entrypoint: "sdk-cli").
Evidence from the same machine, same user, same version (2.1.81), same model:
| | Interactive CLI | Pipe mode (-p) |
|---|---|---|
| entrypoint | "cli" | "sdk-cli" |
| system prompt tokens | ~128K | ~115K |
| cloud MCP tools | All available | None |
| local MCP tools | All available | All available |
The ~13K token difference corresponds exactly to the missing cloud MCP tool definitions.
Repro:
# Interactive — works ✅
claude
> List tools starting with "mcp__claude_ai_Slack"
# Pipe mode — fails ❌
claude -p "List tools starting with mcp__claude_ai_Slack. If none, say NONE FOUND."
# → NONE FOUND
Proposed Solution
Cloud-hosted MCP tools should be available in pipe mode (-p) and SDK mode when the user is authenticated and has these integrations connected in their claude.ai account.
Possible approaches:
- A flag like
--enable-cloud-mcpto opt-in for pipe mode - Honor an env var like
ENABLE_CLAUDEAI_MCP_SERVERS=truein pipe mode - Include cloud MCP tools by default in pipe mode (same as interactive)
Any of these would unblock programmatic usage of cloud MCP integrations.
Alternative Solutions
All tested, all failed:
ENABLE_CLAUDEAI_MCP_SERVERS=trueenv var — no effect in pipe mode- Fake TTY via
script -q /dev/null— no effect (not a TTY check, it's the-pflag itself) --input-format stream-jsonvs plain-p— no difference, both exclude cloud MCP- Explicit
HOMEenv var — no effect
The only remaining option is configuring each cloud MCP service as a separate local MCP server with individual Bot Tokens/OAuth — which defeats the purpose of claude.ai managed integrations, especially for users with 5+ connected services.
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
- I'm building a web UI (Claude Lens) for Claude Code that spawns chat sessions via
-p --output-format stream-json --input-format stream-json - Users have connected Slack, Notion, Gmail, Calendar, Snowflake, and other services through their claude.ai account
- In the native terminal, all these MCP tools work — users can search Slack, create Notion pages, read emails, etc.
- In the web UI (which uses pipe mode), none of these cloud MCP tools are available
- Users expect the same tool access in both interfaces since it's the same machine, same auth, same Claude Code binary
- This blocks any application built on top of Claude Code (via
-por the SDK) from using cloud-hosted MCP integrations
Additional Context
- Claude Code version: 2.1.81
- macOS Darwin 25.3.0
- All cloud MCP integrations properly connected and working in interactive mode
- Local MCP servers (mcp__github__, mcp__google-workspace__, mcp__notion-hq__, etc.) work fine in pipe mode — only cloud-hosted ones (mcp__claude_ai__*) are excluded
- The
~/.claude/mcp-needs-auth-cache.jsonfile exists, suggesting cloud MCP auth state is persisted locally — so pipe mode could potentially read it
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗