Feedback

Chat Icon

Practical MCP with FastMCP & LangChain

Engineering the Agentic Experience

MCP Interaction Workflow: A Step-by-Step Example
21%

Step 2 - Initialization, Handshake and Capability Negotiation

Here is where the MCP session starts. The MCP client opens a transport-level connection to the server.

For remote access, it targets http://mcp.airquality.com/connect as configured by the host. The server accepts the connection and prepares to exchange JSON-RPC messages.

If this were local (STDIO), the host would launch a process such as air_quality_server --mcp. Then it would write JSON-RPC messages to stdin and read responses from stdout.

At this point, the transport channel exists, but the MCP session is not ready for normal operations until the handshake completes.

Before any tool call, the client must send an initialize request to the server. This is a required step in the MCP protocol. The client includes its supported protocol version and any relevant client information (for example, name and version):

{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "sampling": {}
    },
    "clientInfo": {
      "name": "chatbot-app",
      "version": "1.0.0"
    }
  }
}

In plain language, the client is saying:

Hello, I am chatbot-app version 1.0.0.
I want to use MCP protocol version 2025-11-25.
Here are my capabilities: I support sampling, which means I can generate model completions on behalf of the server if needed.

The server responds with its capabilities and server information:

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "protocolVersion": "2025-11-25",

Practical MCP with FastMCP & LangChain

Engineering the Agentic Experience

Enroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!