Warn at session start when uv is missing - #5
Merged
Merged
Conversation
The genealogy MCP server is launched via `uv run` (.mcp.json). If uv is not on PATH the server fails to start and its tools silently never load — a confusing failure mode with no actionable message. Add a SessionStart hook that checks for uv and, when missing, shows the user install instructions and tells Claude the tools are unavailable (stays silent on the happy path). Ships in two shell-pinned flavours so it runs whichever shell Claude Code selects: - hooks/check-uv.sh — bash (macOS, Linux, Windows + Git Bash) - hooks/check-uv.ps1 — PowerShell (Windows without Git Bash); the command sets a process-scoped Bypass execution policy so the .ps1 can run - hooks/hooks.json — registers both on SessionStart (startup + resume), each pinned via the `shell` field Document the uv requirement (macOS/Linux + Windows install) in README and note the hook in CLAUDE.md. The .ps1 path is not yet verified on a real Windows host — cross-platform `shell`-field behaviour is undocumented. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The genealogy MCP server is launched via
uv run(see.mcp.json). Ifuvisn't on the user'sPATH, the server fails to start and all its tools silently never load —uv: command not foundwith no actionable guidance.Change
Add a
SessionStarthook that checks foruvand, when it's missing, surfaces a clear install message to the user and injects context telling Claude the tools are unavailable (so it explains rather than blindly calling them). Stays completely silent on the happy path.To work regardless of the shell Claude Code selects, the check ships in two shell-pinned flavours:
hooks/check-uv.shbashhooks/check-uv.ps1powershellhooks/hooks.jsonSessionStart(startup+resume), each pinned via theshellfieldThe PowerShell command sets a process-scoped
Bypassexecution policy so the.ps1can run on default Windows hosts. Both scripts emit the sameSessionStartJSON (systemMessage+hookSpecificOutput.additionalContext).Docs updated: README gains a Requirements section (uv install for macOS/Linux and Windows); CLAUDE.md documents the hook.
Testing
hooks/check-uv.sh: verified silent (exit 0, 0 bytes) whenuvis present; emits valid single-line JSON (validated withjq) whenuvis absent.hooks/hooks.json: structure validated (2 matchers ×{bash, powershell}, correctshellpins).100755) is committed so Git Bash on Windows treats the.shas runnable.hooks/check-uv.ps1has not been exercised on a real Windows host —pwshisn't available in the dev environment, and cross-platformshell-field behaviour is undocumented. Needs a Windows smoke test before fully relying on it.🤖 Generated with Claude Code