mlshv_mcps_logger

mlshv_mcps_logger

by mlshv
A logging utility for stdio-based MCP servers, redirecting console logs to a separate terminal.

MCP Server Logger: Streamline Debugging for MCP Servers

npm version
License: MIT

Overview

The MCP Server Logger is a specialized tool designed to enhance the debugging experience for developers working with MCP (Model Context Protocol) servers using stdio transport. It solves the common issue where console.log interferes with protocol communication, causing errors in MCP inspectors.

Why Use MCP Server Logger?

When developing an MCP server, using console.log directly can disrupt the protocol communication. For example, calling console.log in your MCP server code often results in errors like:

Error from MCP server: SyntaxError: Unexpected token S in JSON at position 0

This package provides a seamless solution by patching console methods (log, warn, error, debug) and redirecting logs to a separate terminal.

Solution

The MCP Server Logger patches the console methods and ensures that logs are redirected to a dedicated terminal, preventing interference with the MCP protocol. This allows developers to debug their MCP servers without disrupting the communication flow.

Usage

Step 1: Start the Logger

Open a terminal where you want to see the logs and run:

npx mcps-logger

Step 2: Install the Logger in Your MCP Server

Install the logger in your MCP server project:

npm install mcps-logger

Step 3: Integrate the Logger

Add the logger to your MCP server entry file:

import "mcps-logger/console";

Alternatively, for development-only usage:

if (process.env.NODE_ENV !== "production") {
    import("mcps-logger/console");
}

About

The MCP Server Logger is a lightweight, MIT-licensed tool that simplifies debugging for MCP servers. It ensures that logs are captured and displayed without interfering with the protocol, making it an essential utility for MCP server developers.

Resources

License

Activity

Stars

Watchers

Forks

Languages

  • TypeScript: 66.6%
  • JavaScript: 33.4%

Features & Capabilities

Categories
mcp_server model_context_protocol typescript javascript logging stdio

Implementation Details

Stats

0 Views
8 GitHub Stars

Repository Info

mlshv Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300