This guide covers automatic installation and setup of mcp-tasks in Claude Code web sessions.
Claude Code web sessions provide a browser-based development environment where local binaries cannot be pre-installed. The web-session-start script automates installation during session initialization, ensuring mcp-tasks is available immediately.
Claude Code web sessions provide two key environment variables:
CLAUDE_CODE_REMOTE: Set to "true" in web sessions, absent or different value in desktop sessionsCLAUDE_ENV_FILE: Path to a file where environment variables should be written for persistence across sessionsThe web-session-start script uses these variables to:
The recommended setup uses a SessionStart hook to install mcp-tasks automatically when a web session begins.
.claude/settings.json:{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "./scripts/web-session-start"
}
]
}
]
}
}
chmod +x scripts/web-session-start
git add .claude/settings.json
git commit -m "feat: add automatic installation for Claude Code web sessions"
When a Claude Code web session starts:
scripts/web-session-startCLAUDE_CODE_REMOTE environment variableCLAUDE_CODE_REMOTE="true"):
~/.local/bin directory if neededmcp-tasks and mcp-tasks-server)~/.local/bin to PATH in CLAUDE_ENV_FILE (if not already present)Note: MCP server registration is currently disabled as Claude Code web does not yet support MCP servers.
The script is safe to run multiple times:
~/.local/bin if not already present in CLAUDE_ENV_FILEIf you prefer manual installation or need to troubleshoot:
# 1. Set environment variables (web sessions set these automatically)
export CLAUDE_CODE_REMOTE=true
export CLAUDE_ENV_FILE=~/.env
# 2. Run the installation script
./scripts/web-session-start
The web session installer supports the same platforms as binary installation:
Windows users in Claude Code web sessions should use the Clojure git dependency installation method instead (see install.md).
The scripts/web-session-start script performs these steps:
# 1. Check CLAUDE_CODE_REMOTE
if [ "$CLAUDE_CODE_REMOTE" != "true" ]; then
exit 0 # Silent exit if not in web session
fi
# 2. Create installation directory
mkdir -p ~/.local/bin
# 3. Download and install binaries
# - Detects platform (linux-amd64 or macos-universal)
# - Downloads from GitHub releases (latest)
# - Makes binaries executable
# 4. Update PATH in CLAUDE_ENV_FILE
# - Checks if ~/.local/bin already in PATH
# - Appends if not present: export PATH="$PATH:~/.local/bin"
# 5. Install Claude Code slash commands
mcp-tasks prompts install
# - Copies prompt files as slash commands to .claude/commands/
# - Non-fatal if installation fails
Note: MCP server registration (previously step 6) is currently disabled because Claude Code web does not yet support MCP servers.
Symptom: The script runs but performs no installation.
Cause: CLAUDE_CODE_REMOTE is not set to "true".
Solution:
echo $CLAUDE_CODE_REMOTESymptom: Error message: "Failed to download ... from https://github.com/..."
Causes:
curl or wgetSolutions:
curl -I https://github.comuname -s and uname -mcurl or wget if missingSymptom: Binaries installed but not available after session restart.
Cause: CLAUDE_ENV_FILE not set or PATH not written to file.
Solution:
CLAUDE_ENV_FILE is set: echo $CLAUDE_ENV_FILEcat "$CLAUDE_ENV_FILE"export PATH="$PATH:~/.local/bin"Note: MCP server registration is currently disabled in the web-session-start script because Claude Code web does not yet support MCP servers. This functionality may be enabled in a future release when support becomes available.
Symptom: Error message: "Unsupported operating system: ..." or "Unsupported platform: ..."
Cause: Running on Windows or unsupported architecture.
Solution: Use Clojure git dependency installation instead (see install.md).
You can test the installation script locally by simulating a web session environment:
# Create test environment
TEST_HOME=/tmp/mcp-tasks-test
mkdir -p "$TEST_HOME"
# Simulate web session environment and run installer
HOME="$TEST_HOME" \
CLAUDE_CODE_REMOTE=true \
CLAUDE_ENV_FILE="$TEST_HOME/.env" \
./scripts/web-session-start
# Verify installation
echo ""
echo "=== Verification ==="
ls -lh "$TEST_HOME/.local/bin"
cat "$TEST_HOME/.env"
# Cleanup
rm -rf "$TEST_HOME"
Verify the script exits silently when not in a web session:
# Should exit 0 without output
CLAUDE_CODE_REMOTE=false ./scripts/web-session-start
echo "Exit code: $?" # Should print: Exit code: 0
Verify the script can be run multiple times safely:
# Setup test environment
TEST_HOME=/tmp/mcp-tasks-test
mkdir -p "$TEST_HOME"
# Run installer twice
for i in 1 2; do
echo "=== Run $i ==="
HOME="$TEST_HOME" \
CLAUDE_CODE_REMOTE=true \
CLAUDE_ENV_FILE="$TEST_HOME/.env" \
./scripts/web-session-start
echo ""
done
# Verify PATH appears only once
echo "=== PATH entries in $TEST_HOME/.env ==="
grep -c "\.local/bin" "$TEST_HOME/.env" # Should print: 1
# Cleanup
rm -rf "$TEST_HOME"
The script follows these error handling principles:
>&2 redirectionset -e)~/.local/bin and CLAUDE_ENV_FILEsudo requiredCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |