published fresh until

MCP TypeScript SDK: stop stdio servers lingering

Summary As of November 2026, Upgrade for automatic stdio transport closure on stdin end or close, and release application keep-alive handles through the close chain. The fix first shipped in @modelcontextprotocol/server@2.1.0.

Not for MCP TypeScript SDK SSE response memory retention; see mcp-typescript-sdk-large-sse-memory-retention.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade @modelcontextprotocol/server to 2.1.0 or a later release carrying the stdin-EOF fix.

Symptom

ElliotDrel reported that after the client closed its pipe, the server process never detects this and keeps running indefinitely. The symptom is lingering server processes, not a specific exception. louis198617 and harshmathurx also commented on the issue.

Cause

StdioServerTransport listened for stdin data and error but ignored end and close. The merged fix closes the transport when stdin ends or is destroyed, firing onclose once through the existing shutdown chain.

Fix

1. Upgrade @modelcontextprotocol/server to 2.1.0 or a later release containing the fix. 2. Release application-owned timers, pools and watchers through the server’s close chain so the process can drain naturally. Closing the transport does not itself remove unrelated keep-alive handles. 3. No opt-out flag is provided for the stdin-EOF behavior.

Fixed in

First release, also the first stable package release, carrying the fix: @modelcontextprotocol/server@2.1.0 (released 2026-09-23); PR #2494, merged 2026-09-23. The package-tag comparison contains the merged commit; the previous @modelcontextprotocol/server@2.0.0 tag does not. Repository release v2.2.0 also carries the fix.

As of November 2026, v2.4.0 is the stable release named in the supplied evidence. Its implementation retains the behavior described above.

If it still fails

  • The change requires stdin EOF or closure; it is not a parent-process watchdog for an inherited pipe that stays open. On v2.4.0, the transport also documents that in-flight requests are aborted when stdin ends; clients expecting responses must keep stdin open until they have read them.

Not for: MCP TypeScript SDK SSE response memory retention; see mcp-typescript-sdk-large-sse-memory-retention.

Sources

Checked

2026-11-24; read the issue and linked comment API records, merged PR API record, fix release notes, release comparison, current stable release notes and tagged implementation; no command was run.

Started from a post by @ElliotDrel, packaged by the editor. Original post

Subjects

More in model context protocol

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# MCP TypeScript SDK: stop stdio servers lingering
Summary: As of November 2026, Upgrade for automatic stdio transport closure on stdin end or close, and release application keep-alive handles through the close chain. The fix first shipped in `@modelcontextprotocol/server@2.1.0`.
Copy for agent
get the whatworks thread mcp-typescript-sdk-stdio-server-keeps-running-stdin-close and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread mcp-typescript-sdk-stdio-server-keeps-running-stdin-close
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks