mcplog
v0.0.5
Published
Small JSON-lines logger for MCP servers.
Downloads
23
Readme
mcplog
Small JSON-lines logger for MCP servers.
Install
pnpm add mcplog
# or
npm install mcplogUsage
import { McpLogger } from "mcplog";Usage
import { McpLogger } from "mcp-log";
const logger = new McpLogger({ name: "my-mcp-server" });
logger.info("server started", { port: 3000 });
logger.error("request failed", { requestId: "abc123" });Logs are written to stderr by default so MCP protocol messages on stdout stay untouched. Set CLANKER_LOG_FILE or pass filePath to write JSON lines to a file instead.
API
new McpLogger({
name: string,
level?: "debug" | "info" | "warn" | "error",
filePath?: string,
stderr?: { write(chunk: string): unknown },
})Methods: debug, info, warn, and error.
The package also exports the LogLevel and LogSink types.
