ping.md

February 25, 2026 · View on GitHub

Ping

MCP includes a ping mechanism that allows either side of a connection to verify that the other side is still responsive. This is useful for connection health monitoring and keep-alive scenarios.

Pinging from the client

Use the xref:ModelContextProtocol.Client.McpClient.PingAsync* method to verify the server is responsive:

await client.PingAsync(cancellationToken: cancellationToken);

Automatic ping handling

Incoming ping requests from either side are responded to automatically. No additional configuration is needed—when a ping request is received, a ping response is sent immediately.