#269

fix: installer + fast accurate tool detection + MCP handshake/requirements fixes (v6.0.1)

OpenZanderoDevwants to merge intofrom

What / Why

This fork had no installer, and the old codebase had three bug clusters that broke fresh setups:

  1. No installer — README-only manual steps; users guessed which of the 150+ tools to install.
  2. requirements.txt blocked installs — pinned the wrong fastmcp package (code imports mcp.server.fastmcp) and forced heavy builds (pwntools/angr/mitmproxy/selenium) that fail on Python 3.13+. hexstrike_server.py also imported selenium/mitmproxy unconditionally, so a core-only env crashed at import.
  3. Tool detection slow + inaccurate — /health ran 120+ which calls through the threaded EnhancedCommandExecutor (with progress logging!), cached only successes, double-counted duplicate names, and missed renamed/cased tools (nxc vs crackmapexec, theHarvester, msfconsole...).
  4. MCP handshake killed on slow machines — 5s /health probe + 3x2s blocking retries at stdio startup ("Connection closed"), plus a placeholder hexstrike-ai-mcp.json.

Changes

  • install.sh (new) — distro/Python preflight, fast command -v scan, installs only missing tools per use-case category (apt/go/cargo/pipx/gem, incl. Go >=1.23 bootstrap), venv + core deps, auto-writes OpenCode MCP config, validation + optional --check-health. Safe to re-run.
  • hexstrike_server.py — /health now uses shutil.which + importlib alias-aware resolve_tool() (no subprocess), deduped tool list, extended helper PATH, returns tools_detail / missing_essential_tools / install_hints; old response keys kept. selenium/mitmproxy imports optional with graceful endpoint errors.
  • hexstrike_mcp.py — compat FastMCP import (mcp v1 -> v2 MCPServer -> fastmcp pkg), /health probe 5s -> 15s, startup retries 3x2s -> 2x1s, new --lazy + --health-timeout flags.
  • requirements.txt — core-only, pins mcp>=1.9,<2; heavy deps moved to new requirements-optional.txt (--with-browser/--with-proxy/--with-pwn).
  • hexstrike-ai-mcp.json + new opencode.json.example — working paths/flags instead of placeholders.
  • README.md — installer-first install docs, fixed client configs, expanded troubleshooting.

Test evidence (clean venv, Python 3.13)

  • pip install -r requirements.txt succeeds; mcp.server.fastmcp.FastMCP imports; both files py_compile clean.
  • /health via Flask test client: HTTP 200 in ~1s for 122 tools (was 10s+ subprocess storm), 55 detected here, missing_essential_tools: ['john'].
  • MCP client: lazy init 0.00s, dead-server non-lazy init ~2s (was 6s+), --help lists new flags.
  • bash -n install.sh clean; JSON configs validate.

Backward compatibility

  • /health keeps all old keys (tools_status, all_essential_tools_available, total_*, category_stats); only adds new ones.
  • Manual install steps in README still work; installer is additive.