首页龙虾技能列表 › Static Server — 技能工具

Static Server — 技能工具

v1.0.0

[自动翻译] Start a local HTTP server to preview static HTML pages. Use when testing static pages, previewing HTML files, or when browser tools cannot access file...

0· 363·2 当前·2 累计
by @liujintao-2021·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/9
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
high confidence
The skill does what it says (serves static files) and has no credentials or installs, but its code binds to all network interfaces despite claiming a localhost-only preview—this mismatch could unintentionally expose files on the network.
评估建议
This skill is functionally coherent and contains no credential or install requirements, but take these precautions before using it: - Network exposure: the script binds to all interfaces (0.0.0.0) even though it advertises 'localhost'. If you only want local access, modify the bind to 127.0.0.1 (e.g., socketserver.TCPServer(('127.0.0.1', port), Handler)) or use an equivalent API that allows binding to localhost. - Do not serve directories containing secrets (SSH keys, config files, .env files). ...
详细分析 ▾
用途与能力
Name, description, SKILL.md, and the included scripts all align: the skill is a small Python static-file server for previewing HTML. However, the code binds to all interfaces (socketserver.TCPServer(('', port))) while the description repeatedly refers to 'localhost' URLs; this is a notable mismatch between the claimed 'local-only' purpose and the actual network binding.
指令范围
Instructions are limited to starting the server, opening a browser, and killing the process—appropriate for the stated purpose. Concern: the examples assume local-only access (http://localhost:PORT) but the server listens on all interfaces, which may expose served files to other hosts on the network. Also the alternative one-liner (python -m http.server) similarly defaults to listening on all interfaces in many environments.
安装机制
No install spec; this is an instruction-only skill with a small included Python script. Nothing is written to disk by an installer and no external downloads are performed.
凭证需求
No environment variables, credentials, or config paths are requested; the skill's requirements are minimal and proportionate to a local static server.
持久化与权限
The skill is user-invocable, not always-enabled, and does not request persistent system privileges or modify other skills. Autonomous invocation is allowed by default but is not combined with other concerning privileges.
安装前注意事项
  1. even though it advertises 'localhost'. If you only want local access, modify the bind to 127.0.0.1 (e.g., socketserver.TCPServer(('127.0.0.1', port), Handler)) or use an equivalent API that allows binding to localhost. - Do not serve directories containing secrets (SSH keys, config files, .env files). The server serves the whole directory tree you point it at. - Run as an unprivileged user and pick a non-conflicting port. Confirm your firewall or NAT does not forward the chosen port to the public internet. - If you cannot change the script, prefer running it from a dedicated temporary directory containing only files you intend to expose. If you accept the small change to bind only to localhost and follow the precautions above, the skill is reasonable for local static previewing. Otherwise, treat it as potentially exposing files on your local network.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/4

Initial release: Python HTTP server for static HTML preview

● 可疑

安装命令 点击复制

官方npx clawhub@latest install static-server
镜像加速npx clawhub@latest install static-server --registry https://cn.clawhub-mirror.com

技能文档

Start a Python HTTP server to preview static HTML files in a browser.

When to Use

  • Testing static HTML pages
  • Previewing web pages before deployment
  • When browser tools block file:// protocol
  • Need a localhost URL for browser automation

Quick Start

Use the bundled script to start a server:

python scripts/serve.py  [--port PORT]

Arguments:

  • : 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

Output

The script prints:

  • Access URL: http://localhost:PORT/filename.html
  • Directory being served
  • Instructions to stop (Ctrl+C)

Usage in Testing

When testing static pages with browser tools:

  • Start server with exec (background mode)
  • Use the localhost URL with browser tools
  • Complete testing
  • Kill the server process

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" })

Alternative: One-liner

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.

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务