hardly

io.github.b1tninja由 GitHub 帳號 b1tninja 發布v1.0.0更新於 Oct 29, 2026

Generic HAR analysis MCP server: index and query captures without burning tokens on raw files.

概覽

AI 產生的概覽

把瀏覽器 HAR 擷取檔索引到 SQLite,並以小型、去識別化、分頁的工具讓助理梳理端點、驗證流程與資料型態。

可以做什麼
  • 開啟並索引 HAR 擷取檔,產生工作階段概覽、網站摘要與含嚴重程度的報告
  • 列出並檢視端點、表單與標籤、資料與媒體類型,以及憑證和驗證的運作方式
  • 把分析結果匯出為 OpenAPI 規格或用戶端程式碼,僅在允許覆寫時寫入檔案
  • 驅動真實瀏覽器以無頭或互動方式錄製 HAR,送出前需確認
  • 透過任務計畫、模式選擇、說明主題、提示詞與內附文件引導助理
適用情境
當手上有體積很大的 HAR 擷取檔,希望助理逆向解析 API、整理端點文件、找出驗證流程或產生用戶端 SDK,而不必讀取原始檔案時適用。只知道網址、需要先錄製擷取檔時也適用。
執行需求
本機 Python 3.10+ 程序,通常以 uvx hardly serve 透過 stdio 執行;也可用 pip、pipx 或 uv tool install 安裝。瀏覽器擷取需安裝 capture 附加元件並安裝 Playwright Chromium,有頭擷取還需要顯示環境。未宣告需要帳號、API 金鑰或環境變數。
安裝前請注意
HAR 檔案常含有效密碼和工作階段權杖;預設會去識別化,但仍應把擷取檔視為機密,不要提交或分享。以 send 開頭的工具會向真實伺服器送出請求,需 confirm=true;write 類工具會建立檔案;browser 類工具會驅動真實瀏覽器。僅對你有權存取的目標使用。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 hardly,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

hardly

[PyPI] [Python] [CI] [License: MPL-2.0]

A generic, content-neutral CLI and MCP server for reading and capturing HAR files and turning them into what a client SDK needs: endpoints, forms and labels, data and media kinds, and how credentials and authentication work.

Why

Browser HAR captures are often tens of megabytes. Agents that read them burn tokens and still miss structure. hardly streams a HAR into SQLite once, then exposes small, redacted, paginated tools over MCP (and a matching CLI). Bodies are truncated, secrets are redacted, lists are paginated: you hardly need the whole file.

hardly knows technologies (HTML forms, ASP.NET WebForms, GraphQL, OAuth/OIDC, cookies/CSRF, bot walls, ArcGIS REST...) and resource kinds (JSON, CSV, HTML tables, PDF, images...), not any particular site. Downstream SDKs keep their own recipes and vocabularies. See docs/scope.md.

Install

bash
pip install hardly                  # or: pipx install hardly / uv tool install hardlypip install 'hardly[capture]' && python -m playwright install chromium   # optional: record HARs

To work on hardly itself: pip install -e ".[dev]" (CONTRIBUTING.md).

Python 3.10+. Give an output path to save; otherwise nothing is written. Everything lives in memory unless you pass output_path (hardly session open HAR -o index.db). Python: with open_session(har) as s: ... (integrating.md).

60-second quick start

bash
hardly guide mode                             # which of the three modes fitshardly session overview path/to/capture.har   # counts per server, method and statushardly session site-brief path/to/capture.har # one-screen digest of a server-rendered sitehardly endpoint list path/to/capture.har --host api.example.comhardly session report path/to/capture.har     # one-pass findings with severityhardly write export path/to/capture.har --format openapi -o api.yamlhardly write export path/to/capture.har --format client_python --host api.example.com -o client.py

For agents, start with hardly_guide_task_plan(goal, har_path, url) (CLI: hardly guide task-plan --goal ...): it returns an ordered plan with example calls and the current environment state.

Names tell the effect

The CLI and the MCP server share one vocabulary: the command is the tool name without hardly_ (hardly_session_open is hardly session open HAR, hardly_send_entry is hardly send entry HAR 12 --confirm).

First wordMeaning
sendsends requests to a real server; needs confirm=true (CLI --confirm), otherwise returns only a plan
writewrites a file; refuses to replace one unless overwrite=true (--overwrite)
browserdrives or reads a real browser
anything elseonly reads loaded data

Merged tools take a sections list, for example hardly_auth_report(sections=['credentials', 'cookies']). Reference: docs/tools.md (71 tools), docs/cli.md (commands); stability promise: docs/api-stability.md.

Three modes

ModeWhenEntry
archiveA HAR file already existshardly_session_open(har_path) then hardly_session_site_brief / hardly_endpoint_list
headlessOnly a URL; an agent can drive the pagehardly_browser_capture_discover(url, analyze=true, confirm=true) (CLI hardly browser capture-discover URL --analyze --confirm)
interactiveBot wall, captcha, MFA, complex UIhardly_browser_start(headed=true), ask the person, then hardly_browser_stop

After any capture, continue in archive mode on the returned session_id. hardly never evades captchas or bot walls: it identifies them and tells you to stop, ask a person, or re-run elsewhere (docs/gate-policy.md). Details: docs/capture.md.

Install and run without cloning

bash
uvx hardly serve                              # MCP server over stdio (archive mode)uvx --from 'hardly[capture]' hardly browser --help   # with the Playwright capture extrapipx install 'hardly[capture]'                # or install the CLI permanentlyhardly skill install                          # copy the Agent Skill into ~/.claude/skills/hardly

MCP client config for the published package:

json
{ "mcpServers": { "hardly": { "command": "uvx", "args": ["hardly", "serve"] } } }

Browser capture needs a local install ([capture] extra, then python -m playwright install chromium; headed capture needs a display). The container image ghcr.io/b1tninja/hardly (multi-arch, built on each release) is for archive/headless analysis only; mount your working directory at /workspace. Release and verification details: docs/releasing.md.

MCP setup (Cursor and others)

Local venv (recommended; headed capture needs a display):

json
{  "mcpServers": {    "hardly": {      "command": "/path/to/hardly/.venv/bin/python",      "args": ["-m", "hardly"]    }  }}

On Windows use ...\\.venv\\Scripts\\python.exe. hardly serve starts the same server.

Docker (offline analysis only; mount your working directory):

bash
python scripts/build_image.py       # builds hardly-mcp:latest (Windows: scripts\deploy-docker.ps1)
json
{  "mcpServers": {    "hardly": {      "command": "docker",      "args": ["run", "--rm", "-i",               "-v", "/home/me/work:/workspace",               "-e", "HARDLY_WORKSPACE=/workspace",               "hardly-mcp:latest"]    }  }}

Host paths under the mount map to /workspace/.... To skip building locally, use the published image ghcr.io/b1tninja/hardly:latest in place of hardly-mcp:latest.

Agent onboarding

  • hardly_guide_task_plan, hardly_guide_mode, hardly_server_status (stale MCP? restart the server), hardly_guide_help(topic).
  • MCP prompts: analyze_har, discover_apis, capture_portal, document_api, find_auth_flow, reverse_engineer_api, build_client_sdk, diagnose_blocked_capture, verify_client.
  • MCP resources: hardly://cheatsheet and hardly://docs/<name> for the bundled docs.
  • Agent Skill: hardly skill install [--dest DIR] (default ~/.claude/skills/hardly), or hardly skill print. Source: skills/hardly.

Documentation

DocContents
docs/README.mdIndex of all docs
docs/scope.mdWhat is in and out of scope; change checklist
docs/cheatsheet.mdOne-page quick reference
docs/concepts.mdSessions, index, redaction, modes
docs/sdk-workflow.mdCapture to client SDK, step by step
docs/reporting.mdhardly_session_report findings
docs/catalog.mdTarget catalog, TargetAdapter, batch verify
docs/capture.mdHeadless and interactive capture, recipes, env vars
docs/technologies.mdWhat is detected, per technology
docs/architecture.mdData flow and design rules
docs/troubleshooting.mdCommon first-use problems
docs/tools.mdGenerated reference for every MCP tool
docs/cli.mdCLI grammar and every command (generated)
docs/api-stability.mdWhat is public and the v1 compatibility policy
docs/api-decisions.mdHow the v1 names were chosen; old to new names

Library use

python
from hardly import open_session
with open_session("capture.har") as s:      # in memory; pass output_path= to save the index    print(s.conn.execute("select count(*) from entries").fetchone()[0])

Development and tests

bash
pytest -q                 # offline; HARDLY_LIVE_CAPTURE=1 enables live Playwright testsruff check .

Live soak against public demo sites (no private HARs): hardly soak live --list, then hardly soak live (or --ids datatables-ajax,quotes-login,…). Catalog covers loopback WebForms/token login, HTML/AJAX tables, form logins, GraphQL, and JSON/OpenAPI — see hardly.live_targets and docs/test-targets.md. CONTRIBUTING.md, AGENTS.md; release notes in CHANGELOG.md.

Security

HAR files often contain live passwords and session tokens. hardly redacts by default, but treat captures as secrets: do not commit or share them, and rotate credentials if one leaked. Use hardly only on targets you are authorised to access. See SECURITY.md.

License

MPL-2.0. Generated output (stubs, OpenAPI, reports) is not covered; see NOTICE.md.

來源:README.md,提交 5d8ee69

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Oct 29, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分