MCP Protocol Lifecycle Explained: JSON-RPC, Initialize, and Stateless Discovery (Part 2)

This is Part 2 of the MCP for Linux administrators series. It follows one request from connection through a tool call, explains why older examples begin with initialize, and shows how modern MCP clients discover protocol support. If you are new to MCP, start with Part 1: MCP for Linux System Administrators.

Quick answer: MCP messages use JSON-RPC 2.0, but the connection lifecycle has evolved. The legacy protocol uses an initialize handshake followed by an initialized notification. The 2026-07-28 protocol is stateless at the protocol-request level: a client supplies protocol version and capabilities with each request, and can optionally call server/discover to inspect the server. The application can still maintain state explicitly.

Why do MCP examples show different startup steps?

MCP versions define how client and server agree on the protocol and exchange capabilities. Many tutorials and SDKs were written for the 2025-11-25 protocol version or earlier, where a session began with initialize. The 2026-07-28 version introduced per-request protocol metadata and a discovery method. Both eras use JSON-RPC 2.0 message semantics, but the startup flow differs.

Comparison of the legacy MCP initialize handshake and modern stateless per-request discovery and metadata flow
MCP lifecycle comparison: legacy initialization handshake and modern per-request protocol metadata.

When reading an example, check its SDK generation and target protocol version before assuming a step is missing. A server can support compatibility with both eras. The important operational check is what the connected client actually negotiated or selected, not what a tutorial’s diagram suggests.

The shared foundation: JSON-RPC 2.0

JSON-RPC is the message envelope MCP uses. A request includes jsonrpc, an id, a method, and optional params. The response echoes the request ID and contains either a result or an error. A notification has no ID and therefore does not receive a response.

{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/list",
  "params": {}
}

A successful response correlates to request 7. The protocol method says what operation is being requested; transport and lifecycle rules say how that request reaches a server. Keep these layers separate when troubleshooting: JSON parsing, request correlation, protocol-version support, capability support, transport connectivity, and application behavior are different failure points.

Legacy lifecycle: initialize, then operate

In the 2025-11-25 protocol version and earlier, the client starts with an initialize request. It tells the server which protocol versions it supports, its client identity, and the client capabilities it offers. The server replies with the selected version, its capabilities, and server identity. The client then sends notifications/initialized before normal MCP requests begin.

  1. Client → server: initialize with supported protocol version, client capabilities, and client information.
  2. Server → client: initialize result with the chosen version, server capabilities, and server information.
  3. Client → server: notifications/initialized to signal it is ready for normal traffic.
  4. Both sides: exchange supported operations such as tools, resources, prompts, and notifications.

The handshake is a compatibility agreement. It does not mean the client has permission to perform every operation. Capabilities advertise which protocol features a peer implements; application authorization and tool-level safeguards still need to be enforced separately.

Modern lifecycle: version metadata on each request

In protocol version 2026-07-28, the protocol is stateless per request. A request carries its protocol version and the client capabilities relevant to that request in the JSON-RPC params._meta object. For Streamable HTTP, the protocol version is also mirrored in the MCP-Protocol-Version header. The server checks the version on each request and can return an unsupported-version error for that request.

{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "tools/list",
  "params": {
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    }
  }
}

There is no required initialize / notifications/initialized startup sequence in this modern lifecycle. The request contains the protocol context needed by the server. Stateless at the protocol layer does not mean your application cannot keep state: applications can pass explicit identifiers, such as a job or conversation ID, and store state in their own service.

What does server/discover do?

A modern MCP server must implement server/discover. A client may call it before other operations, but discovery is optional for the client. The response can describe supported protocol versions and capabilities, plus server information, instructions, and cache hints. Discovery is useful when a client needs to inspect available versions or capabilities before deciding what to call.

  • Use discovery when the client needs a current capability or version inventory.
  • For compatibility, SDKs may probe discovery and fall back to the legacy handshake when the server does not support the modern flow.
  • Do not treat serverInfo as a security identity. It is descriptive metadata, not proof that a server is trusted.

The official Python SDK v2 client defaults to automatic compatibility behavior: it probes for modern discovery and falls back to the legacy initialize handshake where needed. You can inspect client.protocol_version after connecting to see which protocol version the SDK is using.

A practical Python SDK v2 example

The following small server exposes one read-only-in-effect demonstration tool, add. It is intentionally simple so the client lifecycle is easy to see. Use a supported Python environment with the official MCP Python SDK v2 installed.

from mcp.server import MCPServer

mcp = MCPServer("lifecycle-demo")

@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two integers."""
    return a + b

Run the server with Streamable HTTP:

uv run mcp run server.py --transport streamable-http

Connect using the SDK v2 client and inspect the negotiated protocol version, server capabilities, and available tools:

import anyio
from mcp import Client

async def main():
    async with Client("http://localhost:8000/mcp") as client:
        print("Protocol:", client.protocol_version)
        print(
            "Capabilities:",
            client.server_capabilities.model_dump(exclude_none=True),
        )
        tools = await client.list_tools()
        print("Tools:", [tool.name for tool in tools.tools])

if __name__ == "__main__":
    anyio.run(main)

Run the client in another terminal with uv run python client.py. With a current server, expect the protocol version to show the modern version and the tool list to include add. If the server only supports the older lifecycle, automatic compatibility may use a legacy version instead. Capability values depend on the server configuration, so inspect the actual output rather than expecting a fixed dictionary.

What Linux administrators should check

  • Version: log or inspect the client’s selected protocol version so a compatibility failure is diagnosable.
  • Transport: confirm the process is listening on the expected endpoint and that the client uses the right transport. MCP supports stdio and Streamable HTTP; the JSON-RPC message concepts apply to both.
  • Capability: verify the server advertised the feature the client is trying to use. A missing capability is different from a network outage.
  • Authorization: enforce user and service permissions independently. Protocol capabilities do not grant access to host files, shells, or other resources.
  • Observability: log request method, request ID, protocol version, result or error category, and duration. Avoid logging secrets or sensitive tool arguments.
  • Compatibility: when upgrading an SDK or server, test both modern discovery and legacy fallback if older clients remain in your environment.

Common lifecycle troubleshooting

  • “Unsupported protocol version”: compare client and server supported versions. Update one side or deliberately use a compatible SDK mode; do not silently label the connection healthy.
  • Legacy client cannot start: confirm the server still accepts the legacy initialize flow, or upgrade the client to an SDK that supports modern discovery.
  • Tool is missing: check the server’s advertised capabilities and tools/list response. A successful TCP connection alone does not prove that tools are available.
  • Old guide says “initialized”: that may be correct for its protocol version. Match the guide’s SDK and specification version before changing the code.
  • Stateless means no state? No. It means protocol requests carry their own context; application state can be managed separately using explicit IDs and storage.

Key takeaways

MCP uses JSON-RPC 2.0 across its transports. Older protocol versions establish a connection with initialize and notifications/initialized. The 2026-07-28 protocol uses per-request version and capability metadata, with optional client discovery. Python SDK v2 can handle compatibility automatically, and client.protocol_version lets an operator see which version is active. Treat capabilities as feature declarations and enforce access control in the application.

Official references

Next in the series: installing the Python SDK, running a local stdio MCP server, and inspecting its tools step by step.

Following a series? Find the reading order in Learning Paths and Technical Series.