serve
$ serve Official Med RiskVercel's serve spins up a local HTTP server for static sites and single-page applications (serve -s dist -l 3000). Supports serve.json rewrites, CORS headers (--cors), and --no-clipboard / --no-port-switching flags for predictable local testing, while blocking as a foreground daemon.
npm install -g serve Binds local TCP ports to serve project build directories (dist/) over HTTP for browser checks; MCP servers do not manage local static web servers.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Accepts deterministic flags (--no-clipboard, --no-port-switching, -l) without prompts, but runs as a blocking foreground server with plain-text logs and no JSON mode.
- Non-interactive flags (
--no-clipboard,--no-port-switching,-l) - Foreground server process without structured JSON logging
Serves static files read-only without credentials, though bare serve binds all network interfaces and copies the URL to the clipboard unless restricted.
- Read-only file serving; default listen address exposes LAN unless
-l tcp://127.0.0.1:PORTis set
Cross-platform npm package (npm install -g serve or npx serve) requiring Node.js.
- Runs on macOS, Linux, and Windows via Node.js (
npm/npx)
Fast zero-config static and SPA preview server (-s rewrite) for browser and curl verification.
- Single-command SPA routing (
-s) andserve.jsonconfig support
Official Vercel repository (vercel/serve) under MIT license.
- Maintained under
vercel/serveon GitHub
Clear README, serve --help, and serve-handler configuration documentation.
- GitHub README and
serve --helpflag reference
Security, Auth & Guardrails
No authentication credentials required; optional routing, header, and rewrite rules live in serve.json.
Free, MIT-licensed open-source Node.js package.
# serve Agent Rules - Always bind explicitly to `-l tcp://127.0.0.1:<port>` instead of default `0.0.0.0` so local files are not exposed on the LAN. - Pass `--no-clipboard --no-port-switching` and terminate the background `serve` process when verification finishes.
Agent-Ready Command Recipes
Safe Read-Only Queries
serve --help && serve --version
Prints supported options (-s, -l, --cors, --no-clipboard) and installed version without binding any port.
Controlled Writes & Previews
serve -s dist -l tcp://127.0.0.1:3000 --no-clipboard --no-port-switching
Starts an SPA static server bound strictly to 127.0.0.1:3000 without modifying the clipboard or silently picking another port.
Strengths for Agents
- + One-command SPA fallback (
-s) andserve.jsonrouting with zero boilerplate. - +
--no-clipboardand--no-port-switchingprevent surprising side effects in automated runs.
Caveats & Pitfalls
- ! Blocks indefinitely as a foreground daemon and emits human-oriented text banners instead of JSON.
- ! Default bind exposes the served directory on LAN interfaces unless
127.0.0.1is specified via-l.