diff --git a/README.md b/README.md index f184891..9f29f0e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ npx mcp-server-nodejs-api-docs ``` -You can debug calls for the MCP Server by inspecting the file `/tmp/mcp-server-nodejs-docs.log` which this MCP Server writes to. +You can debug calls for the MCP Server by inspecting the file `mcp-server-nodejs-docs.log` in your system's temporary directory (e.g., `/tmp` on Unix-like systems or `%TEMP%` on Windows) which this MCP Server writes to. ## Usage: as a Docker container diff --git a/src/utils/logger.ts b/src/utils/logger.ts index a165870..65959bb 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,12 +1,12 @@ import { pino } from 'pino' import type { Logger } from 'pino' +import * as path from 'path' +import * as os from 'os' // Re-export pino types for use in other modules export type { Logger } from 'pino' -// @TODO change the log file path to be cross-platform compatible -// and support other OSs -const logFilePath = '/tmp/mcp-server-nodejs-docs.log' +const logFilePath = path.join(os.tmpdir(), 'mcp-server-nodejs-docs.log') export function initLogger (): Logger { const logLevel = process.argv.includes('--debug') ? 'debug' : 'info'