MCP Server Logger

by mlshv

23 stars
172 downloads
Not rated
GitHub

About

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…

Details

Author
mlshv
GitHub stars
23
Downloads
172
Categories
Other

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server Logger
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server logger": {
            "mcps-logger": {
                "command": "npx",
                "args": [
                    "mcps-logger"
                ]
            }
        }
    }
}

McpServers

{
    "mcps-logger": {
        "command": "npx",
        "args": [
            "mcps-logger"
        ]
    }
}

MCP Server Logger

console.log for your stdio MCP server

npm version
License: 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:

npx mcps-logger

Install the logger in your MCP server:

npm install mcps-logger

Add it to your MCP server entry file:

import "mcps-logger/console";

Or if you want to use in development mode only:

if (process.env.NODE_ENV !== "production") {
    import("mcps-logger/console");
}
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.