Bug Report: Non-JSON output (emoji) to STDOUT breaks MCP handshake
Description
When the POLYMARKET_PRIVATE_KEY environment variable is provided, the server prints a success message (✅ Trading enabled) directly to stdout. Since the Model Context Protocol (MCP) relies on stdout for JSON-RPC communication, this non-JSON string causes a SyntaxError on the client side (e.g., Claude Desktop), preventing the tools from loading.
Steps to Reproduce
- Install the MCP server using
npx -y @iqai/mcp-polymarket.
- Configure the server in
claude_desktop_config.json including the POLYMARKET_PRIVATE_KEY env variable.
- Restart the Claude Desktop app.
- Shows an error and does not load the trading tools
Actual Behavior
The server outputs the following string before the JSON-RPC initialization:
✅ Trading enabled
The client log shows:
[error] Unexpected token '✅', "✅ Trading "... is not valid JSON
Expected Behavior
The server should only output valid JSON-RPC messages to stdout. All log messages, success indicators, or "friendly" status updates should be directed to stderr.
Environment
- Package Version:
0.0.16
- OS: Windows 10
- Client: Claude Desktop (Claude 1.1.6679 (f8f4ff))
Suggested Fix
Remove the emojies (eg: ✅ ) from logs.
I have submitted the PR.
Bug Report: Non-JSON output (emoji) to STDOUT breaks MCP handshake
Description
When the
POLYMARKET_PRIVATE_KEYenvironment variable is provided, the server prints a success message (✅ Trading enabled) directly tostdout. Since the Model Context Protocol (MCP) relies onstdoutfor JSON-RPC communication, this non-JSON string causes aSyntaxErroron the client side (e.g., Claude Desktop), preventing the tools from loading.Steps to Reproduce
npx -y @iqai/mcp-polymarket.claude_desktop_config.jsonincluding thePOLYMARKET_PRIVATE_KEYenv variable.Actual Behavior
The server outputs the following string before the JSON-RPC initialization:
✅ Trading enabledThe client log shows:
[error] Unexpected token '✅', "✅ Trading "... is not valid JSONExpected Behavior
The server should only output valid JSON-RPC messages to
stdout. All log messages, success indicators, or "friendly" status updates should be directed tostderr.Environment
0.0.16Suggested Fix
Remove the emojies (eg: ✅ ) from logs.
I have submitted the PR.