From harn
Generate MCP server health check for SessionStart. Triggers: /harn:mcp-check, 'MCP health', 'check MCP servers', 'validate MCP'
How this skill is triggered — by the user, by Claude, or both
Slash command
/harn:mcp-validatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate a bash script at `scripts/harness/mcp_health.sh` that validates configured MCP servers are reachable. This runs from the SessionStart hook as an informational check (never blocks).
Generate a bash script at scripts/harness/mcp_health.sh that validates configured MCP servers are reachable. This runs from the SessionStart hook as an informational check (never blocks).
Create scripts/harness/mcp_health.sh and make it executable:
#!/usr/bin/env bash
# SessionStart hook — MCP server health check.
# Informational only — always exits 0.
PROJECT_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
# Find settings file
SETTINGS=""
for candidate in "${PROJECT_ROOT}/.claude/settings.local.json" "${PROJECT_ROOT}/.claude/settings.json"; do
if [ -f "$candidate" ]; then
SETTINGS="$candidate"
break
fi
done
if [ -z "$SETTINGS" ]; then
# No settings file — nothing to check
exit 0
fi
# Check if jq is available
if ! command -v jq &>/dev/null; then
echo "Harn: jq not found — skipping MCP health check." >&2
exit 0
fi
# Extract MCP server names
SERVERS=$(jq -r '.mcpServers // {} | keys[]' "$SETTINGS" 2>/dev/null)
if [ -z "$SERVERS" ]; then
exit 0
fi
FAILED=()
CHECKED=0
while IFS= read -r name; do
CHECKED=$((CHECKED + 1))
# Check if server has a command
CMD=$(jq -r --arg n "$name" '.mcpServers[$n].command // empty' "$SETTINGS" 2>/dev/null)
if [ -n "$CMD" ]; then
if ! command -v "$CMD" &>/dev/null; then
FAILED+=("$name")
fi
continue
fi
# Check if server has a url
URL=$(jq -r --arg n "$name" '.mcpServers[$n].url // empty' "$SETTINGS" 2>/dev/null)
if [ -n "$URL" ]; then
if ! curl -sf --max-time 2 "$URL" >/dev/null 2>&1; then
FAILED+=("$name")
fi
continue
fi
done <<< "$SERVERS"
if [ ${#FAILED[@]} -eq 0 ]; then
echo "Harn: All MCP servers reachable." >&2
else
for name in "${FAILED[@]}"; do
echo "Harn: MCP server '${name}' unreachable — tools may fail." >&2
done
fi
exit 0
If scripts/harness/session-start.sh exists, append the MCP health check call. If it does not exist, create it with:
#!/usr/bin/env bash
# SessionStart hook — runs at the beginning of each agent session.
set -uo pipefail
PROJECT_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
# Check MCP servers
if [ -f "${PROJECT_ROOT}/scripts/harness/mcp_health.sh" ]; then
bash "${PROJECT_ROOT}/scripts/harness/mcp_health.sh" 2>&1 || true
fi
If session-start.sh already exists, add the following block before the final line (or at the end):
# Check MCP servers
if [ -f "${PROJECT_ROOT}/scripts/harness/mcp_health.sh" ]; then
bash "${PROJECT_ROOT}/scripts/harness/mcp_health.sh" 2>&1 || true
fi
Make both scripts executable:
chmod +x scripts/harness/mcp_health.sh
chmod +x scripts/harness/session-start.sh
If .claude/settings.json does not already have a SessionStart hook, add one:
{
"hooks": {
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash scripts/harness/session-start.sh",
"timeout": 15
}
]
}
]
}
}
If the file already has hooks, merge the SessionStart entry without overwriting existing hooks.
After creating and wiring the scripts, report what was done:
scripts/harness/mcp_health.shscripts/harness/session-start.shSessionStart hook in .claude/settings.jsonnpx claudepluginhub sliday/harnValidates Claude project MCP configurations: JSON structure in .claude/settings.json, mcpServers object, commands/args/env vars, essential MCPs (memory, filesystem, github), security for hardcoded secrets. Suggests fixes.
Performs fast pre-flight health checks on Grainulator MCP servers (wheat, mill, silo). Reports status table and provides exact fix commands for failures. Use before sessions to prevent disconnections.
Installs and troubleshoots MCP servers by placing binaries in stable paths (npm -g, uvx, uv tool), updating the HTTP MCP daemon script, and registering in Claude config files.