Skip to content

Keep a modern STDIO MCP server up for its input - #7492

Merged
tzolov merged 1 commit into
spring-projects:mainfrom
tzolov:mcp-modern-stdio-server-lifetime
Nov 27, 2026
Merged

tzolov merged 1 commit into
spring-projects:mainfrom
tzolov:mcp-modern-stdio-server-lifetime

Conversation

@tzolov

@tzolov tzolov commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

A modern MCP server on the standard streams (protocol: MODERN, stdio: true) that is not a web application ends as soon as it has started, although its standard input is open.
The STDIO transport of the MCP Java SDK runs on daemon threads, and its lifecycle started it without waiting for it.

The lifecycle now waits, on a thread that is not a daemon, until the input ends or the application is closed.
When the input ends it logs that the server no longer serves, and the application ends unless something else keeps it running, as with the legacy STDIO server.
The lifecycle is not pauseable, because the transport can be started once.

McpServerModernStdioLifecycleTests covers the end of the input, the shutdown of the application while the input is open, and the pause contract.

Fixes #7490

The STDIO transport of the modern server runs on daemon threads and
was started without waiting for it, so a server that is not a web
application ended as soon as it had started.

The lifecycle now waits on a thread that is not a daemon until the
input ends or the application is closed, and logs when the input
ends. It is not pauseable, as the transport starts once.

Fixes spring-projects#7490

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@tzolov tzolov added this to the 2.1.1 milestone Nov 27, 2026
@tzolov tzolov added bug Something isn't working mcp labels Nov 27, 2026
@tzolov
tzolov merged commit 357d192 into spring-projects:main Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modern STDIO MCP server ends right after its start

1 participant