[#2] Stdio server spawn-test #2

Closed
opened 2026-07-02 00:49:12 -04:00 by the_og · 0 comments
Owner

Problem

check_dependency() only verifies whether command resolves on PATH — it does not verify the server actually starts. The single most common troubleshooting step people do by hand is "run the server manually to see if it starts without errors" (MCP official debugging docs). BCC stops one step short of that.

Proposed solution

Add a Test launch function in bcc_core.py that:

  1. Spawns the process using subprocess with the server's command, args, and env.
  2. Waits up to a short timeout (e.g. 3 s) for the process to crash or produce output.
  3. Captures stderr (MCP servers must not write non-JSON-RPC content to stdout, so stderr is the right debug channel).
  4. Returns a result dict: {outcome: "ok"|"crashed"|"timeout", stderr: str, returncode: int|None}.

The GUI (bcc.py) adds a Test launch button next to each stdio server row; clicking it runs the above in a QThread (same pattern as ConnTester) and shows the result inline (green/red) with a Copy output action.

Acceptance criteria

  • Core function is in bcc_core.py with no GUI imports; has unit tests in tests/test_core.py.
  • Spawning a valid server (e.g. python -c "import time; time.sleep(10)") → timeout.
  • Spawning an immediately-crashing command → crashed with stderr.
  • Spawning command-that-does-not-exist → handled gracefully (not a Python exception bubble).
  • Button appears per stdio server in the GUI; result shown inline; stderr tail available via Copy diagnostics.

Relevant code

  • bcc_core.py::check_dependency (~line 916) — PATH check to reuse/extend
  • bcc_core.py::runner_hint (~line 885)
  • bcc.py::ConnTester — pattern to follow for the QThread wrapper
## Problem `check_dependency()` only verifies whether `command` resolves on PATH — it does not verify the server actually starts. The single most common troubleshooting step people do by hand is "run the server manually to see if it starts without errors" (MCP official debugging docs). BCC stops one step short of that. ## Proposed solution Add a **Test launch** function in `bcc_core.py` that: 1. Spawns the process using `subprocess` with the server's `command`, `args`, and `env`. 2. Waits up to a short timeout (e.g. 3 s) for the process to crash or produce output. 3. Captures **stderr** (MCP servers must not write non-JSON-RPC content to stdout, so stderr is the right debug channel). 4. Returns a result dict: `{outcome: "ok"|"crashed"|"timeout", stderr: str, returncode: int|None}`. The GUI (`bcc.py`) adds a **Test launch** button next to each stdio server row; clicking it runs the above in a `QThread` (same pattern as `ConnTester`) and shows the result inline (green/red) with a **Copy output** action. ## Acceptance criteria - Core function is in `bcc_core.py` with no GUI imports; has unit tests in `tests/test_core.py`. - Spawning a valid server (e.g. `python -c "import time; time.sleep(10)"`) → `timeout`. - Spawning an immediately-crashing command → `crashed` with stderr. - Spawning `command-that-does-not-exist` → handled gracefully (not a Python exception bubble). - Button appears per stdio server in the GUI; result shown inline; `stderr` tail available via **Copy diagnostics**. ## Relevant code - `bcc_core.py::check_dependency` (~line 916) — PATH check to reuse/extend - `bcc_core.py::runner_hint` (~line 885) - `bcc.py::ConnTester` — pattern to follow for the QThread wrapper
the_og added the P0 label 2026-07-02 00:49:12 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: the_og/better-claude-config#2