Skip to main content
Glama
HexStrike AI MCP Agents

HexStrike AI MCP Agents

by liusc45
README.md
<div align="center">

<img src="assets/hexstrike-logo.png" alt="Red crab with a pirate patch, the mark of this Rust fork" width="220"/>

# HexStrike AI MCP Agents
### Rust fork of the AI-powered cybersecurity automation platform

[![Rust](https://img.shields.io/badge/Rust-axum-orange.svg)](https://www.rust-lang.org/)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Upstream](https://img.shields.io/badge/fork-0x4m4%2Fhexstrike--ai-red.svg)](https://github.com/0x4m4/hexstrike-ai)
[![MCP](https://img.shields.io/badge/MCP-Python%20client-purple.svg)](hexstrike_mcp.py)
[![Version](https://img.shields.io/badge/Version-6.1.0-orange.svg)](https://github.com/liusc45/hexstrike-ai-rs)

**The HTTP server is rewritten in Rust. The MCP client stays in Python. That client is a thin HTTP proxy, and rewriting it would not make the server simpler.**

</div>

---

## Why this fork

I tried the original Python server and it hung. The process stopped answering and there was no useful way to get it back, so I rewrote the server in Rust (axum). The JSON contract that `hexstrike_mcp.py` already speaks is the same. The license is still MIT, the same as [0x4m4/hexstrike-ai](https://github.com/0x4m4/hexstrike-ai).

The crab with the pirate patch replaces the bear. That is the mark of the change.

On the same machine, with stub tools rather than a real pentest:

| | Python | Rust |
|---|---|---|
| Idle RAM | 40.5 MB | 8.2 MB |
| Time until `/health` | 2,253 ms | 321 ms |
| 600 stub calls | 7,250 ms, 100.7 MB | 2,519 ms, 14.7 MB |

The release binary is 2.7 MB. The Python virtualenv that ran the old server was 128 MB. A local Docker image of this fork is 11.5 MB.

Upstream is owned and developed by [OTT Cybersecurity LLC](https://overthetop.ae/). This fork does not change that.

---

## Architecture

```mermaid
graph TD
    A[AI agent] -->|MCP stdio| B[hexstrike_mcp.py]
    B -->|HTTP JSON| C[hexstrike serve]
    C --> D[75 tool routes]
    C --> E[files, processes, cache, telemetry]
    C --> F[501: manual tools and in-process families]
    D --> G[nmap, nuclei, and the other CLIs on PATH]
```

1. The agent talks to `hexstrike_mcp.py` over stdio, as before.
2. The MCP client calls this server over HTTP.
3. `hexstrike serve` runs the tool, or answers 501 or 403 when that route was not ported.
4. The security tools themselves are not in the binary. They have to be on `PATH`.

What matches Python, and what does not, is in [MIGRATION.md](MIGRATION.md).

---

## Installation

Rust stable is required (edition 2024, rustc 1.85 or newer).

```bash
git clone https://github.com/liusc45/hexstrike-ai-rs
cd hexstrike-ai-rs
cargo build --release
./target/release/hexstrike serve
```

The server listens on `127.0.0.1:8888`. If that port is already taken:

```bash
./target/release/hexstrike serve --port 8899
```

| Flag | Effect |
|---|---|
| `--host` | Bind address. Default `127.0.0.1`. `localhost` and `::1` work. Any other host refuses to start unless a token is set. |
| `--port` | Port. Default `8888`. |
| `--token` | Required together with a non-loopback `--host`. `HEXSTRIKE_TOKEN` does the same. The token is a startup gate. Requests are not checked against it yet. |
| `--allow-shell` | Enables `POST /api/command`. Without it the route answers 403. |

`HEXSTRIKE_HOST` and `HEXSTRIKE_PORT` do the same. A flag wins over the variable. The process exits 0 on SIGTERM and on Ctrl-C.

### Docker

```bash
docker build -t hexstrike-ai-rs .
docker run --rm -p 127.0.0.1:8888:8888 hexstrike-ai-rs
```

The image listens on all interfaces. The port mapping is what keeps it on loopback. It does not install nmap or the other tools.

`install.sh`, the `.deb` / `.rpm` packages, and `ghcr.io/liusc45/hexstrike-ai-rs` are produced when a `vX.Y.Z` tag is pushed. There is no release yet. See [docs/PACKAGING.md](docs/PACKAGING.md).

### MCP client

The client is still Python. Point it at the server:

```bash
uv run python hexstrike_mcp.py --server http://127.0.0.1:8888 --lazy
```

`--lazy` starts the MCP process without waiting on `/health`, so a slow machine does not kill the stdio handshake. `--health-timeout` defaults to 15 seconds. Without `--lazy` the client probes `/health` twice, one second apart, and does not follow redirects.

`uv sync` installs `mcp` and `requests`. There is no `requirements.txt` and no venv to activate. The extractor and the stub comparison are stdlib: `uv run python tools/extract_tools.py`.

The old Python server is still in the tree for comparison. Its import-time packages are the `server` group, not the default install:

```bash
uv sync --group server
uv run --group server python hexstrike_server.py
```

angr and pwntools are not in that group. Those routes answer 501 on this fork.

Claude Desktop, Cursor, or another MCP client:

```json
{
  "mcpServers": {
    "hexstrike-ai": {
      "command": "uv",
      "args": [
        "run",
        "--directory",
        "/path/to/hexstrike-ai-rs",
        "python",
        "hexstrike_mcp.py",
        "--server",
        "http://127.0.0.1:8888",
        "--lazy"
      ],
      "timeout": 300
    }
  }
}
```

### Security tools

Install the CLIs you actually use (Homebrew, apt, or the upstream list). The server only looks them up on `PATH`. A missing tool returns `tool_unavailable`, it does not crash the process.

### Verify

```bash
curl -s http://127.0.0.1:8888/health
```

A healthy answer has `"status": "healthy"` and `"version": "6.1.0"`. `tools_status` is still a map of booleans. Two fields are added: `missing_essential_tools` and `tools_resolved`.

Name lookup follows a short alias list. `nxc` counts if `crackmapexec` is installed. `enum4linux-ng` counts if `enum4linux` is installed. `theharvester` also finds `theHarvester`. A `httpx` whose file starts with a Python shebang is ignored, so a pip script is not reported as the ProjectDiscovery binary.

`POST /api/intelligence/analyze-target` answers **501**. That family was in-process Python and is not ported. Do not use it as a health check.

---

## What runs

Of 90 `/api/tools/*` routes, **75 run**. The other 15 answer 501, because the Python handler wrote a temp script, built a list, or ran inside the process: angr, api_fuzzer, api_schema_analyzer, browser-agent, burpsuite-alternative, enum4linux-ng, gdb, gdb-peda, graphql_scanner, http-framework, jwt_analyzer, metasploit, pacu, pwntools, radare2.

These families also answer 501: `/api/visual`, `/api/intelligence`, `/api/bugbounty`, `/api/ai`, `/api/vuln-intel`.

`/api/python/*` answers 403. `/api/command` answers 403 unless the server was started with `--allow-shell`.

### Core endpoints

| Endpoint | Method | Status |
|---|---|---|
| `/health` | GET | Ported |
| `/api/command` | POST | 403 unless `--allow-shell` |
| `/api/telemetry` | GET | Ported |
| `/api/cache/stats` | GET | Ported |
| `/api/files/create`, `modify`, `list` | POST / GET | Ported. Paths cannot leave the files directory. |
| `/api/files/delete` | DELETE and POST | Ported. Upstream Flask answered 405 to the MCP's POST. |
| `/api/payloads/generate` | POST | Ported. Buffer, cyclic, and random patterns only. |
| `/api/processes/list`, `status`, `dashboard`, `terminate`, `pause`, `resume` | GET / POST | Ported |
| `/api/intelligence/*` and the other in-process families | POST | 501 |
| `/api/python/*` | POST / DELETE | 403 |

### MCP tools that still call a live route

Network and web tools whose route was compiled still work the same way: `nmap_scan`, `rustscan_scan`, `masscan_scan`, `gobuster_scan`, `feroxbuster_scan`, `ffuf_scan`, `nuclei_scan`, `sqlmap_scan`, `trivy_scan`, and the rest of the 75. Tools whose route is 501 still exist in the MCP client. The client turns that HTTP error into `{"error": "Request failed: …", "success": false}`, which is what it already did.

---

## Security

- The server binds to loopback by default. A non-loopback `--host` will not start unless `HEXSTRIKE_TOKEN` or `--token` is set. That check is only at startup. The token is not enforced on each request yet, so do not treat it as authentication.
- The MCP client refuses a server URL that is not `http` or `https`, and it does not follow redirects.
- With `--allow-shell`, an agent can run shell commands as the user who started the server.
- Run it where that is acceptable: a test VM, or a machine you control.
- Only test systems you own or have written permission to test.

---

## Contributing

```bash
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
```

`tools/extract_tools.py` rebuilds `tools/tools.json` from the original Python handlers and checks them. That script stays in Python because it has to execute those handlers.

---

## License

MIT. See [LICENSE](LICENSE).

Upstream author: **m0x4m4** — [0x4m4.com](https://www.0x4m4.com) · [hexstrike.com](https://www.hexstrike.com)

This fork: [liusc45/hexstrike-ai-rs](https://github.com/liusc45/hexstrike-ai-rs)

TDQS

C2.6/5.0

Scored across 150 tools

Disambiguation2/5

The set contains many overlapping scanners and near-duplicates: gobuster_scan/dirb_scan/feroxbuster_scan/dirsearch_scan/ffuf_scan/wfuzz_scan all perform web content discovery, while arjun_scan and arjun_parameter_discovery, paramspider_mining and paramspider_discovery, and autorecon_scan and autorecon_comprehensive substantially duplicate each other. Underlying tools differ, but an agent has no clear rule for choosing among them, especially across XSS, payload generation, subdomain enumeration, and process dashboard tools.

Naming Consistency3/5

All names use snake_case, which is readable, but the semantic pattern is inconsistent: some are verb_noun (create_file, execute_command, get_process_status), others are tool-verb (nmap_scan, nikto_scan, checksec_analyze), and many are domain-specific workflow names (bugbounty_osint_gathering, ai_generate_attack_suite). This is not chaotic, but it lacks a consistently predictable naming convention.

Tool Count1/5

With 150 tools, the surface is far too large for an MCP server even in a broad offensive-security domain. Many tools are thin wrappers or duplicates, making the set overwhelming and difficult to navigate rather than well-scoped.

Completeness4/5

The toolkit covers an unusually broad lifecycle: recon, scanning, exploitation, cloud, container, binary analysis, forensics, API testing, reporting, process management, and AI-assisted workflows. A few lifecycle or orchestration gaps may remain, but most expected offensive-security operations are represented.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues