TUI tests append to the developer's real ~/.mcp-inspector/auth.log (App.test.tsx mounts the real getTuiLogger)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 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 固定方式,新增一个 setup 文件,将 MCP_INSPECTOR_LOG_DIR 设为每个文件独立的临时目录。当使用临时 HOME 的运行不在 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: 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 #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 小时 28 分钟
- 30 天内合并 PR
- 151
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/inspector 的其他 Issue
-
insufficient_scope challenge retry doesn't detect expired access token, gives up after one identical retry可能已有人在做 @its-nott-me 于 1 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 50/100
modelcontextprotocol/inspector#2724 · 2 条评论 ·
维护者通常 1 天内回复
-
Modern subscriptions: a subscriptions/listen refused with HTTP 403 is retried eight times in silence未关闭bug v2
难度 4/5 3-5 天 新手友好度 30/100
modelcontextprotocol/inspector#2722 · 1 条评论 ·
维护者通常 1 天内回复
-
bug v2
难度 3/5 1-2 天 新手友好度 50/100
modelcontextprotocol/inspector#2721 · 2 条评论 ·
维护者通常 1 天内回复
-
bug v2
难度 3/5 半天 新手友好度 62/100
modelcontextprotocol/inspector#2719 ·
维护者通常 1 天内回复
-
chore v2
难度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/inspector#2715 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/inspector 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
agilepathway/label-checker#739 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 68/100
CopilotKit/OpenBot#800 ·
维护者通常 1 天内回复
-
Endpoint links in the tag operations list are below the 24px target size可能已有人在做 @AdzerKI 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复