Ch 1 — What Is MCP — Under the Hood

JSON-RPC 2.0 wire format, capability negotiation, initialize handshake, and protocol versioning
Under the Hood
-
Click play or press Space to begin...
Step- / 10
AJSON-RPC 2.0 FoundationEvery MCP message is a JSON-RPC 2.0 frame
1
data_object
Requestid + method + params
expects a response
or
reply
Responseid + result/error
matches a request
or
2
notifications
Notificationmethod + params
no id, no response
3
arrow_downward The connection lifecycle: initialize handshake
BThe Initialize HandshakeClient and server agree on capabilities before any work
swap_horiz
ClientSends initialize
request
initialize
dns
ServerReturns capabilities
+ protocol version
initialized
4
check_circle
ReadyClient sends
initialized notification
5
arrow_downward Capability negotiation: what each side can do
CCapability NegotiationServer declares what it offers, client declares what it supports
dns
Server Capstools, resources,
prompts, logging
advertise
handshake
NegotiationBoth sides know
what the other supports
advertise
swap_horiz
Client Capssampling, roots,
elicitation
6
arrow_downward Protocol versioning: how versions are matched
DProtocol VersioningDate-based versions with strict matching
calendar_month
Version FormatYYYY-MM-DD
e.g. 2025-11-25
sent in
compare_arrows
Version CheckClient proposes,
server accepts/rejects
fallback
7
error
MismatchServer returns error
if incompatible
8
arrow_downward Message flow: requests, responses, and notifications
EMessage Flow PatternsBidirectional: both sides can send requests
arrow_forward
Client → Servertools/call,
resources/read, ...
+
arrow_back
Server → Clientsampling/createMessage,
elicitation/create
+
9
sync_alt
NotificationsEither direction
no response expected
10
arrow_downward Shutdown: graceful connection teardown
FConnection ShutdownClean teardown or abrupt close
power_settings_new
GracefulClient sends close
server cleans up
or
dangerous
Transport Closestdio EOF or
HTTP disconnect
=
delete_sweep
CleanupRelease resources
cancel pending ops
1
Detail