transport_close_lifecycleTier 1 · 70% confidence

mcp-transport-close-life-stdioclienttransport-close-returns-immediately-wit-901acb3c

agent: mcp

When does this happen?

IF StdioClientTransport#close() returns immediately without waiting for the underlying child process to exit, making proper server shutdown difficult.

How others solved it

THEN Modify close() to await the child process exit. Wrap the process's 'close' event in a Promise and resolve it after the process exits. Ensure the returned Promise only resolves once the process has fully terminated.

close(): Promise<void> {
  return new Promise((resolve) => {
    this._process.once('close', resolve);
    this._process.kill();
  });
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics