Search topics…
Tutorials
Explore
June 6 Offline Event →
Module 4 · Model Context Protocol

Module 4: Handshake Sequence & JSON-RPC over STDIO

Trace the version negotiation handshake, and analyze STDIO process pipes routing JSON-RPC 2.0 frames.

⏱ 18 Min Read Author: GenAIWallah Team Updated: May 2026
Day 7

Handshake & Initialization

Why this matters

Handshake: Handshake negotiates capabilities and protocol version before any tool runs.

Before tools run, client and server perform an initialize handshake: negotiate protocol version and advertised capabilities.

Initialize sequence

  1. Client sends initialize with protocol version + capabilities.
  2. Server responds with its capabilities.
  3. Client sends initialized notification.
  4. Client calls tools/list to discover available tools.
Mismatching protocol versions is a common reason for silent connection failures — always log the server's initialize response during development.

Common mistakes

  • Confusing host with server (the host runs the client; the server is a separate process).
  • Hard-coding API keys inside tool implementations instead of env vars.
  • Using SSE locally when stdio is simpler and more secure.

Interview checkpoints

  • Q: What is handshake in MCP? A: One-sentence definition + when it runs in the lifecycle.
  • Q: One production pitfall? A: Name transport, auth, or schema mismatch.

Practice

  1. Basic: Sketch Handshake on a whiteboard.
  2. Intermediate: Find it in a real Claude Desktop or Cursor config.
  3. Advanced: Break it on purpose and document the error message.

Recap

  • You can explain handshake clearly.
  • You know host vs client vs server roles.
  • You see how this connects to the next part.

Next: Transport

Day 8

Transport: STDIO & SSE

Why this matters

Transport: Transport choice (stdio vs SSE) determines deployment model: local subprocess vs remote HTTP.

MCP supports multiple transports:

TransportUse caseNotes
stdioLocal serversHost spawns subprocess; stdin/stdout carry JSON-RPC lines
SSE / HTTPRemote serversServer-Sent Events for streaming; needs auth headers

Pick stdio for Claude Desktop local tools; use SSE when the server runs on another machine or behind a tunnel.

Common mistakes

  • Confusing host with server (the host runs the client; the server is a separate process).
  • Hard-coding API keys inside tool implementations instead of env vars.
  • Using SSE locally when stdio is simpler and more secure.

Interview checkpoints

  • Q: What is transport in MCP? A: One-sentence definition + when it runs in the lifecycle.
  • Q: One production pitfall? A: Name transport, auth, or schema mismatch.

Practice

  1. Basic: Sketch Transport on a whiteboard.
  2. Intermediate: Find it in a real Claude Desktop or Cursor config.
  3. Advanced: Break it on purpose and document the error message.

Recap

  • You can explain transport clearly.
  • You know host vs client vs server roles.
  • You see how this connects to the next part.

Next: Desktop Config

← Module 3: Primitives Module 5: Local Servers →