Set up Python environment for worklog MCP server (cross-platform)
Sets up Python virtual environment for the worklog MCP server with intelligent cross-platform Python detection. Use this first to configure the MCP server before using worklog tools.
/plugin marketplace add gaurangrshah/gsc-plugins/plugin install appgen@gsc-pluginsSet up the Python virtual environment for the worklog MCP server with intelligent cross-platform detection.
Detects Python Environment - Checks for existing version managers in order:
Creates Virtual Environment - Isolated venv for MCP dependencies
Installs Dependencies - fastmcp, aiosqlite, and plugin code
Outputs Configuration - Shows .mcp.json settings to use
Execute the detection script to find suitable Python:
PLUGIN_DIR=$(dirname $(dirname $(realpath ~/.claude/plugins.json 2>/dev/null || echo ~/.claude)))/gsc-plugins/plugins/worklog
# Or use known paths
if [[ -d /volume2/dev-env/workspace/gsc-plugins ]]; then
PLUGIN_DIR="/volume2/dev-env/workspace/gsc-plugins/plugins/worklog"
elif [[ -d /Volumes/dev-env/workspace/gsc-plugins ]]; then
PLUGIN_DIR="/Volumes/dev-env/workspace/gsc-plugins/plugins/worklog"
elif [[ -d /mnt/nasdevenv/workspace/gsc-plugins ]]; then
PLUGIN_DIR="/mnt/nasdevenv/workspace/gsc-plugins/plugins/worklog"
elif [[ -d ~/workspace/gsc-plugins ]]; then
PLUGIN_DIR="$HOME/workspace/gsc-plugins/plugins/worklog"
fi
# Run detection
source "$PLUGIN_DIR/scripts/detect-python-env.sh"
Show the user the detection results:
Python Environment Detection
==============================
OS: {macos|linux}
{If PYTHON_OK == "yes":}
✓ Found suitable Python
Command: {PYTHON_CMD}
Version: {PYTHON_VERSION}
Source: {PYTHON_SOURCE}
{If PYTHON_OK == "no":}
✗ No suitable Python found
Required: Python >= 3.10
Recommendation:
{PYTHON_RECOMMENDATION}
If PYTHON_OK is "no", present the recommendation and ask:
"Python 3.10+ is required for the MCP server. Would you like me to help install it?"
Recommendation:
{PYTHON_RECOMMENDATION}Options:
- [A] Run the recommended command
- [B] I'll install Python myself, then re-run this command
- [C] Cancel setup
If user chooses A:
Execute the recommendation command. For example:
brew install python@3.12sudo apt-get install python3.12 python3.12-venvmise use python@3.12pyenv install 3.12 && pyenv global 3.12After installation, re-run detection to verify.
Once Python is available:
"$PLUGIN_DIR/scripts/setup-mcp-venv.sh"
This creates the venv at $PLUGIN_DIR/mcp/.venv and installs dependencies.
Read the Python path from the setup output and help configure .mcp.json:
VENV_PYTHON=$(cat "$PLUGIN_DIR/mcp/.python-path")
Determine the correct database path based on your setup:
| Setup | Database Path |
|---|---|
| Local (default) | ~/.claude/worklog/worklog.db |
| Shared (network mount) | /path/to/shared/worklog.db |
| PostgreSQL | Set via DATABASE_URL environment variable |
Create or update ~/.claude/.mcp.json:
{
"mcpServers": {
"worklog": {
"type": "stdio",
"command": "{VENV_PYTHON}",
"args": ["-m", "worklog_mcp"],
"env": {
"WORKLOG_DB": "{DB_PATH}"
}
}
}
}
Test the MCP server:
$VENV_PYTHON -m worklog_mcp --help
Or run a quick tool test:
$VENV_PYTHON -c "from worklog_mcp import server; print('MCP server loads OK')"
Inform the user:
"Setup complete! Restart Claude Code to load the MCP server."
After restart, verify with:
claude mcp listYou should see
worklogwith tools like:
- query_table
- search_knowledge
- store_memory
- log_entry
Python version too old:
venv creation fails:
~/.local/share/gsc-plugins-venvpip install fails:
pip install --upgrade pip firstDatabase not found: