
Mcp Code Execution
Coordinate MCP-backed subagents in pipeline or parallel patterns with context budgeting so long agent runs do not OOM.
Overview
Mcp-code-execution is an agent skill most often used in Build (also Ship, Operate) that defines MCP subagent pipeline and parallel coordination with MECW-aware context limits.
Install
npx skills add https://github.com/athola/claude-night-market --skill mcp-code-executionWhat is this skill?
- Pipeline coordination: sequential subagents with shared minimal context and MECW monitoring
- Emergency compaction when estimated context exceeds ~80% of MECW limit before each subagent
- Per-subagent context caps near 40% of MECW limit for focused execution
- External storage of intermediate results to limit token bleed across steps
- Version note: parallel subagents more stable on Claude Code 2.1.14+ after memory fixes
- Parallel subagents noted as more stable on Claude Code 2.1.14+
- Pipeline pattern uses ~80% MECW threshold for compaction and ~40% per-subagent context cap
Adoption & trust: 1 installs on skills.sh; 304 GitHub stars; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
What problem does it solve?
Long MCP workflows crash or degrade when subagents inherit full chat context and parallel runs exhaust memory.
Who is it for?
Indie agent builders chaining multiple MCP-backed subagents who need explicit context budgets and stable parallel execution on recent Claude Code builds.
Skip if: Single-shot tool calls with no subagent split, or environments where you cannot persist intermediate results outside the session.
When should I use this skill?
You are running multiple MCP-oriented subagents in sequence or parallel and need MECW monitoring, compaction, and intermediate result storage.
What do I get? / Deliverables
You implement pipeline or parallel subagent runs with monitored context, stored intermediate results, and bounded per-agent context for each focused task.
- Pipeline or parallel subagent orchestration pattern with context limits
- Documented handoff structure via next_input and stored intermediate results
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Subagent orchestration is filed under build agent-tooling because it defines how your coding agent executes multi-step MCP work during implementation. Pipeline coordination, MECW limits, and intermediate external storage are agent-runtime concerns, not single-feature frontend tasks.
Where it fits
Chain implementation, test-generation, and docs subagents where each step only receives the prior step’s next_input blob.
Run a focused review subagent after compaction so security checks do not reload the entire implementation transcript.
Split production incident analysis into sequential subagents with externally stored findings to avoid context blow-up.
How it compares
Procedural orchestration patterns for MCP subagents—not a drop-in MCP server or a simple code-exec sandbox package.
Common Questions / FAQ
Who is mcp-code-execution for?
Solo developers designing multi-step agent workflows that delegate slices of work to subagents behind MCP tools.
When should I use mcp-code-execution?
During Build when implementing agent pipelines, at Ship when staging review or test subagents sequentially, or at Operate when breaking incident triage into isolated agent passes.
Is mcp-code-execution safe to install?
Use the Security Audits panel on this page; subagent patterns may invoke shell, network, or repo tools depending on your MCP setup—scope each subagent narrowly.
SKILL.md
READMESKILL.md - Mcp Code Execution
# MCP Subagent Coordination Patterns > **Version Note (Claude Code 2.1.14+)**: Parallel subagent execution is significantly more stable in Claude Code 2.1.14+, which fixed memory issues that could cause crashes when running parallel subagents. Earlier versions may experience heap out of memory errors with 3+ concurrent agents. ## Pipeline Coordination Execute subagents in sequence with MECW monitoring: ```python def coordinate_pipeline_subagents(subagents, input_data): """Execute subagents in sequence with MECW monitoring""" current_data = input_data results = [] for subagent in subagents: # Monitor context before each subagent if estimate_context_usage() > get_mecw_limit() * 0.8: apply_emergency_compaction() # Execute subagent with minimal context subagent_result = subagent.execute_focused_task({ 'data': current_data, 'context_limit': get_mecw_limit() * 0.4 }) current_data = subagent_result.get('next_input', current_data) results.append(subagent_result) # Store intermediate results externally store_intermediate_result(subagent.purpose, subagent_result) return results ``` ### When to Use Pipeline - **Sequential dependencies**: Each step depends on previous result - **Linear workflows**: Clear progression from input to output - **Token conservation**: Share minimal context between steps - **Error isolation**: Failures don't cascade to all subagents ## Parallel Coordination Execute multiple subagents simultaneously: ```python def coordinate_parallel_subagents(subagents, input_data): """Execute multiple subagents simultaneously""" # Split input data for parallel processing data_splits = split_input_for_parallel(input_data, len(subagents)) # Launch subagents with minimal context futures = [] for subagent, data_split in zip(subagents, data_splits): future = subagent.execute_async({ 'data': data_split, 'context_limit': get_mecw_limit() // len(subagents) }) futures.append(future) # Collect results with external storage results = [] for future in futures: result = future.get_result() store_external_result(result.subagent_id, result.data) results.append(result) return synthesize_parallel_results(results) ``` ### When to Use Parallel - **Independent tasks**: No dependencies between subagents - **Time-sensitive**: Need faster completion - **Resource distribution**: Share MECW budget across subagents - **Diverse expertise**: Different domains being processed ## Hybrid Coordination Combine pipeline and parallel patterns: ```python def coordinate_hybrid_subagents(phase_groups): """Execute phases sequentially, subagents within each phase in parallel""" all_results = [] for phase in phase_groups: # Execute subagents in this phase in parallel phase_results = coordinate_parallel_subagents( phase.subagents, phase.input_data ) # Synthesize phase results before next phase synthesized = synthesize_phase_results(phase_results) all_results.append(synthesized) # Pass synthesized results to next phase if phase.has_next(): phase.next().set_input_data(synthesized) return combine_phase_results(all_results) ``` ### When to Use Hybrid - **Complex workflows**: Mix of sequential and parallel steps - **Phase dependencies**: Groups of parallel tasks with inter-group dependencies - **Resource optimization**: Balance speed (parallel) with coordination (sequential) ## Emergency Patterns ### Context Overflow Recovery ```python def handle_context_overflow(subagent, current_state): """Emergency handling when subagent exceeds MECW limits""" # 1. Immediately store current state externally store_emergency_state(subagent.id, current_state) # 2. Split task into smaller sub-s