docs: stdio transport - explicit use of stderr for logging #670
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.
Small but explicit addition to the 'stdio' transport that makes it clear that servers may use
stderr
for all types of logging, including informational, debug and error messages.Motivation and Context
It is not immediately clear from the specification, and not clear from detailed reading, that the
stderr
stream forstdio
servers can be used not only for errors messages, but for any logging.The fact that
stderr
is essentially overloaded to be an output stream for the server is not immediately obvious, as it is a fairly non-conventional approach (although I understand why it has been adopted). This note makes it clear to implementors that it is an accepted pattern to usestderr
as a log/output stream, and also to client implementors that they should not assume that messages tostderr
actually imply errors (for example, the MCP inspector could use this spec to decide to not showstderr
in red, or at least note that the output might not indicate errors).Logging informational / debug / error messages to stdout has become increasingly conventional in MCP servers but is not inutitive to new adopters, although the pattern has been used in many applications (e.g. the Docker daemon uses stderr for logging as stdout is used for container stdout).
(Evidence)
How Has This Been Tested?
No functional changes.
Breaking Changes
No breaking changes - this already appears to be a common pattter.
Types of changes
Checklist
Additional context