Skip to main content

🇨🇳 · 🇬🇧

http-server

GitHub GitHub · PyPI PyPI

Forget ports. Just preview.

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

hs is an independent tool — unrelated to the npm package "http-server".

  • Zero External Dependencies — Python 3.7+, macOS/Linux/Windows (pip install http-server-cli)
  • Auto Port + Smart Index — Default 8080, auto-increment on conflict; auto-open most-recent HTML when no index.html; specify with -i (hs -o)
  • Project Management — Track port↔path mapping, monitor CPU/memory, JSON output (hs list)
  • Multiple Launch Modes — Daemon or foreground (-d/-f)
  • Web Dashboard — hs dashboard -o GUI (CN/EN toggle, 60s countdown, Kill All, error handler)
  • AI Agent Integration — hs mcp MCP Server (SSE/stdio, 6 tools), managed infrastructure isolation

Why hs

Multiple frontend projects → constant context switching: "Which port is A on?" "Who's occupying 8080?".

hs closes the loop: Start → Track → List → Kill.

Comparison

Scenario Before With hs
Start server python3 -m http.server 8080 + open browser manually hs -o — auto-find free port, open browser
View servers lsof -i :8080, then ps hs list
Switch projects Kill old, start new (or conflict) hs ../project-b
Kill server lsof → kill <pid> hs kill 8080

Installation

pip install http-server-cli
# or: pip install --upgrade http-server-cli

Verify:

hs version     # → http-server v1.0.x
hs -o        # Start in current directory + open browser

Usage

Daily Workflow

# 1. Preview your project
cd ~/project-alpha
hs -o                     # Auto 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

Start

Command Description
hs . [-o] [-d] [-f] Current directory, auto-find free port
hs /path [-o] [-d] [-f] Specify directory
hs . -i app.html [-o] Custom index file
hs . -i './snapshots/*.html' [-o] Glob → most recently modified file
hs /path/to/file.html [-o] HTML file path → auto-extract directory + set index
hs /path/snapshots/*.html [-o] Path glob → most recent file
hs start [path] [-o] [-d] [-f] [-i <file>] Full form of hs .

View

Command Description
hs list List running servers (alive only)
hs list --port Ports only
hs list --path Paths only
hs list --short port:path format
hs list --json JSON output
hs search <keyword> [--json] Search by port or path
hs status <port|path> [--json] Single server status (CPU/memory/log)

Kill

Command Description
hs kill 8080 By port
hs kill ~/project By path
hs kill /path/to/file.html HTML file → auto-resolve to parent dir
hs kill /path/*.html Glob → most recent file
hs kill-all Kill all user services
hs kill-all --json JSON output

Bookmark

Command Description
hs bookmark add <name> [path] [-i index] [--force] Register a bookmark (path defaults to current directory)
hs bookmark update <name> [path] [-i index] Update bookmark path or index page
hs bookmark list List all bookmarks
hs bookmark show <name> Show bookmark details
hs bookmark remove <name> Remove a bookmark
hs <name> [-o] Start server from a bookmark
hs kill <name> Kill service by bookmark name

Dashboard

Command Description
hs dashboard [-p PORT] [-o] [--json] Web dashboard (default 8180)
hs dashboard stop|status|restart|help Subcommands

Managed services (dashboard, MCP SSE) are tracked in registry-managed.json; hs kill-all does NOT stop them.

MCP (AI Agent)

Command Description
hs mcp [--transport stdio|sse] [--port PORT] MCP Server for AI Agent
hs mcp stop|status|restart|help Subcommands

History & Config

Command Description
hs history [--json] Server start/stop history (excludes temp dirs)
hs config [--json] Show configuration
hs set port|domain <value> Change configuration
hs version [--json] Show version
hs help Show help

Tips

  • 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, started_at, index_page}
├── registry-managed.json  # Infrastructure services (dashboard, MCP SSE)
└── logs/{port}.log        # http.server logs

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 ✅ ✅ ✅ ✅ ✅ ✅

Metadata

Release files for http-server-cli 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for http-server-cli 1.1.0
File Size Uploaded Provenance
http_server_cli-1.1.0.tar.gz 90.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for http-server-cli 1.1.0
File Interpreter ABI Platform
http_server_cli-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 153.4 kB

Release files / http_server_cli-1.1.0.tar.gz

Download URL http_server_cli-1.1.0.tar.gz
Size 90.3 kB
Tags Source
SHA-256 checksum
How to use checksums
65bc393f76025647c06f9efef7e1f6d62a1c3fe5c5174530eb7d9dd46d3830c6
BLAKE2b-256 checksum
How to use checksums
c815ea1a98e4511f2a17376bf4e84763ec7ec92786040f64fc296a35cec4d133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / http_server_cli-1.1.0-py3-none-any.whl

Download URL http_server_cli-1.1.0-py3-none-any.whl
Size 63.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0a06638b8b3909a41074918454a139b6afd212d097d20a32c507667093dcdcd
BLAKE2b-256 checksum
How to use checksums
ec7b7956bd08f82aeb01c1af98ef88f1204904d6102c902f949cfae2081b9790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for http-server-cli 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page