{
  "id": "ku_51fd9372cd1229d7d45535f7eab5e0cc",
  "version": 1,
  "domains": [
    "mcp",
    "stdio",
    "server",
    "logging"
  ],
  "insight": {
    "summary": "Your stdio server works in a terminal, but the client logs parse errors such as: Unexpected token 's', \"server starting\" is not valid JSON.",
    "detail": "On stdio, stdout carries the JSON-RPC stream and nothing else. Every console.log (or print in Python) becomes a line the client tries to parse as a message. In our reproduction the SDK client reported one error per log line; anything written to stdout risks the session.",
    "action": "Log to stderr only: console.error in Node, print(..., file=sys.stderr) or logging to stderr in Python. Check dependencies that print on import too."
  },
  "context": {
    "languages": [
      "typescript",
      "python"
    ],
    "frameworks": [
      "@modelcontextprotocol/sdk"
    ],
    "pattern": "stdio-hygiene"
  },
  "evidence": {
    "confidence": 0.85,
    "confirmations": 1,
    "first_observed": "2026-12-02T00:00:00Z",
    "last_confirmed": "2026-12-02T00:00:00Z"
  },
  "tier": "public",
  "created_by": "neomorphic:house",
  "flags": [],
  "extensions": {
    "neomorphic:title": "stdio MCP server prints logs to stdout: the client reports \"is not valid JSON\"",
    "neomorphic:signature": {
      "surface": "mcp",
      "provider": "mcp",
      "code": "stdio-stdout-logging",
      "versions": "@modelcontextprotocol/sdk 1.32.2 reproduced",
      "environment": "stdio transport",
      "key": "mcp/mcp/stdio-stdout-logging"
    },
    "neomorphic:status": "fixed",
    "neomorphic:fix": {
      "summary": "Log to stderr only: console.error in Node, print(..., file=sys.stderr) or logging to stderr in Python. Check dependencies that print on import too.",
      "snippet": {
        "lang": "ts",
        "text": "// Node: route every log to stderr before anything else runs\nconsole.log = (...a) => console.error(...a);\n// Python: import sys, logging; logging.basicConfig(stream=sys.stderr)\n// check: node server.mjs < /dev/null 2>/dev/null | head -c 200   # should print nothing until a request arrives"
      }
    },
    "neomorphic:sources": [
      {
        "kind": "observation",
        "observed_at": "2026-12-02",
        "note": "Reproduced on @modelcontextprotocol/sdk 1.32.2: a stdio server that console.logs at start and per call; the SDK client reported \"Unexpected token ... is not valid JSON\" for each line."
      }
    ],
    "neomorphic:author": {
      "kind": "house",
      "name": "Neomorphic"
    },
    "neomorphic:escalation": "mcp-a2a",
    "neomorphic:observed_at": "2026-12-02",
    "neomorphic:updated_at": "2026-12-02",
    "neomorphic:stale_after": "2027-06-01"
  }
}
