Skip to content

docs(SEP-2575): clarify stdio process lifetime in lifecycle spec#2770

Merged
dsp-ant merged 3 commits into
modelcontextprotocol:mainfrom
kurtisvg:clarify-stdio-server-lifetime
May 29, 2026
Merged

docs(SEP-2575): clarify stdio process lifetime in lifecycle spec#2770
dsp-ant merged 3 commits into
modelcontextprotocol:mainfrom
kurtisvg:clarify-stdio-server-lifetime

Conversation

@kurtisvg

Copy link
Copy Markdown
Contributor

Add prescriptive guidance that the stdio process should track the host application lifetime and serve multiple tasks, threads, or conversations, rather than being scoped to any single one.

@kurtisvg
kurtisvg requested a review from a team as a code owner May 22, 2026 16:01
Comment on lines +31 to +33
- The stdio process **SHOULD** have approximately the same lifetime as the host
application instance that launched it. Clients **SHOULD** attempt to restart
the stdio process if the server terminates unexpectedly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I agree with this. Responded similarly to NickC's proposal: https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2692/changes#r3276075388

tl;dr: I agree with not spawning it per conversation, but I'd like to potentially go further in future and avoiding spawning it at all if possible, and tear it down early if not needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think spinning up and down more frequently than needed would be more helpful than hurtful -- there are many optimizations like connection pooling or caching that would be lost.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you mean internal connection pooling and caching right? Not MCP stuff?

I'm not arguing that we should start-up and tear-down a server per tool call or anything like that, but it does seem reasonable to me to do something like (a) by default, defer an stdio server spin up until needed, relying on cached server/discover and tools/list where possible, and (b) once the server is started, keep it around with a keepalive for perhaps 30 minutes, and then shut it down.

Connection pools typically don't live inactive forever anyway, so should not impact them if the server is inactive. You could wipe in memory caches, but those should be out-of-process anyway (otherwise every LLM process has to cache separately).

Setting aside the specifics of what an optimal setup may or may not look like, my main objection here is that we are being overly prescriptive. It's not obvious to me that tying all stdio server lifecycles to the host lifecycle is the optimal approach, so I don't see why we should be prescriptive here? What is wrong with just leaving this as a host choice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, PTAL

@kurtisvg
kurtisvg requested a review from pja-ant May 27, 2026 20:41
pja-ant
pja-ant previously approved these changes May 27, 2026
kurtisvg added 2 commits May 29, 2026 11:57
Add prescriptive guidance that the stdio process should track the host
application lifetime and serve multiple tasks, threads, or conversations,
rather than being scoped to any single one.
@dsp-ant
dsp-ant force-pushed the clarify-stdio-server-lifetime branch from 9eaf3d2 to 442d803 Compare May 29, 2026 10:59
@dsp-ant dsp-ant added this to the 2026-07-28-FINAL milestone May 29, 2026
@dsp-ant
dsp-ant merged commit 1121445 into modelcontextprotocol:main May 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants