Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

CLI tests seed the developer's real ~/.mcp-inspector/mcp.json (cli.test.ts, completion.test.ts)

Đang mở Phù hợp với người mới
#2,765 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
cli, testing

Hướng nghiên cứu

Đọc clients/cli/__tests__/cli.test.ts và clients/cli/__tests__/completion.test.ts, sau đó theo dõi cách serverList phân giải đường dẫn danh mục mặc định và so sánh với thiết lập cho #2728. Dùng một thư mục tạm riêng cho mỗi tệp để chứa danh mục và thêm một bước kiểm tra khiến quá trình thất bại nếu đường dẫn của nó được phân giải ra ngoài os.tmpdir(). Chạy hai tệp Vitest đã nêu và xác nhận chúng không làm thay đổi thư mục home thực.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug v2

Found during the v2.12.0 release smoke (#2764), while verifying #2719.

Problem

Two CLI test files still write the developer's real ~/.mcp-inspector/mcp.json: clients/cli/__tests__/cli.test.ts and clients/cli/__tests__/completion.test.ts. #2719 isolated the OAuth state file (oauth.json*) and #2723 isolated the TUI's auth.log. Nothing isolates the default server catalog, though, so on a machine with no catalog yet, a CLI test run seeds {"mcpServers": {}} into the real home directory.

Neither test file changed since 2.11.0, so this predates the v2.12.0 milestone and is not a regression.

Reproduce

cd clients/cli
for f in __tests__/*.test.ts; do H=$(mktemp -d); HOME=$H npx vitest run $f >/dev/null 2>&1; [ -e $H/.mcp-inspector ] && echo "$f -> $(cd $H && find .mcp-inspector -type f)"; done

Observed on the v2.12.0 merge tree:

__tests__/cli.test.ts -> .mcp-inspector/mcp.json
__tests__/completion.test.ts -> .mcp-inspector/mcp.json

Expected

A CLI test run leaves HOME untouched. The fix should use the same shape as #2728: point the catalog path (MCP_STORAGE_DIR, or whatever serverList resolves the default catalog from) at a per-file mkdtemp directory in a setup file. It should also add a guard that fails a test whose catalog path resolves outside os.tmpdir().

Impact

The seed only happens when no catalog exists, so an existing mcp.json is never overwritten. The impact is a stray empty catalog on a fresh machine, plus concurrent worktree runs sharing one file.

Ngôn ngữ chính
TypeScript
Star
11.1k
Fork
1.6k
Merge trung bình
5 giờ 29 phút
Pull request đã merge (30 ngày)
158

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/inspector

Tất cả issue của modelcontextprotocol/inspector

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.