Subagent definitions for automating ngrok setup on Linux/WSL2. The MCP server needs ngrok to expose localhost:8000 publicly for Claude Desktop and remote clients.
Checks whether ngrok is installed and reports its path and version. Read-only — no side effects.
- Run
which ngrokto find the binary path - If found, run
ngrok versionto get the version string - Report: installed (yes/no), path, version
- If not found, report that ngrok is not installed and suggest running the
ngrok-installagent
- Bash (read-only commands only:
which,ngrok version)
Installs ngrok via the official apt repository. Falls back to direct download if apt fails (e.g., missing sudo permissions).
- First run the
ngrok-detectagent logic — skip install if already present - Primary method (apt repo):
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list sudo apt-get update && sudo apt-get install -y ngrok
- Fallback (direct download): If apt fails, download the binary directly:
curl -sSL https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz | tar xz -C /usr/local/bin - Verify installation with
ngrok version - Do NOT use snap — it is unreliable on WSL2
- Bash
Verifies that ngrok is properly configured: correct version, valid config file, and authtoken status. Never displays or stores the authtoken value.
- Run
ngrok version— confirm v3+ - Run
ngrok config check— report whether the config file is valid - Check if an authtoken is configured: inspect the config YAML at
~/.config/ngrok/ngrok.yml(or~/.ngrok2/ngrok.ymlfor older setups). Report only whether a token is present (yes/no) — never print the token value - If no authtoken is found, instruct the user to run
ngrok config add-authtoken <TOKEN>with their token from https://dashboard.ngrok.com/get-started/your-authtoken - Summarize: version, config status, authtoken configured (yes/no)
- Bash (
ngrok version,ngrok config check) - Read (config YAML — redact any token values in output)
Starts an ngrok tunnel on port 8000, verifies connectivity via the local API, then tears it down.
- Confirm port 8000 is not already in use:
lsof -i :8000 - Start ngrok in the background:
ngrok http 8000 & - Wait briefly (2-3 seconds) for the tunnel to establish
- Query the local ngrok API to get the public URL:
curl -s http://localhost:4040/api/tunnels | python3 -m json.tool - Report the public HTTPS URL
- Clean up: Kill the background ngrok process (
kill %1orpkill -f 'ngrok http 8000') - Confirm the process is terminated
- Bash
Runs the full ngrok setup pipeline: detect → install → validate → test. Stops on failure and reports remediation steps.
- Detect: Run
ngrok-detectlogic. If ngrok is found, skip to step 3 - Install: Run
ngrok-installlogic. If installation fails, stop and report the error with remediation steps - Validate: Run
ngrok-validatelogic. If authtoken is missing, stop and ask the user to configure it before proceeding - Test tunnel: Run
ngrok-test-tunnellogic. Report the public URL on success - Summary: Print a final status table:
Step Status Detection OK / Not found Installation OK / Skipped / Failed Validation OK / Needs authtoken Tunnel test OK / Failed
If any step fails, stop immediately and provide clear remediation instructions. Do not continue to subsequent steps.
- Agent (invokes the four agents above in sequence)
- Bash (for any direct verification)