Content
# MCP Server Logger
console.log for your stdio MCP server
[](https://www.npmjs.com/package/mcps-logger)
[](https://opensource.org/licenses/MIT)
## Why?
When developing an MCP (Model Context Protocol) server with stdio transport, console.log interferes with the protocol communication.
For example, this is what you normally get in MCP inspector `npx @modelcontextprotocol/inspector` when calling `console.log` in your MCP server code:
```
Error from MCP server: SyntaxError: Unexpected token S in JSON at position 0
```
## Solution
This package patches the console methods (log, warn, error, debug) and redirects logs to a separate terminal.
https://github.com/user-attachments/assets/33ff367e-74b4-48e8-9f04-0bcafbad5e00
## Usage
Start the logger in a terminal where you want to see the logs:
```shell
npx mcps-logger
```
Install the logger in your MCP server:
```shell
npm install mcps-logger
```
Add it to your MCP server entry file:
```typescript
import "mcps-logger/console";
```
Or if you want to use in development mode only:
```typescript
if (process.env.NODE_ENV !== "production") {
import("mcps-logger/console");
}
```
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
git
A Model Context Protocol server for Git automation and interaction.