MCP PHP SDK

ClientLogger extends AbstractLogger

FinalYes

MCP-aware PSR-3 logger that sends log messages as MCP notifications.

since protocol revision 2026-07-28 (SEP-2577), earliest removal 2027-07-28. Log to stderr (stdio) or use OpenTelemetry instead.

Tags
author

Adam Jamiu jamiuadam120@gmail.com

Tobias Nyholm tobias.nyholm@gmail.com

Table of Contents

Properties

$client  : ClientGateway
$session  : SessionInterface

Methods

__construct()  : mixed
log()  : void
Logs with an arbitrary level.
convertToMcpLevel()  : LoggingLevel|null
Converts PSR-3 log level to MCP LoggingLevel.

Properties

Methods

log()

Logs with an arbitrary level.

public log(mixed $level, string|Stringable $message[, array<string, mixed> $context = [] ]) : void
Parameters
$level : mixed
$message : string|Stringable
$context : array<string, mixed> = []

convertToMcpLevel()

Converts PSR-3 log level to MCP LoggingLevel.

private convertToMcpLevel(mixed $level) : LoggingLevel|null
Parameters
$level : mixed

PSR-3 level

Return values
LoggingLevel|null

MCP level or null if unknown

On this page

Search results