DS DevShelfHub Projects · AI tools
Tutorials / MCP / Lifecycle
MCP Beginner · 7 min read Page 4 of 23

Lifecycle & Capability Negotiation

By DevShelfHub

Every MCP session begins with a handshake. Learn the four phases — Initialize, Operation, and Shutdown — and the capability negotiation that determines which features each side may use.

Series progress4 / 23

The session lifecycle

An MCP session always follows the same four phases:

  1. Initialize — client → server initialize request.
  2. Capability negotiation — both sides declare what they support.
  3. Initialized — client sends notifications/initialized and the session is live.
  4. Shutdown — either side closes the transport. No formal method.

The initialize handshake

request — client → server
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "roots": { "listChanged": true },
      "sampling": {},
      "elicitation": { "form": {} }
    },
    "clientInfo": { "name": "claude-desktop", "version": "0.7.0" }
  }
}
response — server → client
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "tools": { "listChanged": true },
      "resources": { "subscribe": true, "listChanged": true },
      "logging": {}
    },
    "serverInfo": { "name": "weather", "version": "1.0.0" },
    "instructions": "Use get_forecast for 7-day outlooks."
  }
}
notification — client → server
{ "jsonrpc": "2.0", "method": "notifications/initialized" }

Capability matrix

SideCapabilityWhat it unlocks
ClientrootsServer may call roots/list.
ClientsamplingServer may call sampling/createMessage.
ClientelicitationServer may call elicitation/create.
ClienttasksServer may emit task-augmented requests.
ServertoolsClient may call tools/list and tools/call.
ServerresourcesClient may list, read, and (optionally) subscribe.
ServerpromptsClient may list and get prompts.
ServerloggingServer may emit notifications/message.
ServercompletionsClient may call completion/complete.

Rule: the server MUST NOT call a feature the client didn't advertise, and vice versa.

Sub-capabilities

  • listChanged — emit notifications/tools/list_changed (or resources/prompts) when the list changes.
  • subscribe — accept resources/subscribe and push notifications/resources/updated.
  • form / url — which elicitation modes the client implements.

Version negotiation

The client proposes a protocolVersion (a calendar string like 2025-11-25). The server returns its supported version. If they don't match the client MUST disconnect.

Operation & shutdown

During operation both sides MUST respect the negotiated version and capabilities. ping works as a lightweight keepalive. There is no formal shutdown method — closing the transport ends the session.

Quick summary

  • Three-message handshake: initialize → result → initialized
  • Both sides declare capabilities — never use features that weren't negotiated
  • Sub-capabilities (listChanged, subscribe, form/url) refine the contract
  • Closing the transport is the only "shutdown"

MCP Lifecycle FAQ

What are the phases of the MCP session lifecycle?

An MCP session has four phases: Initialize (client sends an initialize request), Capability Negotiation (both sides declare supported features), Initialized (client sends the notifications/initialized signal), and Shutdown (transport is closed).

What is capability negotiation in MCP?

During initialization, the client and server each declare their capabilities — for example, whether the server supports tools, resources, or prompts, and whether the client supports sampling or roots. Only mutually declared features can be used.

What happens if the MCP version doesn't match?

If the client and server cannot agree on a protocol version, the server should reject the initialize request with an error. Clients should support the latest stable version and gracefully handle version mismatches.

Is there a formal MCP shutdown method?

No. MCP shutdown is simply closing the transport. There is no dedicated shutdown JSON-RPC method. Both sides should handle unexpected transport closure gracefully.

Can capabilities be changed after initialization?

No. Capabilities are fixed for the lifetime of a session. If a server's available tools change, it can send a notifications/tools/list_changed notification, but the capability set itself is established at initialization.

Quick jump:API Reference