ANTIGRAVITY LABJP
Articles/Integrations
Integrations/2026-07-19Advanced

When an Unresponsive MCP Server Freezes Your Agent: Separate Timeouts for Connect, List, and Call

Antigravity CLI 1.1.3 closed the case where an unresponsive MCP server stalls an agent forever, by adding timeouts to connect, list-tools, and call-tool. This walks through why the three boundaries fail differently, and builds a defensive wrapper with a circuit breaker and failure-only notifications, backed by working code and a week of overnight runs.

Antigravity CLI30MCP24timeout6automation91design patternresilience9

Premium Article

The batch I run at 2 a.m. was only half done by morning. The last line in the log read "connected to MCP server," with no error and no exception after it. The connection had succeeded. The list-tools call I fired right after it simply never came back, and it waited that way until sunrise.

When you run several sites as an indie developer, this kind of "not even an error" stall is the worst kind. If something crashes, you can restart it. But a silent, endless wait gives you nothing to notice until you open the log the next day. This article starts from the path that Antigravity CLI 1.1.3 closed — an unresponsive MCP server stalling an agent forever — and turns it into a per-boundary timeout design you can drop around your own automation so it never dies in the same hole.

What 1.1.3 actually closed

The Antigravity CLI 1.1.3 release notes (2026-07-16) include one MCP-related fix. An MCP server that never returns a response used to stall the agent indefinitely; the fix resolves this by adding timeouts to each of connect, list-tools, and call-tool.

It looks minor, but if you run tasks unattended, it changes an assumption. Before, a single server that completed the handshake and then went silent could freeze the whole agent right there. With timeouts in place, at least the "wait forever" case is gone.

Still, the CLI no longer waiting internally does not make the outside of your own automation safe. If you invoke the CLI headless with agy -p and wrap it in cron or a shell, what happens after the CLI gives up is your design, not the CLI's. Skip that, and you trade one stall for another: "the CLI gave up at 120 seconds, but my script swallowed the failure and moved to the next job, leaving everything half-finished."

This piece is about not leaning entirely on the CLI's internal fix, and instead laying your own timeout layer around any automation that uses MCP. For the groundwork of running the CLI non-interactively, I covered that first in Running the Antigravity CLI Non-Interactively: Design Before You Put It on CI and Cron. Read together, they make it clearer whether the timeout should live on the inside (the CLI) or the outside (your operations).

Why one blanket timeout is not enough

It is tempting to write "time everything out at 60 seconds." That is exactly what I did first. But the three boundaries fail so differently that a single number is guaranteed to break one of them.

BoundaryTypical durationExample cause of a stallSafe to retry?
connecttens of ms to a few sprocess not started, port not listening, stalled TLS handshakeYes (no side effects)
list toolshundreds of mslock during init, infinite loop building the schemaYes (read only)
call toolhundreds of ms to tens of sslow external API, heavy input, waiting on a writeDepends (dangerous if not idempotent)

Allow 120 seconds for connect, and you wait two minutes on a server that failed to start. Give call-tool only 5 seconds, and you wrongly cut a tool that is legitimately doing heavy work. And only the call boundary ties its retry safety to the tool's idempotency. Re-issuing list-tools is a read, so it is carefree; blindly retrying a tool that writes can create a second problem, like a duplicate record.

So a timeout is not one number — it is a per-boundary budget. In my overnight batch I start from connect 15s, list-tools 20s, call-tool 120s. The split depends heavily on your environment, so I tighten it later against measurements.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Understand why connect, list-tools, and call-tool fail in different ways, so you can assign a separate timeout budget to each boundary instead of one blanket number
Stop a single unresponsive MCP server from wedging your whole overnight pipeline, using a defensive wrapper that combines timeouts, exponential backoff, and a circuit breaker
Add a failure-only notification that says which server stalled at which boundary, cutting the time you spend diagnosing it the next morning
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $15 for lifetime access
View Membership →

Related Articles

Integrations2026-08-22
Adding MCP Servers Without Opening the Config File: The agy mcp Subcommand
Antigravity CLI 1.1.16, released on August 20, adds an mcp subcommand so you can register and toggle MCP servers without hand-editing JSON. Here is how to add stdio and HTTP servers, isolate a misbehaving one, and script your whole setup so it travels to a new machine.
Integrations2026-08-22
Driving Antigravity CLI with stream-json Input: Where to Split the Conversation
The print mode now accepts --input-format stream-json, letting an external driver hold one session open and feed it jobs one at a time. I measured how much a single conversation carries across 24 jobs, found that a byte budget splits work in the wrong place, and worked out how to choose the split boundary instead.
Integrations2026-08-20
Find the one broken MCP entry before Antigravity starts, with 40 lines of Node
A single typo in your MCP settings can take every server down with it. Here is a small preflight script that catches the mistakes statically, the real output from a deliberately broken config, and the duplicate-key trap that JSON hides from you.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →