New ask Hacker News story: I Improved Claude's MCP-CLI Experimental MCP Fix – 18x speedup on 50 calls
I Improved Claude's MCP-CLI Experimental MCP Fix – 18x speedup on 50 calls
2 by AIntelligentTec | 0 comments on Hacker News.
Claude Code has an experimental 'mcp-cli' for invoking MCP servers (Google Workspace, GitHub, etc.) from bash. Problem: it runs sequentially by default. My workflow hits 50+ MCP calls. That was 191 seconds—over 3 minutes waiting before Claude could synthesize anything. I discovered you can orchestrate parallel calls within a single Bash tool invocation: mcp-cli call google/get_events '{}' > /tmp/cal.json & mcp-cli call google/list_tasks '{}' > /tmp/tasks.json & mcp-cli call github/list_issues '{}' > /tmp/issues.json & wait The non-obvious part: this only works because background jobs (&) inherit the parent shell environment. Claude Code's session context—including MCP endpoint files—stays accessible. If you spawn a new subshell (bash -c 'mktemp -d; mcp-cli...'), context breaks with "MCP endpoint file not found." That was the gotcha that took a while to figure out. Benchmarks (verified January 2026): 2 calls: 7.6s → 3.8s (2x) 10 calls: 38s → 3.0s (13x) 20 calls: 76s → 4.9s (16x) 50 calls: 191s → 10.3s (18x) I packaged this into a self-contained toolkit: - CLAUDE.md snippet with usage instructions - .claude/rules/ patterns (FORBIDDEN/REQUIRED examples) - Advisory hook that reminds about parallel patterns - Install script for project or user-level setup https://ift.tt/TZdQlmp Requires ENABLE_EXPERIMENTAL_MCP_CLI=true (the mcp-cli is still experimental). Curious if others are hitting similar bottlenecks or have found other optimisation patterns for MCP-heavy Claude Code workflows.
2 by AIntelligentTec | 0 comments on Hacker News.
Claude Code has an experimental 'mcp-cli' for invoking MCP servers (Google Workspace, GitHub, etc.) from bash. Problem: it runs sequentially by default. My workflow hits 50+ MCP calls. That was 191 seconds—over 3 minutes waiting before Claude could synthesize anything. I discovered you can orchestrate parallel calls within a single Bash tool invocation: mcp-cli call google/get_events '{}' > /tmp/cal.json & mcp-cli call google/list_tasks '{}' > /tmp/tasks.json & mcp-cli call github/list_issues '{}' > /tmp/issues.json & wait The non-obvious part: this only works because background jobs (&) inherit the parent shell environment. Claude Code's session context—including MCP endpoint files—stays accessible. If you spawn a new subshell (bash -c 'mktemp -d; mcp-cli...'), context breaks with "MCP endpoint file not found." That was the gotcha that took a while to figure out. Benchmarks (verified January 2026): 2 calls: 7.6s → 3.8s (2x) 10 calls: 38s → 3.0s (13x) 20 calls: 76s → 4.9s (16x) 50 calls: 191s → 10.3s (18x) I packaged this into a self-contained toolkit: - CLAUDE.md snippet with usage instructions - .claude/rules/ patterns (FORBIDDEN/REQUIRED examples) - Advisory hook that reminds about parallel patterns - Install script for project or user-level setup https://ift.tt/TZdQlmp Requires ENABLE_EXPERIMENTAL_MCP_CLI=true (the mcp-cli is still experimental). Curious if others are hitting similar bottlenecks or have found other optimisation patterns for MCP-heavy Claude Code workflows.
Comments
Post a Comment