@@ -25,6 +25,52 @@ connection by spawning a new process and then use STDIO to communicate with it.
2525 keep things simple and not much changes in this workshop by using ` stdio ` .
2626</callout-info >
2727
28+ ## MCP Initialization
29+
30+ Here's what happens when the client initializes the session with the server:
31+
32+ ``` mermaid
33+ sequenceDiagram
34+ participant Host
35+ participant Client
36+ participant Server
37+
38+ Host->>+Client: Initialize client
39+ Client->>+Server: Initialize session with capabilities
40+ Server-->>Client: Respond with supported capabilities
41+
42+ Note over Host,Server: Active Session with Negotiated Features
43+
44+ loop Client Requests
45+ Host->>Client: User- or model-initiated action
46+ Client->>Server: Request (tools/resources)
47+ Server-->>Client: Response
48+ Client-->>Host: Update UI or respond to model
49+ end
50+
51+ loop Server Requests
52+ Server->>Client: Request (sampling)
53+ Client->>Host: Forward to AI
54+ Host-->>Client: AI response
55+ Client-->>Server: Response
56+ end
57+
58+ loop Notifications
59+ Server--)Client: Resource updates
60+ Client--)Server: Status changes
61+ end
62+
63+ Host->>Client: Terminate
64+ Client->>-Server: End session
65+ deactivate Server
66+ ```
67+
68+ <callout-success >
69+ This is all handled by the MCP SDK automatically. Once you set up your server
70+ and connect it to a transport, the SDK will handle the initialization and
71+ negotiation of capabilities.
72+ </callout-success >
73+
2874## MCP ` ping `
2975
3076``` mermaid
@@ -35,6 +81,11 @@ sequenceDiagram
3581 Server-->>Client: JSON-RPC Response {"result": {}}
3682```
3783
84+ <callout-success >
85+ The MCP SDK handles the ping request for you. Just get the server set up with
86+ a transport and you're good to go.
87+ </callout-success >
88+
3889A "ping" is a common concept in protocol design. It's a simple request to check
3990if a connection is working. In this exercise, we'll implement a ` ping ` tool
4091for our MCP server.
0 commit comments