Skip to content

Conversation

viniciuscsouza
Copy link
Contributor

Updates the sampling code example in the README

Motivation and Context

Using console.log() can interfere with the MCP protocol's JSON communication, since standard output is used for message exchange.

How Has This Been Tested?

The change was applied to the documentation examples. The expected behavior is for status and error logs to be sent to stderr, without affecting MCP communication via stdout. Tested locally following the README examples.

Breaking Changes

No. The change is only in the documentation and examples, with no impact on production code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

This change helps avoid integration issues for those using the README examples in real MCP applications.

console.log() to avoid corrupting MCP JSON messages
Copy link
Contributor Author

@viniciuscsouza viniciuscsouza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link
Contributor

@ochafik ochafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ochafik ochafik merged commit c342dac into modelcontextprotocol:main Sep 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants