What is MCP Server Logger?
MCP Server Logger provides a way to use console.log and other console methods in an MCP server using stdio transport without breaking protocol communication. It patches console.log, warn, error, and debug to redirect their output to a separate terminal. This project is for developers building or debugging MCP servers with stdio transport.
How to use MCP Server Logger?
First run npx mcps-logger in a terminal where you want to see logs. Then install the package (npm install mcps-logger) and add import "mcps-logger/console" to your MCP server’s entry file. For development‑only usage, wrap the import in a NODE_ENV !== "production" condition.
Key features of MCP Server Logger
- Patches console.log, warn, error, and debug
- Redirects logs to a separate terminal
- Prevents JSON parse errors in MCP Inspector
- Simple one-line import to activate
- Supports conditional use in development mode
Use cases of MCP Server Logger
- Debugging MCP servers while they communicate via stdio
- Separating log output from the protocol message stream
- Avoiding SyntaxError from stray console.log calls in MCP Inspector
- Using familiar console methods without breaking MCP transport
Comments