Skip to content

[Bug]: Cursor threads block for ~60s on every turn when an MCP server in ~/.cursor/mcp.json is unreachable (e.g. off VPN) #42688

Backlog

Description

@ydan287

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Add an unreachable / packet-dropping HTTP or stdio-bridge MCP server to ~/.cursor/mcp.json (for example a corporate/VPN-only endpoint such as https://internal-mcp.example.com/mcp when off VPN, or a non-routable IP like https://192.0.2.1/mcp).
  2. Start a new Cursor thread in T3 Code (e.g. gemini-4-neon, cursor-agent-sdk.local).
  3. Send "hi", wait for the reply, then send a second short follow-up message.
  4. Inspect the thread's provider event log (events.<thread-id>.log).

Expected behavior

Follow-up turns in a live Cursor thread should reuse the session's existing MCP connections and start streaming immediately (~1–3s), matching Claude (claude-agent-sdk) and Codex (codex.app-server), which connect MCP servers once per session/thread and do not block turn startup on slow/unreachable MCP servers.

Actual behavior

Every single user turn blocks for ~62–65 seconds between run.started and the first model call, even for a trivial "hi" whose actual model call takes ~3.9s (0.6s thinking). Subsequent tool-loop model calls within the same turn take only 3–5s, confirming the stall happens strictly once per run.start.

Root cause:

  1. T3 Code passes mcpServers: { "t3-code": ... } on every run.start (send), rather than only at agent open.
  2. In bundled @cursor/sdk (1.4.2), passing send-level mcpServers hits the mcpServersOverride path (createSessionMcpLease), which creates a brand-new DefinitionMcpLoader with an empty clientCache while keeping includeUserMcp: true — so it re-reads ~/.cursor/mcp.json and reconnects every configured MCP server in parallel on every turn, awaiting all of them before the first model call.
  3. When any server in ~/.cursor/mcp.json silently drops packets (e.g. corporate MCP servers while off VPN), discovery blocks until the SDK's 60,000 ms timeout (60s) on every turn.

When back on VPN (so the internal endpoint responds in ~0.4s), the per-turn run.started → first model call delay dropped from ~62–65s down to ~9–11s, still paying the unnecessary reconnect cost on every turn.

Related PR / history:

Impact

Major degradation or frequent failure

Version or commit

T3 Code 0.1.12-nightly.20261124.5204 (desktop), bundled @cursor/sdk 1.4.2

Environment

macOS (darwin 25.6.0, Apple Silicon), T3 Code Nightly desktop 0.1.12-nightly.20261124.5204, Cursor provider (cursor-agent-sdk.local), model gemini-4-neon (high effort, 1m context).

Logs or stack traces

# Turn 1 ("hi") — off VPN (67.8s from run.started to thinking-completed, but model step was 3.86s):
[2026-11-24T19:12:36.607Z] outgoing run.start  options.mcpServerNames=["t3-code"]
[2026-11-24T19:12:39.640Z] incoming run.started
[2026-11-24T19:13:47.414Z] incoming thinking-completed  thinkingDurationMs=639
[2026-11-24T19:13:47.524Z] incoming step-completed      stepDurationMs=3856
[2026-11-24T19:13:50.321Z] incoming run.completed       durationMs=73711

# Turn 2 (follow-up in same live agent) — still ~62s before model step started:
[2026-11-24T19:15:38.610Z] outgoing run.start  options.mcpServerNames=["t3-code"]
[2026-11-24T19:15:39.880Z] incoming run.started
[2026-11-24T19:16:51.791Z] incoming thinking-completed  thinkingDurationMs=6842
[2026-11-24T19:16:54.770Z] incoming step-completed      stepDurationMs=12649
[2026-11-24T19:16:57.669Z] incoming run.completed       durationMs=79054

# Turn 3 (follow-up in same live agent) — ~65s before first model call, then 3-5s per subsequent tool-loop call:
[2026-11-24T19:18:01.955Z] outgoing run.start  options.mcpServerNames=["t3-code"]
[2026-11-24T19:18:03.000Z] incoming run.started
[2026-11-24T19:19:08.997Z] incoming thinking-completed  thinkingDurationMs=1099
[2026-11-24T19:19:10.840Z] incoming tool-call-completed
[2026-11-24T19:19:15.702Z] incoming tool-call-started   (+4.8s)
[2026-11-24T19:19:20.273Z] incoming tool-call-started   (+4.0s)

# Turn 4 (after connecting to VPN so internal MCP responds in 0.39s):
[2026-11-25T07:41:36.684Z] outgoing run.start  options.mcpServerNames=["t3-code"]
[2026-11-25T07:41:39.856Z] incoming run.started
[2026-11-25T07:41:50.557Z] incoming thinking-completed  thinkingDurationMs=1494  (+10.7s total)

Workaround

Connect to VPN so the configured internal MCP servers respond instead of timing out, or temporarily remove/disable unreachable servers from ~/.cursor/mcp.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions