From fh-commons
Detects MCP tool failure patterns and trips a circuit breaker to stop cascading retries. Proposes fallback alternatives and resets when the tool recovers. Triggers on "MCP failing", "tool keeps erroring", "circuit-breaker", repeated tool call failures.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fh-commons:mcp-circuit-breakersonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
MCP tools can fail silently or return partial results, leading to cascading retry loops that waste tokens and degrade session quality. This skill detects failure patterns, trips a circuit breaker to halt retries, proposes alternatives, and resets when the tool recovers.
MCP tools can fail silently or return partial results, leading to cascading retry loops that waste tokens and degrade session quality. This skill detects failure patterns, trips a circuit breaker to halt retries, proposes alternatives, and resets when the tool recovers.
Scope distinction
- Claude Code native retry: low-level transport retries (transparent, fast)
- mcp-circuit-breaker: session-level guard — detects repeated semantic failures, intervenes before token waste compounds
/mcp-circuit-breakerCLOSED → Normal operation (tool calls pass through)
OPEN → Circuit tripped (calls blocked, alternatives proposed)
HALF-OPEN → Recovery probe (1 test call allowed, resets if success)
Default thresholds:
Identify the failing tool and failure mode:
# Check MCP server config
cat .claude/settings.json 2>/dev/null | grep -A5 '"mcpServers"' || echo "No MCP config found"
Classify failure type:
| Type | Symptom | Likely Cause |
|---|---|---|
TIMEOUT | Tool call hangs >30s | Server overload / network |
AUTH | 401 / 403 response | Credentials expired or missing |
NOT_FOUND | 404 / tool not available | Server down / tool removed |
MALFORMED | Parse error on response | Schema mismatch / API change |
RATE_LIMIT | 429 / quota exceeded | Too many calls |
If failure type cannot be determined: classify as UNKNOWN.
Count consecutive failures of the identified tool in the current session context.
| Count | Action |
|---|---|
| 1 | Log warning. Continue — "MCP tool {name} failed once. Monitoring." |
| 2 | Escalate warning. Suggest checking server status. |
| 3+ | TRIP CIRCUIT → output circuit open notice, block further calls to this tool |
Circuit open notice format:
⚡ CIRCUIT OPEN — {tool-name}
Failure type: {TYPE} | Consecutive failures: {N}
Further calls to this tool are blocked until circuit resets.
Write state to session-local file (in-memory is insufficient — logs survive /clear):
mkdir -p .claude/mcp_circuit/
# Append to circuit log
Log entry format:
- tool: {tool-name}
state: OPEN
failure_type: {TYPE}
failure_count: {N}
tripped_at: {ISO-8601}
reset_at: null
Present 3 fallback options ranked by effort:
| Priority | Alternative | When to Use |
|---|---|---|
| 1 — Substitute tool | Use a different MCP tool or built-in tool that covers the same task | Tool-specific failure (NOT_FOUND, AUTH) |
| 2 — Degrade gracefully | Skip the MCP step, note the gap, continue with available information | TIMEOUT / RATE_LIMIT |
| 3 — Pause and retry | Wait for server recovery (HALF-OPEN probe after cooldown) | Transient failure (TIMEOUT, RATE_LIMIT) |
Output format:
## Fallback Options for {tool-name}
Option 1 — Substitute: Use {alternative-tool} instead
→ Command: [specific invocation]
→ Gap: [what's different vs. original tool]
Option 2 — Degrade: Skip this step, continue without {capability}
→ Impact: [what is missing from the output]
Option 3 — Retry after cooldown (60s)
→ Run: /mcp-circuit-breaker reset {tool-name}
When user requests reset or after cooldown:
Sending HALF-OPEN probe to {tool-name}...
Reset log entry:
state: CLOSED
reset_at: {ISO-8601}
reset_method: probe_success | user_forced
At session end or on demand:
## MCP Circuit Breaker Report
| Tool | State | Failures | Tripped | Reset |
|---|---|---|---|---|
| {tool} | OPEN | 4 | 14:23 | — |
| {tool} | CLOSED | 1 | 14:10 | 14:15 (probe) |
Recommendations:
- {tool}: AUTH failure → refresh credentials in .claude/settings.json
Upstream (can trigger this skill):
Downstream (after circuit open):
context-doctor if MCP failure is due to large context degrading tool callsnpx claudepluginhub chrono-meta/forge-harness --plugin fh-commonsCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.