BailoutMCP
Uses Google Gemini Pro (gemini-2.5-pro) via the Gemini API as a heavy-model provider and fallback.
Runs local offline reasoning models such as qwen2.5-coder:32b through Ollama for private heavy-model bailouts.
Sends bailout escalations to OpenAI o3 (and auto-detects o1/o3/o4) for background pre-solving of stubborn coding issues.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
🛟 BailoutMCP
Shadow-State Frustration Detector & Silent Pre-Solved Heavy-Model Bailout Trigger
Stop waiting until you're furious to switch models.
BailoutMCP detects when you (or a fast coding model) are silently trapped in an undo/oscillation/error loop, quietly escalates a secret-redacted micro-context to a frontier reasoning model, validates the surgical diff, and offers it only during a natural micro-pause.
Why BailoutMCP • Architecture • Quick Start • Providers • MCP Reference • Security Model
🔥 The Problem Nobody Solved
Every developer using AI coding assistants hits the exact same wall every day:
You run a fast, affordable model (like Sonnet, Flash, or a local model) to preserve speed and quota.
You hit a tricky state, concurrency, or type bug. You spend 10+ minutes on the same file — spamming
Ctrl+Z, oscillatingA → B → Aon the same lines, hitting the same compiler/test error 4 times, while the lightweight model patches symptoms in circles.The AI has zero clue you're stuck until you angrily type "this still doesn't work, stop guessing!" — and then you have to manually switch to Opus / Gemini Pro / o3 and re-explain everything from scratch.
BailoutMCP closes that loop silently in the background:
"Stuck on
CartCounter.tsx? Escalated toclaude-opus-4-6and validated a 1-line fix (94% confidence): 'Use functional React state updater to fix stale closure'. Review diff?"
100% Real Data & Real Models: Zero fake/mock analyzers, zero hardcoded fallbacks. If no real model provider is configured, BailoutMCP honestly reports
routerReady: false.Zero-Clippy Anti-Annoyance Gate: Never pops up mid-keystroke. Waits silently for a natural micro-pause (
>= 3.5sidle), auto-invalidates if you solve the bug yourself (Micro-Win reset), and backs off exponentially (1x → 2x → 4x) whenever dismissed.Privacy-First & Hardened: Raw keystrokes are never logged or transmitted. Sensitive files (
.env*, keys,.ssh,.aws, DBs) are strictly blocked, and secrets are scrubbed before any code snippet leaves your machine.
Related MCP server: jev-harness
⚡ How It Differs From Existing Tools
Capability | Regex Frustration Checks | Proxy Stall Routers (LiteLLM / Advisor) | BailoutMCP |
Detects frustration before you type an angry prompt | ❌ | ❌ | ✅ |
Tracks native | ❌ | ❌ | ✅ |
Bridges IDE behavioral signals (VS Code/Cursor) with CLI agents (Claude Code) | ❌ | ❌ | ✅ |
Silently pre-solves & validates exact surgical diff in background | ❌ | ❌ | ✅ |
Natural-pause timing gate (never interrupts mid-typing) | ❌ | ❌ | ✅ |
Micro-Win reset (auto-clears friction & discards stale bailout when errors drop to 0) | ❌ | ❌ | ✅ |
Cross-provider heavy routing (Opus, Gemini Pro, o3, OpenRouter, Ollama, LiteLLM) | ❌ | Partial | ✅ |
🏗 Architecture
flowchart LR
subgraph Sensors["100% Local Structural Sensors (No Keylogging)"]
IDE["VS Code / Cursor Extension\n• Native Ctrl+Z Undo/Redo\n• Edit Churn & A→B→A Hash\n• Debounced LSP Diagnostics\n• Terminal Non-Zero Exits"]
HOOKS["Claude Code Hooks & Watcher\n• PostToolUse Exec Errors\n• Prompt Retry Signals\n• File-Save Churn Watcher"]
end
subgraph Bridge["@bailout-mcp/server (127.0.0.1 Token Auth + Host/CSRF Guard)"]
SSE["HTTP + SSE Shared Telemetry Bus"]
MCP["Stdio MCP Server\n7 Tools • 3 Resources • 1 Prompt"]
end
subgraph Core["@bailout-mcp/core"]
SS["Shadow-State Scorer (0–100)\n+ Micro-Win Reset"]
DIST["Context Distiller (±45 lines)\n+ Workspace Jail + Secret Redactor"]
ROUTER["Universal Bailout Router\nOpus • Gemini Pro • o3 • Ollama • LiteLLM"]
PATCH["Patch Validator + Safety Guard\nExact Line Anchor + Atomic Write"]
GATE["Anti-Annoyance Timing Gate\nWaits for Natural Micro-Pause"]
end
IDE -->|X-Bailout-Token| SSE
HOOKS -->|X-Bailout-Token| SSE
SSE --> SS
MCP --> SS
SS -->|score >= 70| DIST
DIST --> ROUTER
ROUTER --> PATCH
PATCH --> GATE
GATE -->|SSE Toast / Diff| IDE
GATE -->|Hook / MCP Tool| MCPMonorepo Layout
Package / Path | Purpose |
Zero-dependency TypeScript core: Shadow-State scorer, error signature normalizer, secret redactor, security jail, context distiller, universal model router, surgical patcher, and pause timing gate | |
Stdio MCP server ( | |
Thin VS Code / Cursor companion extension with calm Status Bar HUD, native side-by-side | |
Non-blocking | |
Standard Agent Skill ( |
🚀 Quick Start
1. Clone, Install, Build & Test
git clone https://github.com/Sunil56224972/BailoutMCP.git
cd BailoutMCP
pnpm install
pnpm run build
pnpm run test2. Configure Your Real Heavy-Model Provider
Copy .env.example to .env (in your workspace root or ~/.bailout-mcp/.env) and add at least one real provider:
cp .env.example .envExample .env (Anthropic Opus primary, Gemini Pro fallback):
BAILOUT_PROVIDER=anthropic
BAILOUT_FALLBACK_PROVIDERS=gemini
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=AIza...Verify provider readiness & security configuration:
pnpm run doctor3. Connect BailoutMCP to Claude Code / Cursor / Windsurf / Antigravity
Generate your local .bailout.json and exact MCP JSON snippet:
node packages/mcp-server/dist/src/cli.js initAdd to your MCP client configuration:
{
"mcpServers": {
"bailout": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/BailoutMCP/packages/mcp-server/dist/src/cli.js"],
"env": {
"BAILOUT_PROVIDER": "anthropic",
"ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}"
}
}
}
}When the MCP server starts, it automatically connects to an existing local bridge or starts one on
127.0.0.1:47821(with ephemeral port fallback on collision) so VS Code, Cursor, and Claude Code hooks share the exact same live Shadow-State.
4. Enable the VS Code / Cursor Companion Extension (Optional)
Open
packages/vscode-extensionin VS Code or Cursor and pressF5(or build a.vsixpackage).It auto-discovers
~/.bailout-mcp/bridge.jsonand shows a subtle Status Bar pill:Flow (0)— calm coding (long dwell without errors never triggers false alarms)Shadow: 58/100— elevated undo/error frictionBailout Solving (78)— silently running heavy reasoning model in backgroundBailout Ready (94%)— validated diff waiting cleanly for a natural pause or click
5. Enable Claude Code Hooks & Skill (Optional)
Merge
hooks/claude-code/settings.snippet.jsoninto~/.claude/settings.json.Copy
skills/bailout-detector/SKILL.mdinto your agent skills directory.
6. CLI Mode (Zero IDE Extension Required)
# Run standalone local bridge daemon + file-save churn & oscillation watcher
node packages/mcp-server/dist/src/cli.js daemon --watch .
# Inspect live Shadow-State
node packages/mcp-server/dist/src/cli.js status
# Run an immediate secret-redacted heavy-model escalation on a stubborn file
node packages/mcp-server/dist/src/cli.js escalate ./src/buggyFile.ts --error "TypeError: ..."🧠 Supported Heavy-Model Providers
Provider ( | Env / Config | Default Model | Notes |
|
|
| Native Messages API |
|
|
|
|
|
|
| Auto-detects |
|
|
| Unified multi-model routing |
|
|
| 100% local offline real reasoning LLM |
|
| (your router) | Works with LiteLLM / custom proxies; sends |
Set BAILOUT_FALLBACK_PROVIDERS=gemini,openrouter to enable automatic failover across providers.
🛠 MCP Tools, Resources & Prompts
Tools
Tool | Description |
| Live frustration score ( |
| Ingest |
| Retrieve silently pre-solved heavy-model fix, root cause, confidence, and unified diff |
| Explicitly distill a redacted dossier and escalate a workspace file to the configured heavy model |
| Accept proposal (optionally applying the validated surgical patch atomically to disk) and clear friction |
| Dismiss pending fix and apply exponential cooldown backoff ( |
| Safely tune runtime thresholds or switch between already-configured providers (never exposes/mutates keys or URLs) |
Resources & Prompts
bailout://shadow-state— Real-time Shadow-State snapshot JSONbailout://pending-bailout— Pre-solved heavy-model bailout proposal + unified diffbailout://last-dossier— Exact secret-redacted context window sent to the heavy model (full transparency)present-bailout— Prompt template for calm, 2-sentence + diff presentation
🔒 Security & Privacy Model
BailoutMCP is engineered for real professional codebases from day one:
Threat Vector | Defense Implemented |
Keystroke Spyware Concerns | Raw keystrokes are never recorded or sent. The VS Code companion reads only structural events ( |
Credential / Secret Leakage | Sensitive files ( |
Path Traversal & Symlink Escape | Symlink-resolved |
Localhost DNS Rebinding & CSRF | Bridge binds strictly to |
SSRF & Runtime Hijacking |
|
Prompt Injection in Untrusted Repos | Untrusted workspace code and logs are isolated inside per-request random nonce delimiters ( |
Runaway API Spend | Single-flight solve lock, |
📄 License
Released under the MIT License.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Guardian agent for AI coding: four frontier models review risky diffs and commits before they ship.
Adaptive plan/build/review cycles for AI coding assistants, persisted across sessions.
Enforces architectural invariants and code quality rules inside your AI agent's edit loop.
Source control for coding agents: declare an intent, settle overlaps before code, verify each push.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI-assisted coding workflows to validate code changes through an adversarial debate between the coding agent and a critic LLM, surfacing only deadlocked decisions for human review.60 npm1MIT
- AlicenseAqualityBmaintenanceZero-dependency token optimizer, test-failure triage gate, and System 1.5 semantic guardrail for AI coding agents. Intercepts compiler errors, missing dependencies, and doom loops in < 500µs.612MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to verify code patches locally with sub-50ms neuro-symbolic analysis, detecting structural issues like dependency cycles and interface drift without consuming output tokens.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to compile polyglot repositories into architectural mipmap containers and use stateful pre-edit guardrails, fog-of-war resolution gating, blast-radius analysis, and compact Markdown packets to inspect code and prevent unsafe edits.2Apache 2.0