John O'Reilly
03/29/2026, 2:23 PMkoogAgents = "0.6.4"
mcpKotlin = "0.8.3"John O'Reilly
03/29/2026, 2:28 PM2026-03-29T14:26:35.862Z [ClimateTrace] [error] Unexpected token 'k', "kotlin-log"... is not valid JSON {
metadata: {
context: 'connection',
stack: `SyntaxError: Unexpected token 'k', "kotlin-log"... is not valid JSON\n` +John O'Reilly
03/29/2026, 2:40 PM### Summary
- Resolved a persistent JSON syntax error ("Unexpected token 'k', 'kotlin-log'...") in the MCP Server that occurred after updating Koog to version 0.7.1.
- The issue was caused by the new version of `koog-agents` (via `kotlin-logging`) or other libraries writing diagnostic messages to `System.out`, which interferes with the MCP stdio protocol.
### Changes
- Implemented a fail-safe in `McpServer.kt` that redirects `System.out` to `System.err` at the start of the `main` function, while preserving the original `stdout` for the MCP transport.Antonii Belyshev
03/31/2026, 10:54 AM