MCP Client SDK

MCP Server SDK

Misc

Initializing the Protocol

After creating a client, call initialize() before sending any other protocol request. It starts the transport, negotiates the protocol version and capabilities, and sends the notifications/initialized notification.

The Initialize method:

  1. Sends an initialize request to the server
  2. Logs the server's initialization result
  3. Sends an "initialized" notification

After successful initialization, the client can make other requests to the server.

Call initialize() immediately after building the McpClient. Initialization uses the configured requestTimeout; zero means wait indefinitely.

McpClient mcpClient = McpClient.builder()
        .clientName("my-host")
        .clientVersion("1.2")
        .transport(sseTransport)
        .build();
        
mcpClient.initialize();