-
-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Hi.
Example for running MCP Server uses
$logger = new SymfonyConsole\Logger\ConsoleLogger($output);
as logger.
This won't work with STDIO transport.

Logs go to STDERR with proper verbosity.
Logs written not in JSON, but as string [info] .....
which breaks tools like npx @modelcontextprotocol/inspector
for example, and you won't see any logs there.
This can be changed, for example app can create own JSON logger (something like this), then tools start to see logs.

Writing own logger is not best solution, and example is not really working out of the box.
Maybe example can be changed to utilize Monolog logger with STDERR stream handler and JSON formatter?
Also this will work only on debugging stage with npx @modelcontextprotocol/inspector
and won't work with other tools. For example LM Studio or PHPStorm when they see output in STDERR they stop using tool since they think that it's actual error.
If need user still needs logging on server side, I guess logging to file would be best choice, maybe you could add some examples and explanations?
There is Logging Capability in MCP protocol, which can be utilized to keep logs in 1 place (client in this case), but it's not implemented now.