Repository navigation
Description
Bug report
Which version line? v2 — current
Which client? TUI
Inspector version: 2.11.0 (v2/main @ 074b810)
Node version: v24.20.0
Operating system: Linux (also applies anywhere HOME resolves)
Transport: Not applicable / never connected
Problem
The TUI test suite writes to the developer's real ~/.mcp-inspector/auth.log. clients/tui/src/logger.ts's getTuiLogger() is a lazy singleton that resolves its log directory from MCP_INSPECTOR_LOG_DIR ?? HOME/.mcp-inspector, and __tests__/App.test.tsx mounts App, which calls getTuiLogger() on startup — so a normal test run appends ~155 lines of test noise ("msg":"TUI started", test-process pid/hostname) to the real log. Concurrent worktree gates interleave into the same file. This is the same class of bug as #2670 / #2719 (tests touching the real ~/.mcp-inspector), one directory up: the log file rather than the OAuth state.
logger.test.ts itself is clean — it tests each resolution arm with vi.resetModules(), per-test env save/restore, and a temp HOME. The leak comes from the app-mounting suites, which never set the override.
Reproduce
Point HOME at an empty scratch dir and run the suite; the log file appears under the scratch home:
cd clients/tui
H=$(mktemp -d)
HOME=$H npx vitest run __tests__/App.test.tsx
find $H -name 'auth.log' # → $H/.mcp-inspector/auth.log, ~155 lines of {"msg":"TUI started",...}Scope checked (same scratch-HOME sweep)
- All 49
clients/tui/__tests__files swept individually: onlyApp.test.tsxleaks; the rest are clean. clients/mcpdoOAuth-touching suites (connection-stored-auth,daemon-connections,ema,ema-login-helper,mcp-auth-coverage) are clean — they setMCP_INSPECTOR_OAUTH_STATE_PATHper test.clients/launcherhas no storage-touching tests.clients/webunit tests use a recording backend for OAuth persistence (integration was isolated in test(web): isolate integration OAuth state from ~/.mcp-inspector (#2670) #2677).
Expected
No TUI test reads or writes the developer's real ~/.mcp-inspector/auth.log.
Suggested fix shape
The #2677 shape, one directory over: a TUI vitest setup file that pins MCP_INSPECTOR_LOG_DIR at a per-file mkdtemp directory (plus a guard that fails if the resolved path escapes tmpdir). logger.test.ts's fallback-arm cases are unaffected — they delete the variable and set their own HOME per test with a fresh module import. The tui project already pins MCP_INSPECTOR_SECRET_STORE: "memory" in vitest.config.ts; this would be the log-dir counterpart.
Actual behavior
~/.mcp-inspector/auth.log is created/appended on the developer's real home directory on every tui test run that mounts App.
I searched existing issues and this is not a duplicate (nearest are #2670 / #2719, which cover the OAuth state file, not the TUI log). This is not a security vulnerability report.
Activity
CloudCorpRecords commentedon Oct 15, 2026
Confirming the report, with a verified prototype. (Posting the detail here rather than a PR, per this repo's maintainer-only PR rule.)
Reproduced on a fresh clone of v2/main: with HOME pointed at an empty scratch directory, running
HOME= vitest run tests/App.test.tsx
from clients/tui passes (130 tests) and leaves exactly 155 lines in /.mcp-inspector/auth.log, matching the count in the report.
Prototype I verified: in clients/tui/tests/setup.ts, the setupFile every TUI test file already inherits, create a per-test-file temporary directory (fs.mkdtempSync under os.tmpdir()), set process.env.MCP_INSPECTOR_LOG_DIR to it before anything mounts the App, and remove the directory on process exit. Nothing else changes. logger.test.ts sets and restores this variable itself per test, so it is unaffected, and the lazy logger singleton resolves the override on first use in each test file, so per-file isolation also stops concurrent worktrees interleaving into one file.
Results with the prototype in place: the full TUI suite passes (47 files, 636 tests), the scratch HOME is left completely empty, and the setup file is prettier-clean.
If you would rather see the override somewhere else (a vitest config env entry, or per-suite setup in the mounting tests), I can re-run the verification against that shape instead.
cliffhall commentedon Oct 20, 2026
Triage: Priority Low (total 5)
~/.mcp-inspector/auth.log. No user-facing or data-integrity impact, and it's milder than the OAuth-state siblings (Web integration tests read and write the developer's real ~/.mcp-inspector OAuth state file #2670, CLI tests write the developer's real ~/.mcp-inspector OAuth state file (oauth-runner, programmatic-ergonomics) #2719).bugBoard: #28, Status
Incoming, awaiting maintainer review (no milestone yet).cliffhall commentedon Oct 20, 2026
Shipped in #2735.
nosmile99 commentedon Oct 20, 2026
Thanks for shipping this, cliffhall — appreciate the triage and the quick fix in #2735.
test(tui): pin MCP_INSPECTOR_LOG_DIR to a per-file temp dir