Summary audio
Spoken summary — press play to read along: the line being spoken stays near the top.
Study notes
📚 MCP Communication Fundamentals
🌐 Core Concepts
- Messages: Client and server communicate by exchanging structured data objects called JSON messages.
- Transport: The mechanism used to physically move JSON messages between the client and server (e. g. , HTTP, WebSockets, Standard IO).
🖥️ Standard IO Transport
This transport is used when the client and server are running on the same physical network.
- Mechanism: The client launches the server as a separate process.
- Communication Flow:
- Client $\to$ Server: Messages are written to the server's Standard Input (stdin).
- Server $\to$ Client: Responses are written to the server's Standard Output (stdout).
- Key Advantage: Communication can be easily initiated by either the client or the server at any time.
🔄 MCP Connection Initialization Flow
When a client first connects to an MCP server, a specific sequence of three messages must be exchanged:
- Client $\to$ Server: Send an initialized request.
- Server $\to$ Client: Respond with an initialized result.
- Client $\to$ Server: Send an initialized notification (this message does not require a response).
- Result: After these three steps, the connection is considered initialized, allowing for subsequent requests (e. g. , call tool requests).
🆚 Standard IO vs. HTTP Transport
Understanding the limitations of the transport is critical for development.
- Standard IO Transport:
- Highly flexible because either the client or the server can initiate communication (send a request) at any point.
- Streamable HTTP Transport:
- Has limitations compared to Standard IO.
- Crucial Limitation: It may not allow the server to send an initial request to the client.
Takeaways
- Communication Structure: All client-server communication relies on exchanging structured data objects formatted as JSON messages. The "Transport" is the underlying mechanism (e. g. , HTTP, WebSockets) used to move these messages.
- Standard IO Transport: This transport is designed for processes on the same physical network. Its key advantage is its high flexibility, allowing either the client or the server to initiate communication at any time.
- Connection Initialization: Before any functional requests can be made, a mandatory three-step handshake must occur: Client sends initialized request $\to$ Server responds with initialized result $\to$ Client sends initialized notification.
- Transport Limitations: Developers must recognize that while Standard IO is highly flexible, streamable HTTP transports have limitations, particularly regarding the server's ability to initiate a request to the client.
Flashcards 8 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 6 questions