Skip to main content

Local HTTP Server Manager

Project description

๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ ยท ๐Ÿ‡ฌ๐Ÿ‡ง English

http-server-cli

Forget ports. Just preview.

Based on python3 -m http.server, zero external dependencies. Just hs . -o to preview your project.

  • Zero External Dependencies โ€” Only requires macOS (lsof/open) and Python 3.7+ (pip install http-server-cli)
  • Auto Port Allocation + Preview โ€” Default 8080, auto-increment on conflict (hs . -o)
  • Smart Homepage โ€” Auto-redirect to most recently modified HTML file when no index.html
  • Custom Index Page โ€” Specify default HTML file with -i/--index
  • Project Tracking โ€” Persistent project path โ†” port mapping (hs list)
  • Process Resource Monitoring โ€” Real-time CPU, memory usage and runtime (hs list)
  • Multiple Launch Modes โ€” Daemon background or foreground (-d daemon / -f foreground)
  • JSON Output โ€” All commands support --json for API/MCP consumption
  • Web Dashboard โ€” hs dashboard -o GUI management for HTTP services
  • MCP Server โ€” hs mcp AI Agent integration (SSE/stdio, 6 tools)
  • Managed Registry โ€” Infrastructure services isolated from user services

Why hs

When developing multiple frontend projects, you constantly switch between "Which port did A use?" and "Who's occupying 8080?".

hs closes the loop: Start โ†’ Track โ†’ List โ†’ Kill โ€” auto-find free ports, remember which project uses which port, view and close anytime.

Comparison

Scenario Before With hs
Start server python3 -m http.server 8080 + manually open browser hs . -o โ€” auto-find free port, open browser
View servers lsof -i :8080, then ps to see path hs list
Switch projects Kill old one, start new (or conflict) hs ../project-b
Kill server lsof to find PID โ†’ kill hs kill 8080

Installation

pip install http-server-cli

# Upgrade to latest version
pip install --upgrade http-server-cli

Verify:

hs version     # โ†’ http-server-cli v1.0.x
hs . -o        # Start in current directory + open browser

Usage

Daily Workflow

# 1. Preview your project
cd ~/project-alpha
hs . -o                     # Auto-find free port, open browser

# 2. Check running servers
hs list
# โœ…  http://localhost:8080   โ†’  ~/project-alpha
# โœ…  http://localhost:8081   โ†’  ~/project-beta  (daemon)

# 3. Kill unwanted servers
hs kill 8080                # By port
hs kill ~/project-alpha     # By path
hs kill-all                 # Kill all

All Commands

Command Description
hs . [-o] [-d] [-f] Shortcut, equivalent to hs start .
hs start [path] [-o] [-d] [-f] [-i <file>] Start server (path defaults to .; -o open browser; -d daemon; -f foreground; -i custom index)
hs list List all running servers
hs list --json JSON format list
hs status [port|path] Query single server status
hs status --json [port|path] JSON format status
hs kill <port|path> Kill specified server
hs dashboard [-p PORT] [-o] [--json] Web dashboard (default port 8180)
hs dashboard stop|status|restart|help Dashboard management subcommands
hs mcp [--transport stdio|sse] [--port PORT] MCP Server for AI Agent integration
hs mcp stop|status|restart|help MCP management subcommands
hs kill-all Kill all servers
hs config Show configuration
hs config --json JSON format configuration
hs set port <num> Set default port (default 8080)
hs set domain <str> Set bind domain (default localhost)

Tips

  • hs . -o = hs start . -o, faster to type
  • hs . -d: daemon mode, runs in background, check with hs list
  • hs . -f: foreground mode, Ctrl+C to stop
  • hs without args = hs start . (start in current directory)
  • hs . -i app.html: use app.html as the index page

Data Directory

~/.http-server-cli/
โ”œโ”€โ”€ config.json            # Default port/domain configuration
โ”œโ”€โ”€ registry.json          # port โ†’ {path, pid, domain, daemon, foreground, started_at}
โ”œโ”€โ”€ registry-managed.json  # Infrastructure services (dashboard, MCP SSE)
โ””โ”€โ”€ logs/{port}.log        # http.server logs

Platform Requirements

Currently only supports macOS (requires lsof command). Linux/Windows support in development.

Local Development

git clone git@github.com:imjaden/http-server-cli.git
cd http-server-cli
pip install -e .
python3 -m pytest tests/

Is This Reinventing the Wheel?

Tool Start Server Auto Port Track Projectโ†”Port List All Kill by Name Open Browser
python3 -m http.server โœ… โŒ โŒ โŒ โŒ โŒ
http-server (npm) โœ… โŒ โŒ โŒ โŒ โœ…
serve (npm) โœ… โŒ โŒ โŒ โŒ โœ…
live-server โœ… โœ… โŒ โŒ โŒ โœ…
portless (npm) โœ… โœ… โŒ โŒ โŒ โœ…
kill-port-cli (npm) โŒ โŒ โŒ โœ… โœ… โŒ
lsof / netstat โŒ โŒ โŒ Manual Manual โŒ
http-server-cli โœ… โœ… โœ… โœ… โœ… โœ…

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

http_server_cli-1.0.7.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

http_server_cli-1.0.7-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file http_server_cli-1.0.7.tar.gz.

File metadata

  • Download URL: http_server_cli-1.0.7.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for http_server_cli-1.0.7.tar.gz
Algorithm Hash digest
SHA256 c14d9f3e03f263ee2ed834658f3f4cd15f8a14bb09a6dbbeeb0776a2b08f1f55
MD5 d95766aa5b39d49a424a8d29e275b175
BLAKE2b-256 dee31959f28ac22bced105d2e669e90f906bf2bf092eb9ab4aa39e29174a5ec8

See more details on using hashes here.

File details

Details for the file http_server_cli-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for http_server_cli-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d04113406ca8bf3b59d9aa57b8c364ba8441250ccf20572c24a72985e2e8a5bf
MD5 f7b8912aaa1552e75401a2d20f699979
BLAKE2b-256 38b5aa6e73e19172fe6638b1cd1519f2e950702bedd96fc60f3251baa2032b72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page