Install
openclaw skills install static-serverStart a local HTTP server to preview static HTML pages. Use when testing static pages, previewing HTML files, or when browser tools cannot access file:// URLs. Provides localhost URL for browser testing.
openclaw skills install static-serverStart a Python HTTP server to preview static HTML files in a browser.
file:// protocolUse the bundled script to start a server:
python scripts/serve.py <path> [--port PORT]
Arguments:
<path>: File path (serves parent directory) or directory path--port: Optional port number (default: 8000)Examples:
# Serve a specific HTML file
python scripts/serve.py /path/to/index.html
# Serve a directory
python scripts/serve.py /path/to/project
# Use custom port
python scripts/serve.py /path/to/index.html --port 9000
The script prints:
http://localhost:PORT/filename.htmlWhen testing static pages with browser tools:
exec (background mode)Example workflow:
// 1. Start server in background
exec({
command: "python scripts/serve.py /path/to/index.html --port 8888",
background: true
})
// 2. Open in browser
browser({
action: "open",
targetUrl: "http://localhost:8888/index.html"
})
// 3. Test and screenshot
browser({ action: "screenshot", fullPage: true })
// 4. Clean up
process({ action: "kill", sessionId: "..." })
browser({ action: "close" })
For quick testing without the script:
python -m http.server 8000 --directory /path/to/dir
Note: This serves the directory root, not a specific file.