Skip to content

Fix stdout/stderr handling to prevent JSON-RPC communication errors #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raihaku
Copy link

@raihaku raihaku commented May 3, 2025

Fix stdout/stderr handling to prevent JSON-RPC communication errors

This PR addresses an issue where debug messages were being output to stdout, which interfered with the JSON-RPC protocol. The MCP protocol requires that stdout be used exclusively for JSON-RPC messages.

Changes

  • Modified the logDebug() function to use console.error() instead of console.debug()
  • Replaced all instances of console.warn() with console.error()
  • Replaced console.log() with console.error() for server status messages

These changes ensure that stdout is used exclusively for JSON-RPC communication, while all logging and debugging information goes to stderr, making godot-mcp more compatible with MCP clients that strictly follow the protocol specification.

Testing

Tested with Claude's MCP client, which previously failed with JSON parsing errors. After these changes, the communication works correctly.

Issues

#24

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.

1 participant