Remote MCP tools not available as deferred tools in pipe mode (-p)
Description
Remote MCP servers (Gmail, Slack, Notion, etc.) connected via claude.ai OAuth are not available in claude -p (pipe mode) sessions, even though claude mcp list shows them as ✓ Connected.
Environment
- Claude Code version: 2.1.81
- OS: Amazon Linux 2023 (EKS pod)
- Auth: claude.ai enterprise (OAuth)
Steps to reproduce
- Verify MCP connection:
claude mcp listshowsclaude.ai Gmail: ✓ Connected - Interactive session: Gmail MCP tools work fine (ToolSearch finds them, calls succeed)
- Pipe mode:
echo 'Call ToolSearch with query="gmail"' | claude -p→No matching deferred tools found
Expected behavior
Remote MCP tools should be available as deferred tools in -p mode, same as in interactive sessions.
Actual behavior
ToolSearch("gmail") returns "No matching deferred tools found" in -p mode. The model cannot discover or use any remote MCP tools.
Impact
All cron-based automation using claude -p with MCP tools (Gmail scan, Slack search, etc.) is broken. This was working on a previous pod (likely earlier Claude Code version).
Workaround
For Slack: using bot token API calls to pre-fetch data before passing to claude -p.
For Gmail: no workaround available without separate Google OAuth setup.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗