mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-22 17:02:19 +01:00
The MCP venv went a month without a resync and the server crashed on import (missing leisure_watch) while setup_mcp.sh still passed, because it imported only the bare package. - setup_mcp.sh now imports steam_backlog_enforcer._mcp, the module .mcp.json runs, and exits 1 with a FAIL line when it cannot. - deploy.sh resyncs the MCP venv on every deploy and adds check 5: the server must answer an initialize request over stdio. - scripts/mcp_probe.py is that probe (stdlib, typed). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWuLpGVY9MnowhTNcM
49 lines
1.8 KiB
Bash
Executable File
49 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# ============================================================================
|
|
# Set up the dedicated virtualenv that hosts the Steam Backlog Enforcer MCP
|
|
# server. Claude Code spawns this interpreter (see the repo-root .mcp.json) to
|
|
# run `python -m steam_backlog_enforcer._mcp` over stdio.
|
|
#
|
|
# The MCP SDK (`mcp`) lives ONLY in this venv — it is an optional dependency,
|
|
# deliberately kept out of the system/CLI/systemd python path. Both `mcp` and
|
|
# `steam_backlog_enforcer` must be importable by this one interpreter or the
|
|
# MCP server fails to start silently.
|
|
#
|
|
# Idempotent: safe to re-run to pick up dependency changes.
|
|
# ============================================================================
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly SCRIPT_DIR
|
|
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
readonly REPO_DIR
|
|
readonly VENV_DIR="${HOME}/.venvs/steam-backlog-mcp"
|
|
|
|
main() {
|
|
echo "== Setting up MCP venv at ${VENV_DIR} =="
|
|
|
|
if [[ ! -d "${VENV_DIR}" ]]; then
|
|
python3 -m venv "${VENV_DIR}"
|
|
fi
|
|
|
|
"${VENV_DIR}/bin/pip" install --quiet --upgrade pip
|
|
"${VENV_DIR}/bin/pip" install --quiet -e "${REPO_DIR}[mcp]"
|
|
|
|
# Import the exact module .mcp.json runs: the bare package imports fine
|
|
# even when a dependency of the server's import chain is missing.
|
|
echo "== Verifying imports =="
|
|
if ! "${VENV_DIR}/bin/python" -c "import mcp, steam_backlog_enforcer._mcp"; then
|
|
echo "setup_mcp: FAIL: ${VENV_DIR}/bin/python cannot import steam_backlog_enforcer._mcp; the MCP server will not start" >&2
|
|
exit 1
|
|
fi
|
|
echo "mcp + steam_backlog_enforcer._mcp import OK"
|
|
|
|
echo
|
|
echo "Done. The server is registered via ${REPO_DIR}/.mcp.json"
|
|
echo "Restart Claude Code in this repo and approve the project MCP server prompt."
|
|
}
|
|
|
|
main "$@"
|