mcp-browser-dev-tools 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-browser-dev-tools",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Local MCP server for Chromium DevTools Protocol and Firefox WebDriver BiDi",
5
5
  "author": "Hinaser <rindo.hinase@gmail.com>",
6
6
  "license": "MIT",
package/src/app.mjs CHANGED
@@ -16,6 +16,7 @@ export function createBrowserDevToolsApp({
16
16
  level: config.logLevel,
17
17
  output: errorOutput,
18
18
  name: PACKAGE_NAME,
19
+ filePath: config.logFile,
19
20
  });
20
21
  const browserAdapter = createBrowserAdapter(config);
21
22
  const server = new McpBrowserDevToolsServer({
package/src/cli.mjs CHANGED
@@ -186,6 +186,7 @@ async function runRelay(options) {
186
186
  level: logging.logLevel,
187
187
  output: process.stderr,
188
188
  name: PACKAGE_NAME,
189
+ filePath: logging.logFile,
189
190
  });
190
191
  const relayOptions = resolveRelayOptions(options);
191
192
  const relay = await startTcpRelay({
package/src/config.mjs CHANGED
@@ -78,6 +78,7 @@ export function loadLoggingConfig(env = process.env) {
78
78
  return {
79
79
  logLevel: parseLogLevel(env.MCP_BROWSER_LOG_LEVEL),
80
80
  debugStdio: isTruthyFlag(env.MCP_BROWSER_DEBUG_STDIO),
81
+ logFile: env.MCP_BROWSER_LOG_FILE?.trim() || null,
81
82
  };
82
83
  }
83
84
 
@@ -123,6 +124,7 @@ export function loadConfig(env = process.env) {
123
124
  ),
124
125
  logLevel: logging.logLevel,
125
126
  debugStdio: logging.debugStdio,
127
+ logFile: logging.logFile,
126
128
  protocolVersion:
127
129
  env.MCP_PROTOCOL_VERSION?.trim() || DEFAULT_PROTOCOL_VERSION,
128
130
  };
package/src/logger.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { appendFileSync } from "node:fs";
1
2
  import process from "node:process";
2
3
 
3
4
  import { PACKAGE_NAME } from "./package-info.mjs";
@@ -21,6 +22,7 @@ export function createLogger({
21
22
  level = "error",
22
23
  output = process.stderr,
23
24
  name = PACKAGE_NAME,
25
+ filePath = null,
24
26
  } = {}) {
25
27
  const threshold = LOG_LEVELS[level] ?? LOG_LEVELS.error;
26
28
 
@@ -34,7 +36,15 @@ export function createLogger({
34
36
  return false;
35
37
  }
36
38
 
37
- output.write(`[${name}] ${messageLevel}: ${normalizeMessage(message)}\n`);
39
+ const line = `[${name}] ${messageLevel}: ${normalizeMessage(message)}\n`;
40
+ output.write(line);
41
+ if (filePath != null) {
42
+ try {
43
+ appendFileSync(filePath, line);
44
+ } catch {
45
+ // ignore file write errors to avoid crashing the server
46
+ }
47
+ }
38
48
  return true;
39
49
  },
40
50
  error(message, options) {