The MCP Connection Lifecycle
masterAn MCP connection follows a strict lifecycle of three main stages:
- Initialization: The Client sends an
initializerequest (containing protocol version and capabilities). The Server responds with its own capabilities and info. The Client then sends aninitializednotification to acknowledge. - Message Exchange: The active phase where
tool_callrequests,request_inputrequests, and optionalprogressnotifications are exchanged. - Termination: The connection is closed via a
shutdownrequest and response to ensure a clean exit.