MCP Server Logger
by mlshv
MCP Server Logger redirects console logs to a separate terminal when developing an MCP server with stdio transport. This prevents console.log from interfering with the protocol communication.
Last updated: N/A
What is MCP Server Logger?
MCP Server Logger is a tool that patches console methods (log, warn, error, debug) and redirects logs to a separate terminal. It's designed for developers working with MCP (Model Context Protocol) servers using stdio transport, where standard console logging can disrupt protocol communication.
How to use MCP Server Logger?
- Start the logger in a separate terminal using
npx mcps-logger
. 2. Install the logger in your MCP server project usingnpm install mcps-logger
. 3. Import the logger in your MCP server entry file usingimport "mcps-logger/console";
. You can conditionally import it in development mode.
Key features of MCP Server Logger
Redirects console logs to a separate terminal
Patches console methods (log, warn, error, debug)
Prevents interference with MCP protocol communication
Easy to install and use
Can be used in development mode only
Use cases of MCP Server Logger
Debugging MCP servers with stdio transport
Developing MCP applications where console logs interfere with protocol
Isolating console output during MCP development
Monitoring MCP server activity without disrupting communication
FAQ from MCP Server Logger
Why do I need this?
Why do I need this?
When developing an MCP server with stdio transport, console.log interferes with the protocol communication.
How do I install it?
How do I install it?
Use npm install mcps-logger
in your MCP server project.
How do I start the logger?
How do I start the logger?
Run npx mcps-logger
in a separate terminal.
How do I use it in my code?
How do I use it in my code?
Add import "mcps-logger/console";
to your MCP server entry file.
Can I use it only in development?
Can I use it only in development?
Yes, you can conditionally import it based on the NODE_ENV
environment variable.