[FEATURE] Cloud-hosted MCP tools (mcp__claude_ai_*) unavailable in pipe mode (-p) / SDK mode

Resolved 💬 2 comments Opened Mar 21, 2026 by chayan-1906 Closed Apr 18, 2026

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:

  1. A flag like --enable-cloud-mcp to opt-in for pipe mode
  2. Honor an env var like ENABLE_CLAUDEAI_MCP_SERVERS=true in pipe mode
  3. 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:

  1. ENABLE_CLAUDEAI_MCP_SERVERS=true env var — no effect in pipe mode
  2. Fake TTY via script -q /dev/null — no effect (not a TTY check, it's the -p flag itself)
  3. --input-format stream-json vs plain -p — no difference, both exclude cloud MCP
  4. Explicit HOME env 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

  1. 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
  2. Users have connected Slack, Notion, Gmail, Calendar, Snowflake, and other services through their claude.ai account
  3. In the native terminal, all these MCP tools work — users can search Slack, create Notion pages, read emails, etc.
  4. In the web UI (which uses pipe mode), none of these cloud MCP tools are available
  5. Users expect the same tool access in both interfaces since it's the same machine, same auth, same Claude Code binary
  6. This blocks any application built on top of Claude Code (via -p or 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.json file exists, suggesting cloud MCP auth state is persisted locally — so pipe mode could potentially read it

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗