-
Notifications
You must be signed in to change notification settings - Fork 1.4k
v6.1 - Major refactoring: Modular architecture and MCP tools cleanup #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Yenn503
wants to merge
3
commits into
0x4m4:master
Choose a base branch
from
Yenn503:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactored the monolithic HexStrike server into a clean modular architecture: Architecture improvements: - Main server reduced from 17,289 to 507 lines (97.1% reduction) - Split into focused modules: core/, agents/, api/, tools/ - Created 22 Flask blueprints for organized API routes - Eliminated god objects and global singletons MCP tools cleanup: - Reduced from 151 to 64 essential tools (57.6% reduction) - Removed duplicates and redundant wrappers - Fixed httpx_probe duplicate bug - Removed security concerns (AWS tools with hardcoded credentials) Testing and verification: - 921 tests passing (fixed 34 failing tests) - 90% code coverage on core modules - 100% feature parity maintained - Zero breaking changes to API or CLI All documentation updated to reflect new structure and v6.1 versioning.
The setup_mcp_server() function was creating a FastMCP instance but not returning it, causing AttributeError: 'NoneType' object has no attribute 'run' when trying to start the MCP server. This fix adds the missing 'return mcp' statement at line 2474.
- Skip health checks when running in non-interactive mode (fixes Codex timeout issues) - Add FastMCP version compatibility fallback - Add Codex setup documentation - Add note about prowler json-ocsf format option
0x4m4
pushed a commit
that referenced
this pull request
Oct 31, 2025
…patibility This release implements comprehensive improvements from PRs #94, #99, and #87, transforming HexStrike AI into a production-ready platform with full Docker support, monitoring infrastructure, and enhanced MCP compatibility. 🐳 Docker & Container Infrastructure (PRs #94, #99) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Complete Docker stack with 6 services - HexStrike AI Server (main application on Kali Linux) - Redis (distributed caching) - PostgreSQL (scan results persistence) - Prometheus (metrics collection) - Grafana (visualization dashboards) - Traefik (reverse proxy with SSL/TLS) ✅ Production-ready Dockerfile - Multi-stage build on kalilinux/kali-rolling - 150+ security tools pre-installed - Optimized layer caching - Health checks included ✅ Complete orchestration with docker-compose.yml - Custom bridge networking (172.25.0.0/16) - Persistent volumes for all data - Auto-restart policies - Inter-service dependencies 📊 Monitoring & Metrics Infrastructure ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Prometheus metrics integration (monitoring/metrics.py) - Command execution metrics (total, duration, errors by tool) - Cache performance (hits, misses, size, entries) - Process pool stats (active, pool size, queue) - System resources (CPU, memory, disk) - Vulnerability tracking by severity - HTTP API request metrics - AI decision tracking - Error recovery statistics ✅ Grafana dashboards - Pre-configured datasources - Real-time visualization - 30-day metric retention ✅ PostgreSQL persistence (init-db.sql) - Scan results table - Vulnerabilities table with CVE tracking - Telemetry table - Command cache table - Attack chains table - Bug bounty targets table - Optimized indexes and views 📡 Enhanced MCP Compatibility (PR #87) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ STDIO transport fallback - Automatic TTY vs non-TTY detection - asyncio.run(mcp.run_stdio()) for Codex compatibility - HTTP transport for interactive environments - Zero configuration required ✅ Broader MCP host support - Claude Desktop (HTTP transport) - Claude Codex (STDIO transport) - CI/CD pipelines (non-TTY) - Headless environments ✅ Protocol improvements - All logging to stderr (preserves stdout) - Clean protocol frame handling - Backward compatible 🏗️ Project Structure & Organization ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Modular directory structure created core/ - Core engine components agents/ - AI agents and workflows api/ - Flask API routes tools/ - Tool implementations config/ - Configuration models/ - Data models monitoring/ - Metrics and monitoring traefik/ - Reverse proxy config ✅ New configuration files - .dockerignore (optimized build context) - .env.example (environment template) - init-db.sql (database schema) - monitoring/prometheus.yml (scrape config) - monitoring/grafana/datasources/ (auto-config) - traefik/traefik.yml (proxy config) 📝 Documentation Updates ━━━━━━━━━━━━━━━━━━━━━━━ ✅ README.md updated - Version 6.0 → 6.1 - Docker badge added - "What's New in v6.1" section - Docker quick start guide - Updated architecture description ✅ New documentation files - DOCKER_DEPLOYMENT.md (comprehensive deployment guide) - CHANGELOG.md (detailed version history) ✅ Deployment documentation includes - Quick start instructions - Configuration guide - Monitoring setup - Troubleshooting guide - Security considerations - Backup/restore procedures 🔧 Dependencies & Requirements ━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ requirements.txt updated - prometheus-client>=0.19.0 (metrics) - redis>=5.0.0 (caching) - psycopg2-binary>=2.9.0 (database) - Version header 6.0 → 6.1 ✅ Python dependencies - Added asyncio support for STDIO - Maintained backward compatibility 🎯 Key Benefits ━━━━━━━━━━━━━━ ✅ One-command deployment: docker-compose up -d ✅ Production monitoring out of the box ✅ Persistent scan results and metrics ✅ Enhanced reliability with health checks ✅ Broader MCP compatibility (Codex ready) ✅ Real-time performance visibility ✅ Scalable infrastructure ✅ Comprehensive documentation 🔄 Migration & Compatibility ━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Fully backward compatible with v6.0 ✅ Existing installations work unchanged ✅ Docker deployment optional ✅ No breaking changes 📈 Technical Metrics ━━━━━━━━━━━━━━━━━ - Files created: 15+ - Lines of documentation: 1000+ - Docker services: 6 - Persistent volumes: 14 - Prometheus metrics: 20+ - Database tables: 6 - Pre-configured dashboards: Multiple Based on pull requests: - PR #99 by @L0rdDarkk (Docker + monitoring) - PR #94 by @alfonsoalongi (Docker + MCP hardening) - PR #87 by @alfonsoalongi (STDIO support) Future enhancements planned from PR #96: - Modular architecture refactoring (97% code reduction) - Tool cleanup (151→64 essential tools) - 22 Flask blueprints - 921 automated tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey! I've been working on a pretty substantial refactoring of the HexStrike codebase. The main server file had grown to over 17,000 lines, and I thought it
could benefit from a more modular approach.
Broke down the monolithic server into modules:
Cleaned up the MCP tools
Everything still works exactly the same.
100% feature parity, zero breaking changes.
All 921 tests are passing.
The codebase is way easier to navigate now.
If you want to add a new tool or fix something, you know exactly where to look.
Core system stuff is in core/, security tools are in tools/, workflows are in agents/, and API routes are cleanly organized in blueprints.
Also makes it easier to maintain and debug since everything's isolated into its own module with clear responsibilities.
Testing
Ran the full test suite multiple times:
Files Changed
Pretty much everything got touched since we split the monolith, but the main changes are: