Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

TUI tests append to the developer's real ~/.mcp-inspector/auth.log (App.test.tsx mounts the real getTuiLogger)

Aperta Adatta ai principianti
#2,723 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript
Ambito
testing

Direzione di ricerca

Inizia da clients/tui/src/logger.ts, dove getTuiLogger() determina la propria directory a partire da MCP_INSPECTOR_LOG_DIR o HOME, e da __tests__/App.test.tsx, che monta App e attiva quella chiamata. Riproduci il problema eseguendo quel file con HOME impostato su una directory temporanea vuota e verifica la presenza di .mcp-inspector/auth.log. Segui il pin esistente di MCP_INSPECTOR_SECRET_STORE in vitest.config.ts per creare un file di setup che imposti MCP_INSPECTOR_LOG_DIR su una directory temporanea per ogni file. È completato quando l'esecuzione con HOME temporaneo non crea alcun log sotto HOME e logger.test.ts continua a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug report

Which version line? v2 — current
Which client? TUI
Inspector version: 2.11.0 (v2/main @ 074b8108)
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: only App.test.tsx leaks; the rest are clean.
  • clients/mcpdo OAuth-touching suites (connection-stored-auth, daemon-connections, ema, ema-login-helper, mcp-auth-coverage) are clean — they set MCP_INSPECTOR_OAUTH_STATE_PATH per test.
  • clients/launcher has no storage-touching tests.
  • clients/web unit tests use a recording backend for OAuth persistence (integration was isolated in #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.

Lingua principale
TypeScript
Stelle
11.1k
Fork
1.5k
Merge medio
4h 14m
PR unite (30g)
162

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelcontextprotocol/inspector

Tutte le issue di modelcontextprotocol/inspector

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.