MCP session 은 4 phase: connect, initialize, operate, shutdown. 첫 번째는 transport-specific (stdio pipe 열기, HTTP connection 열기); 마지막은 graceful close. 가운데 둘이 protocol 무게 다 carry.
Initialize 가 handshake. Client 가 initialize request 보내며 protocolVersion, capabilities (e.g. sampling, roots, elicitation), clientInfo 광고. Server 가 같은 envelope 으로 답: negotiated version (양쪽 다 아는 가장 높은 거), 자기 capability, serverInfo. 이 교환 후 양쪽 다 — session 의 나머지가 뭘 쓸 수 있는지에 대한 — 정밀한 written 합의.
Handshake 가 중요한 이유는 — protocol 이 lock-step 업그레이드 없이 evolve 하게 해주는 거. 새 client 가 옛 server 와 대화 가능 — 양쪽이 광고하는 capability 만 씀. 새 server 가 — 옛 client 가 무시하는 — 실험적 capability ship 가능. MCP 의 capability 가 HTTP/REST 의 version 번호 역할 — parts 가 서로 안 깨면서 다른 속도로 움직이게 하는 방법.
Operate 는 handshake 후 모든 거: tool call, resource read, prompt request, sampling round-trip, log message, progress event. Shutdown 은 양쪽 resource 정리하는 작별; server 는 shutdown 을 — log flush 하고 file handle 놓는 — 기회로 다뤄.