Model Context Protocol (MCP) 1 · Python server

Log without breaking stdio

A stdio server must not write to stdout, which carries protocol messages. Log to stderr.

import logging, sys

logging.basicConfig(stream=sys.stderr, level=logging.INFO)

Official Model Context Protocol (MCP) 1 documentation

More python server commands

All python server commands · Model Context Protocol (MCP) 1 cheatsheet

Was this page helpful?