feat: in-app MCP server log viewer (#6) #23

Closed
the_og wants to merge 0 commits from feat/6-log-viewer into main
Owner

Closes #6

What

  • Core (bcc_core.py): server_log_path(name: str) -> Path | None — returns the platform-specific Claude Desktop MCP log path for a server, or None if it doesn't exist yet.
    • macOS: ~/Library/Logs/Claude/mcp-server-<name>.log
    • Windows: %APPDATA%\Claude\logs\mcp.log
    • Other platforms: None (no known Claude Desktop log location)
  • GUI (bcc.py): new "View logs" button in the server detail panel (ServerEditor), next to "Test launch" / "Details". Opens LogViewerDialog — a read-only QPlainTextEdit that polls the log file every 1.5s via QTimer (auto-tail, scrolls to bottom only if already at the bottom), tails at most the last 300 KB, and shows a graceful "No log file for '' yet." message instead of erroring when the file doesn't exist.
  • Tests (tests/test_core.py): 5 new tests for server_log_path — macOS found/missing, Windows found/missing (via monkeypatch.setattr(sys, "platform", ...) + APPDATA env), and an unsupported-platform case. server_log_path branches on sys.platform only (not os.name), so tests never mutate os.name, which would otherwise corrupt pathlib's internal Path subclass dispatch mid-test-run.

Verification

  • ruff check . — all checks passed
  • ruff format --check . — clean
  • pytest -q — 97 passed (was 92 on main; +5 new tests), 0 failures/errors
  • bcc_core.py (incl. server_log_path) imports and runs with no display required

Caveats

  • bcc.py needs a real Qt platform backend to import in a headless CI-like box (pre-existing PySide6 constraint, not introduced by this change) — verification here exercised bcc_core.py directly plus ruff/pytest against the full tree.
  • The log viewer never writes to the log file — strictly read-only, per the diagnostics-panel pattern already used elsewhere in the app.
Closes #6 ## What - **Core** (`bcc_core.py`): `server_log_path(name: str) -> Path | None` — returns the platform-specific Claude Desktop MCP log path for a server, or `None` if it doesn't exist yet. - macOS: `~/Library/Logs/Claude/mcp-server-<name>.log` - Windows: `%APPDATA%\Claude\logs\mcp.log` - Other platforms: `None` (no known Claude Desktop log location) - **GUI** (`bcc.py`): new "View logs" button in the server detail panel (`ServerEditor`), next to "Test launch" / "Details". Opens `LogViewerDialog` — a read-only `QPlainTextEdit` that polls the log file every 1.5s via `QTimer` (auto-tail, scrolls to bottom only if already at the bottom), tails at most the last 300 KB, and shows a graceful "No log file for '<name>' yet." message instead of erroring when the file doesn't exist. - **Tests** (`tests/test_core.py`): 5 new tests for `server_log_path` — macOS found/missing, Windows found/missing (via `monkeypatch.setattr(sys, "platform", ...)` + `APPDATA` env), and an unsupported-platform case. `server_log_path` branches on `sys.platform` only (not `os.name`), so tests never mutate `os.name`, which would otherwise corrupt `pathlib`'s internal `Path` subclass dispatch mid-test-run. ## Verification - `ruff check .` — all checks passed - `ruff format --check .` — clean - `pytest -q` — 97 passed (was 92 on `main`; +5 new tests), 0 failures/errors - `bcc_core.py` (incl. `server_log_path`) imports and runs with no display required ## Caveats - `bcc.py` needs a real Qt platform backend to import in a headless CI-like box (pre-existing `PySide6` constraint, not introduced by this change) — verification here exercised `bcc_core.py` directly plus `ruff`/`pytest` against the full tree. - The log viewer never writes to the log file — strictly read-only, per the diagnostics-panel pattern already used elsewhere in the app.
the_og added the P1 label 2026-07-07 20:41:11 -04:00
the_og added 5 commits 2026-07-07 20:41:12 -04:00
Author
Owner

Supervisor review (Cowork): approve. CI run #158 green; isolated diff. server_log_path returns the correct platform paths (None when missing); LogViewerDialog is read-only with throttled tailing and a graceful "no log yet". Same benign _normalize_unicode NBSP-line rewrite as #22/#24/#25 (resolve at merge). Ready for v1.2.0.

Supervisor review (Cowork): **approve.** CI run #158 green; isolated diff. `server_log_path` returns the correct platform paths (None when missing); `LogViewerDialog` is read-only with throttled tailing and a graceful "no log yet". Same benign `_normalize_unicode` NBSP-line rewrite as #22/#24/#25 (resolve at merge). Ready for v1.2.0.
Author
Owner

Superseded by #26 (release: v1.2.0), which merged this change into main as part of the integrated release. Closing.

Superseded by #26 (release: v1.2.0), which merged this change into `main` as part of the integrated release. Closing.
the_og closed this pull request 2026-07-08 11:35:43 -04:00
Some checks are pending
CI / Lint (ruff) (pull_request) Successful in 6s
CI / Tests (py3.10) (pull_request) Successful in 7s
CI / Tests (py3.12) (pull_request) Successful in 8s

Pull request closed

Sign in to join this conversation.