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 抓包,希望助手逆向接口、整理接口文档、找出认证流程或生成客户端 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 分