Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#2,723 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nodejs, typescript
領域
testing

調査の方向性

clients/tui/src/logger.ts から始めてください。ここでは getTuiLogger() が MCP_INSPECTOR_LOG_DIR または HOME からディレクトリを解決します。また __tests__/App.test.tsx も確認してください。こちらは App をマウントし、その呼び出しを発生させます。空の一時ディレクトリを HOME に設定してそのファイルを実行し、.mcp-inspector/auth.log が存在するかを確認して再現してください。vitest.config.ts にある既存の MCP_INSPECTOR_SECRET_STORE の固定設定に倣い、ファイルごとの一時ディレクトリを MCP_INSPECTOR_LOG_DIR に設定するセットアップファイルを作成してください。一時的な HOME で実行してもその下にログが作られず、logger.test.ts が引き続き通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
11.1k
フォーク
1.5k
平均マージ
4時間 14分
マージ済み PR(30日)
162

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

modelcontextprotocol/inspector のほかの issue

modelcontextprotocol/inspector の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。