CLI Reference
Usage
mekong [flags] <port>
mekong -p <port> [flags]
mekong login
mekong logout
mekong whoami
mekong ps
mekong status [name|port]
mekong logs [-f] [name|port]
mekong stop <port>
mekong stop --all
mekong deploy <path>
mekong deploy list
mekong deploy stop <subdomain>
mekong rm
mekong rm -f [name]
mekong subdomain [list|add|delete] [name]
mekong domain <add|connect|verify|wait|target|delete> ...
mekong completion [zsh|bash]
mekong detect [--json]
mekong init [--port N] [--start CMD] [--upstream-host HOST]
mekong doctor [domain]
mekong update
mekong versionThe local port can be given as a positional argument or via -p / --port. A token for reserved subdomains is loaded automatically from ~/.mekong/config.json after mekong login, or can be supplied via --token / MEKONG_TOKEN.
mekong 3000 # anonymous — random subdomain
mekong login && mekong 3000 # login once → reserved subdomain every time
mekong --token mkt_xxx 3000 # one-shot token overrideCommands
Tunnel
| Command | Description |
|---|---|
mekong <port> | Expose localhost:<port> — auto-uses saved token |
mekong -d <port> | Run tunnel in background / daemon mode |
mekong <port1> <port2> | Expose multiple ports simultaneously |
Auth
| Command | Description |
|---|---|
mekong login | Authenticate via browser — saves token to ~/.mekong/config.json |
mekong logout | Remove saved credentials |
mekong whoami | Show currently logged-in account and token prefix |
Management
| Command | Description |
|---|---|
mekong ps | Table view of all active daemon tunnels (like docker ps) |
mekong status | Detailed view of all active tunnels |
mekong status [name|port] | Show tunnel for a specific subdomain name or local port |
mekong logs | Print daemon logs for all tunnels |
mekong logs -f | Follow daemon logs live |
mekong logs [name|port] | Print daemon logs filtered by subdomain name or local port |
mekong logs -f [name|port] | Follow daemon logs live for one tunnel |
mekong rm | Clear logs for random tunnels (reserved tunnels protected) |
mekong rm -f | Force-clear all logs |
mekong rm -f <name> | Clear logs for one specific named reserved tunnel |
mekong stop <port> | Stop one running background tunnel |
mekong stop --all | Stop all running background tunnels |
mekong update | Auto-update to the latest release |
mekong version | Show installed version |
mekong completion [zsh|bash] | Print shell tab-completion script |
Subdomains
| Command | Description |
|---|---|
mekong subdomain | List reserved subdomains (alias: mekong sd) |
mekong subdomain <name> | Reserve a new subdomain |
mekong subdomain delete <name> | Delete with confirmation prompt |
mekong subdomain delete <name> --yes | Delete without confirmation (for scripts/CI) |
Custom Domains
| Command | Description |
|---|---|
mekong domain | List custom domains (alias: mekong dm) |
mekong domain add <d> | Add a custom domain |
mekong domain connect <d> <sub> | Add + verify + target in one step |
mekong domain verify <d> | Run a DNS/HTTPS verification check |
mekong domain wait <d> | Poll until DNS and HTTPS are ready |
mekong domain target <d> <sub> | Point domain to a reserved subdomain |
mekong domain delete <d> | Delete with confirmation prompt |
mekong domain delete <d> --yes | Delete without confirmation |
mekong doctor <d> | Check custom-domain DNS and HTTPS |
Project
| Command | Description |
|---|---|
mekong detect | Detect local stack and port |
mekong detect --json | Output detection data as JSON for scripting |
mekong init | Write .mekong.json for this project |
mekong doctor | Check connectivity, auth, and config |
Deployments
| Command | Description |
|---|---|
mekong deploy <path> | Package a directory as zip and upload it to hosted deployments |
mekong deploy | List your current deployments |
mekong deploy list | List your current deployments |
mekong deploy stop <subdomain> | Stop one hosted deployment |
Flags
| Flag | Default | Description |
|---|---|---|
-p, --port <n> | (positional) | Local port to expose |
--token <tok> | (saved login / env) | API token for reserved subdomain |
-d | false | Run tunnel in background daemon mode |
-e, --expire <duration> | 24h (anonymous) / 1w (reserved) | Requested tunnel lifetime |
-sd, --subdomain <name> | (none) | Use a reserved subdomain |
--skip-browser-warning / --no-warning | false | Skip phishing-warning interstitial for all visitors |
--upstream-host <host> | (none) | Override Host header for vhost apps (Laragon/XAMPP/WAMP) |
--no-qr | false | Disable QR code display |
--no-clipboard | false | Disable auto clipboard copy |
--no-reconnect | false | Exit on disconnect instead of reconnecting |
Token resolution order
--tokenflagMEKONG_TOKENenvironment variable~/.mekong/config.json(written bymekong login)- (none — anonymous mode, random subdomain)
Expiry values
The -e / --expire flag accepts months, weeks, days, hours, or minutes:
| Input | Meaning |
|---|---|
1m or 1mo | 1 month (30 days) |
1w | 1 week (7 days) |
2w | 2 weeks |
1d | 1 day |
7d | 7 days |
48h | 48 hours |
48 | bare number = hours |
30m | 30 minutes (Go duration fallback) |
When expiry is set, the tunnel banner shows the expiry time and mekong ps / mekong status reflect it. Idle timeout follows the requested expiry.
Reserved Subdomain Lifetime Rules
When using -sd / --subdomain, different limits apply:
| Anonymous tunnel | Reserved subdomain tunnel | |
|---|---|---|
| Default lifetime | 24 hours | 1 week |
| Maximum lifetime | 1 week | 1 month |
# Defaults to 1 week (no -e needed)
mekong 3001 -d -sd onlyanime
# Explicit 2 weeks
mekong 3001 -d -sd onlyanime -e 2w
# Maximum: 1 month
mekong 3001 -d -sd onlyanime -e 1m
# Error — exceeds 1 month limit
mekong 3001 -d -sd onlyanime -e 2m
# error: requested expiry 2mo exceeds max 1mo
# note: reserved subdomains allow up to 1moExamples
# Anonymous — gets a random subdomain every time
mekong 3000
# Login once, then always use reserved subdomain
mekong login
mekong 3000 # → https://myapp.proxy.mekongtunnel.dev
# One-shot token without logging in
mekong --token mkt_xxxxxxxxxxxx 3000
# Via environment variable (great for CI/CD)
MEKONG_TOKEN=mkt_xxx mekong 3000
# Use a reserved subdomain with shorthand flag
mekong 3001 -sd onlyanime
mekong 3001 -d -sd onlyanime -e 1w
# Skip browser warning page for visitors
mekong 3001 --no-warning
mekong 3001 -d -sd onlyanime --no-warning
# Auth management
mekong whoami # show logged-in account
mekong logout # remove saved credentials
# Daemon mode
mekong -d 3000 -e 1w
mekong ps # table view of all tunnels
mekong logs onlyanime # logs by name
mekong logs -f onlyanime # follow logs by name
mekong logs 3000 # logs by port (still works)
mekong status onlyanime # status by name
mekong stop 3000
# Log management
mekong rm # clear random tunnels; reserved are protected
mekong rm -f # force-clear all logs
mekong rm -f onlyanime # clear logs for one named tunnel
# Hosted deployments
mekong deploy ./dist
mekong deploy list
mekong deploy stop my-site
# Multiple ports
mekong 3000 8080
# Self-update
mekong update
mekong versionmekong ps
Lists all active daemon tunnels in a Docker-style table. Only shows tunnels started with -d.
mekong psTUNNEL ID URL PORT STATUS CREATED EXPIRE
onlyanime https://onlyanime.proxy.mekongtunnel.dev :3001 Up 5h 5 hours ago 18h left
topupml https://topupml.proxy.mekongtunnel.dev :3000 Up 2h 2 hours ago 6d leftStale state files from dead processes are automatically cleaned up when mekong ps runs.
mekong rm
Clears daemon log entries from ~/.mekong/mekong.log. Does not stop tunnels — use mekong stop for that.
| Command | What it does |
|---|---|
mekong rm | Clears logs for random tunnels; reserved tunnels are protected |
mekong rm -f | Force-clears all logs |
mekong rm -rf | Same as -f |
mekong rm -f <name> | Clears logs for one specific reserved tunnel |
# Safe clear (reserved tunnels shown as warning)
mekong rm
# Force clear everything
mekong rm -f
# Clear only the onlyanime tunnel's logs
mekong rm -f onlyanimemekong completion
Installs shell tab-completion so you can press Tab to autocomplete commands and tunnel names.
# Zsh (macOS default)
mekong completion zsh >> ~/.zshrc && source ~/.zshrc
# Bash
mekong completion bash >> ~/.bashrc && source ~/.bashrc
# Activate in current session only (no file change)
eval "$(mekong completion zsh)"What gets autocompleted:
| Typing | Tab suggests |
|---|---|
mekong <Tab> | All commands |
mekong logs <Tab> | Active tunnel names |
mekong stop <Tab> | Active tunnel names |
mekong rm <Tab> | Active tunnel names |
mekong subdomain delete <Tab> | Your reserved subdomains (API) |
mekong help <Tab> | Available help topics |
Tunnel name completion reads local state instantly (no network). Subdomain completion calls the API and requires login.
mekong login
Opens the MekongTunnel auth page in your browser. After you approve, the CLI saves your token to ~/.mekong/config.json.
mekong login Open this URL to log in:
https://mekongtunnel.dev/cli-auth?session=xxxxxxxx
Waiting for authorization.....
✔ Logged in as you@example.com
Your tunnels will now use your reserved subdomain.
Run: mekong 3000mekong logout
Removes ~/.mekong/config.json. Subsequent tunnel runs revert to anonymous mode (random subdomains).
mekong logout
# ✔ Logged out (was: you@example.com)mekong whoami
Shows your current account, plan, and the first few characters of your token.
mekong whoami ─────────────────────────────────────────
Name Ing Muyleang
Email you@example.com
Plan pro
Token mkt_xxxxxxxx****
─────────────────────────────────────────Daemon Mode
mekong -d 3000 -e 1w✔ mekong running in background
PID 48291 [:3000]
Logs ~/.mekong/mekong.log
View mekong logs 3000
Follow mekong logs -f 3000
Stop mekong stop 3000
StopAll mekong stop --all
Status mekong status- Terminal is freed immediately
- All output goes to
~/.mekong/mekong.log - State is saved to
~/.mekong/tunnels/(readable only by your user) - QR and clipboard are disabled automatically in daemon mode
- Token is passed through — your reserved subdomain works in daemon mode too
Shortcuts & Aliases
| Alias | Expands to |
|---|---|
mekong sd | mekong subdomain |
mekong dm | mekong domain |
-sd | --subdomain |
Prefix command matching — any unique prefix resolves automatically:
| You type | Resolves to |
|---|---|
mekong dom | mekong domain |
mekong sub | mekong subdomain |
mekong log | mekong logs |
mekong upd | mekong update |
mekong who | mekong whoami |
mekong det | mekong detect |
mekong doc | mekong doctor |
mekong st | (ambiguous: status, stop) — shows error |
Smart Error Handling
When you type an unknown command, the CLI suggests the closest match using edit-distance (Levenshtein) matching. Any typo within 2 character edits triggers a suggestion.
$ mekong statsu
error: unknown command "statsu"
Did you mean: mekong status
$ mekong logz
error: unknown command "logz"
Did you mean: mekong logsStatus
mekong status
mekong status onlyanime # filter by name
mekong status 3000 # filter by port ─────────────────────────────────────────────────────
Active tunnels
─────────────────────────────────────────────────────
URL https://onlyanime.proxy.mekongtunnel.dev
Local localhost:3001
PID 48291
Uptime 5h12m3s
Expires 2026-04-11 10:04:00 UTC
─────────────────────────────────────────────────────Auto-reconnect
The CLI reconnects automatically with exponential backoff (2 s → 4 s → … up to 60 s). If your IP is blocked, it stops immediately to avoid worsening the block.
Disable with --no-reconnect.
PHP / Laravel / Laragon / XAMPP / WAMP
For local virtual-host stacks, set --upstream-host so the app receives the Host header it expects:
# Laravel built-in server
php artisan serve --host=127.0.0.1 --port=8000
mekong 8000
# Apache vhost (Laragon, XAMPP, WAMP)
mekong 80 --upstream-host myapp.test
mekong init --port 80 --upstream-host myapp.test
# WordPress
mekong 80 --upstream-host wordpress.testProject Config (.mekong.json)
Run mekong init in your project directory to auto-detect your stack and write .mekong.json. After that, plain mekong with no arguments uses the saved port.
mekong init # auto-detect stack + port
mekong init --port 8080 # override port
mekong init --port 80 --upstream-host myapp.test
mekong detect --json # inspect detection outputSupported fields: port, upstream_host, start, stack.
Raw SSH
Use ssh directly if you prefer not to install the binary:
# Anonymous
ssh -t -R 80:localhost:3000 proxy.mekongtunnel.dev
# With token (reserved subdomain)
ssh -o SetEnv="MEKONG_API_TOKEN=mkt_xxxxxxxxxxxx" \
-t -R 80:localhost:3000 proxy.mekongtunnel.dev
# With expiry
ssh -o SetEnv=MEKONG_EXPIRE=48h -t -R 80:localhost:3000 proxy.mekongtunnel.dev
# Both at once
ssh -o SendEnv="MEKONG_API_TOKEN MEKONG_EXPIRE" \
-o SetEnv="MEKONG_API_TOKEN=mkt_xxx MEKONG_EXPIRE=48h" \
-t -R 80:localhost:3000 proxy.mekongtunnel.devThe
-tflag is required. Without it the server cannot display the URL.
Quick Reference Card
TUNNEL MANAGEMENT
mekong ps Table view of active tunnels
mekong status [name|port] Detailed view of active tunnels
mekong stop [port] [--all] Stop background tunnel(s)
mekong logs [-f] [name|port] Show or follow daemon logs
mekong rm Clear logs (reserved tunnels protected)
mekong rm -f Force-clear all logs
mekong rm -f <name> Clear logs for one named tunnel
STARTING TUNNELS
mekong <port> Expose local port (random URL)
mekong <port> -d Run in background
mekong <port> -d -sd <name> Use reserved subdomain (default 1w)
mekong <port> -d -sd <name> -e 1m Reserve for up to 1 month
mekong <port> --no-warning Skip browser warning page for visitors
SUBDOMAINS
mekong sd List reserved subdomains
mekong subdomain <name> Reserve a new subdomain
mekong subdomain delete <name> Delete (asks to confirm)
mekong subdomain delete <name> --yes Delete without confirmation
CUSTOM DOMAINS
mekong dm List custom domains
mekong domain add <d> Add a custom domain
mekong domain connect <d> <sub> Add + verify + target in one step
mekong domain delete <d> --yes Delete without confirmation
SHELL COMPLETION
mekong completion zsh >> ~/.zshrc && source ~/.zshrc Install (zsh)
mekong completion bash >> ~/.bashrc && source ~/.bashrc Install (bash)
eval "$(mekong completion zsh)" Activate in current session only
AUTH
mekong login Sign in
mekong logout Sign out
mekong whoami Show current account
ALIASES & SHORTCUTS
sd → subdomain dm → domain
mekong dom → domain mekong sub → subdomain
mekong log → logs mekong doc → doctor
-sd → --subdomain -e → --expire
-p → --port -d → daemon mode
-v → --version