Back to course

Logging and Debugging MCP Servers

Model Context Protocol (MCP) Server Engineering

Debugging Like a Pro

You can't use console.log in Stdio servers because it interferes with the protocol messages! Use the Logging capability of MCP.

typescript server.sendLoggingMessage({ level: "info", data: "Something happened!" });

Assignment: Add logging to your server and view the logs in the MCP Inspector.