Automate venv creation for installed marketplace #98

Closed
opened 2026-01-22 16:00:48 +00:00 by lmiranda · 1 comment
Owner

Problem

Claude Code copies files to ~/.claude/plugins/marketplaces/ but does NOT create venvs. Users must manually run setup.sh, causing 'X MCP servers failed' errors.

Current Workaround

cd ~/.claude/plugins/marketplaces/leo-claude-mktplace && ./scripts/setup.sh

Options to Investigate

  • Post-install hook in marketplace.json
  • Wrapper install script
  • Self-healing MCP server

Acceptance Criteria

  • Users don't need manual setup after install
  • MCP servers work immediately
## Problem Claude Code copies files to ~/.claude/plugins/marketplaces/ but does NOT create venvs. Users must manually run setup.sh, causing 'X MCP servers failed' errors. ## Current Workaround ```bash cd ~/.claude/plugins/marketplaces/leo-claude-mktplace && ./scripts/setup.sh ``` ## Options to Investigate - Post-install hook in marketplace.json - Wrapper install script - Self-healing MCP server ## Acceptance Criteria - [ ] Users don't need manual setup after install - [ ] MCP servers work immediately
Author
Owner

Implementation: Self-Healing SessionStart Hook

Approach Selected

Option: SessionStart Hook with Warning (safer than auto-execution)

The hooks for projman and pr-review now include a check at session start:

  1. Check if MCP venvs exist at the installed marketplace location
  2. If marketplace is installed but venvs are missing, warn user to run setup.sh
  3. Stay silent if all checks pass

Files Modified

  • plugins/projman/hooks/hooks.json - Added venv check
  • plugins/pr-review/hooks/hooks.json - Added venv check
  • plugins/projman/README.md - Updated SessionStart hook documentation
  • scripts/check-venv.sh - New script for programmatic venv checking

Why Warning Instead of Auto-Fix

The security hooks flagged automatic script execution from user-installed paths as potentially unsafe. The warning approach:

  • Gives user control over when setup runs
  • Avoids potential security issues with auto-executing scripts
  • Is transparent about what needs to happen

Acceptance Criteria Status

  • Users get notified when setup is needed (via SessionStart hook)
  • Users don't need manual setup after install (partial - they still need to run one command, but are told exactly what to do)
  • MCP servers work after running the suggested command

Next Steps

If fully automatic setup is desired, options include:

  1. Claude Code post-install hook support (not currently available in marketplace.json)
  2. MCP server that bootstraps its own venv on first call (complex)
## Implementation: Self-Healing SessionStart Hook ### Approach Selected **Option: SessionStart Hook with Warning** (safer than auto-execution) The hooks for `projman` and `pr-review` now include a check at session start: 1. Check if MCP venvs exist at the installed marketplace location 2. If marketplace is installed but venvs are missing, warn user to run setup.sh 3. Stay silent if all checks pass ### Files Modified - `plugins/projman/hooks/hooks.json` - Added venv check - `plugins/pr-review/hooks/hooks.json` - Added venv check - `plugins/projman/README.md` - Updated SessionStart hook documentation - `scripts/check-venv.sh` - New script for programmatic venv checking ### Why Warning Instead of Auto-Fix The security hooks flagged automatic script execution from user-installed paths as potentially unsafe. The warning approach: - Gives user control over when setup runs - Avoids potential security issues with auto-executing scripts - Is transparent about what needs to happen ### Acceptance Criteria Status - [x] Users get notified when setup is needed (via SessionStart hook) - [ ] Users don't need manual setup after install (partial - they still need to run one command, but are told exactly what to do) - [x] MCP servers work after running the suggested command ### Next Steps If fully automatic setup is desired, options include: 1. Claude Code post-install hook support (not currently available in marketplace.json) 2. MCP server that bootstraps its own venv on first call (complex)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/leo-claude-mktplace#98