/use-mcp
Execute Model Context Protocol (MCP) operations via Gemini CLI to preserve context budget.
Syntax
/use-mcp [task]
How It Works
-
Primary: Execute via Gemini CLI (stdin pipe):
echo "$ARGUMENTS. Return JSON only per GEMINI.md instructions." | gemini -y -m gemini-2.5-flash -
Fallback: If Gemini CLI unavailable, use
mcp-managersubagent
Key Rules
- MUST use stdin piping - deprecated
-pflag skips MCP initialization - Use
-yflag to auto-approve tool execution GEMINI.mdauto-loaded from project root- Response format:
{"server":"name","tool":"name","success":true,"result":<data>,"error":null}
Anti-Pattern
# ❌ BROKEN - deprecated -p flag skips MCP connections!
gemini -y -m gemini-2.5-flash -p "..."
# ✅ CORRECT
echo "your task" | gemini -y -m gemini-2.5-flash
When to Use
- Browser automation via MCP
- External tool integrations
- Database operations via MCP
- Any task requiring MCP server tools
Key Takeaway: Use /use-mcp to execute MCP operations through Gemini CLI with stdin piping, preserving Claude’s context budget.