Handling of stderr on STDIO servers #741
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Remove handling of out-of-spec
notification/stderr
messages. It's not a thing. See Remove out-of-specification sending ofnotifications/stderr
servers#2469Inspect the
stderr
output of STDIO servers and attempt to assign an appropriate RFC 5424 Syslog Protocol level before sending as leveled logging message to the client, as per MCP Logging Spec.Motivation and Context
A recent change to the
server-everything
reference server raised the point thatnotification/stderr
is not a valid MCP message type. It was only added to the server because handling for it existed in the Inspector, added some time ago.Clearly, handling for this message type needs to also be removed from the Inspector so as not to confuse developers who may come across it as I myself did, leading to my erroneously adding the periodic sending of
notification/stderr
messages fromserver-everything
.As far as I can tell, it only existed as a way to indicate that the message came from the
stderr
output of a STDIO server, so that it could be handled differently from other logging messages, placing the output prominently in the sidebar in red to indicate error. However, another recent issue highlights that this is not a valid approach, since all output, even innocuous server welcome messages must be sent viastderr
in STDIO servers.Therefore, I have removed the handling of this out-of-spec message type and am sending all
stderr
output to the client as MCP compliant logging messages. I attempt to set an appropriate logging level by inspecting the contents of the message and searching for levels. So if a STDIO server output the following line onstderr
:...the following message would be sent to the client...
How Has This Been Tested?
Using an STDIO server that outputs a welcome message on

stderr
Breaking Changes
Types of changes
Checklist
Additional context