> your AI agent picks dependencies from memory; give it dated facts — try starlog.dev ↗ vet your agent's deps ↗ vibe-coding is fine. vibe-importing isn’t. — try starlog.dev ↗ vibe-importing isn’t fine ↗ your agent has never seen your private packages — try starlog.dev ↗ facts for private packages ↗ a linter for the dependencies your AI agent picks — try starlog.dev ↗ a linter for agent deps ↗ whois is redacted, cdns mask the rest — get the real operator — try whoisgeni.us ↗ who really runs that domain ↗ domain attribution that shows its work — full evidence chain — try whoisgeni.us ↗ domain intel w/ evidence ↗

← Back to Articles

ARTEX: Building Autonomous Penetration Testing with LLM-Orchestrated Agents and MCP

[ View on GitHub ]

ARTEX: Building Autonomous Penetration Testing with LLM-Orchestrated Agents and MCP

Hook

Most AI pentesting tools hardcode their toolchains into LangChain prompts. ARTEX treats every security tool—nmap, nuclei, browser automation—as a hot-swappable MCP server that agents discover at runtime.

Context

Penetration testing frameworks have historically forced a choice: use deterministic scanners like Nuclei that run the same YAML templates every time but miss context-specific vulnerabilities, or employ human pentesters who adapt their approach but don't scale across hundreds of subdomains. LLM-based security tools promised a middle ground, but first-generation implementations like AutoGPT pentesting forks baked tool calls directly into Python scripts—adding sqlmap meant editing agent code, redeploying containers, and maintaining fragile string parsing of command-line output.

ARTEX emerges from this gap as a Go-based autonomous penetration testing framework that treats tools as protocol endpoints rather than hardcoded functions. Built on the Model Context Protocol (MCP), it orchestrates three agent types: strategic planners that decompose reconnaissance tasks, parallel workers that execute scans through MCP tool servers, and reporters that deduplicate findings using root-cause analysis instead of naive string matching. The entire stack—PostgreSQL persistence, Next.js frontend, SSE event streams, and agent runtime—ships as a single binary with atomic updates and automatic rollback. It's positioned for offensive teams who need LLM-augmented exploration of complex attack surfaces while keeping humans in the loop for exploitation decisions.

Technical Insight

MCP Tool Layer

Agent Orchestration

SSE updates

Persists findings

Task schemas

Parallel subtasks

Parallel subtasks

Parallel subtasks

Tool invocation

Tool invocation

Tool invocation

Structured results

Structured results

Structured results

Raw findings

Raw findings

Raw findings

Synthesized report

Next.js Frontend

Force-directed graphs

Go API Server

Single port

PostgreSQL

Schema migrations

Plan Agent

Task decomposition

Work Agent 1

Work Agent 2

Work Agent 3

Reporter Agent

Deduplication

stdio MCP

Chrome/Playwright

SSE MCP

Long-running tools

Streamable HTTP

nmap/nuclei

System architecture — auto-generated

The architectural centerpiece is MCP as a universal tool abstraction layer. Instead of agents calling exec.Command("nmap", "-sV", target) and parsing stdout, they invoke MCP servers that expose structured schemas. Here's how an agent interacts with the nmap MCP server:

// Agent receives tool schemas in system prompt
type MCPTool struct {
    Name        string                 `json:"name"`
    Description string                 `json:"description"`
    InputSchema map[string]interface{} `json:"inputSchema"`
}

// LLM generates tool invocation based on schema
toolCall := {
    "name": "nmap_scan",
    "arguments": {
        "target": "192.168.1.0/24",
        "options": ["-sV", "-T4"],
        "ports": "80,443,8080"
    }
}

// Framework routes to appropriate MCP transport
switch server.Transport {
case "stdio":
    // Launch subprocess, communicate via stdin/stdout
    cmd := exec.Command("npx", "-y", "@modelcontextprotocol/server-nmap")
    result := sendStdioRequest(cmd, toolCall)
case "sse":
    // HTTP SSE stream for long-running tools
    result := streamSSERequest(server.URL, toolCall)
case "streamable":
    // Newer streamable HTTP transport
    result := streamableRequest(server.URL, toolCall)
}

This indirection unlocks extensibility: adding a new scanner means deploying an MCP server (which can be written in any language) and registering its endpoint. Agents automatically discover new tools through schema introspection without code changes. The framework supports three transports—stdio for local tools like Chrome automation via npx @modelcontextprotocol/server-playwright, SSE for long-running HTTP services, and the emerging Streamable HTTP spec.

The multi-agent orchestration uses concurrency thoughtfully. A 'plan' agent decomposes high-level objectives ("test api.example.com for common vulnerabilities") into discrete tasks. Three parallel 'work' agents (configurable) pull from the task queue and execute reconnaissance. The wrinkle: while agents run in parallel, each agent's tool invocations are sequential because they wait for LLM responses between steps. If WorkAgent-1 needs to scan 20 subdomains, it processes them one conversation turn at a time:

LLM: "Use nmap_scan on subdomain1.example.com"
→ Wait for nmap MCP response
→ Send results back to LLM
LLM: "Now try subdomain2.example.com"
→ Repeat

This creates natural checkpoints for human oversight but sacrifices throughput. The architecture could support batch tool calls ("scan these 10 hosts in parallel") but leaves sequencing to the language model, which defaults to cautious step-by-step execution.

The 'reporter' agent demonstrates domain-aware intelligence rarely seen in automated scanners. Instead of deduplicating findings by CVE-ID or vulnerability name, it analyzes:

type Finding struct {
    Title          string
    RootCause      string // "Unsanitized user input in SQL query"
    Evidence       string // Actual payload and response
    PrivilegeLevel string // "unauthenticated", "low-privilege user"
    AffectedAssets []string
}

// Reporter merges findings with same root cause and privilege boundary
// SQL injection in /api/users?id=1 and /api/posts?author_id=2 become
// one finding folder if both stem from same ORM misconfiguration

A single SQL injection vulnerability exploitable across multiple parameters becomes one finding with aggregated evidence, while similar-looking vulnerabilities at different authentication boundaries remain separate. This mimics how human pentesters structure reports: by underlying weakness rather than surface symptom.

The deployment story is production-grade for teams allergic to Docker complexity. The Go binary embeds the Next.js static export, serving both API and SPA from one process. Updates happen atomically through a watchdog pattern:

# Update mechanism downloads new release, verifies SHA256
curl -L https://github.com/MoLeft/ARTEX/releases/latest -o artex.new
sha256sum -c artex.new.sha256

# Watchdog script manages swap and rollback
while true; do
    ./artex.new
    EXIT_CODE=$?
    if [ $EXIT_CODE -eq 0 ]; then
        mv artex artex.old
        mv artex.new artex
        break
    fi
    CRASH_COUNT=$((CRASH_COUNT + 1))
    if [ $CRASH_COUNT -ge 3 ]; then
        mv artex.new artex.failed
        mv artex.old artex  # Auto-rollback
        exit 1
    fi
done

If the new binary crashes three times, it auto-reverts while preserving the failed version for forensics. This beats Kubernetes rollouts when you need OS-level security tools that don't containerize cleanly.

The frontend visualizes asset coverage with force-directed graphs: nodes represent discovered endpoints, edges show exploration paths, and color coding indicates test coverage. Server-Sent Events push real-time updates as agents probe new surfaces, creating a live command center. The integration with ScopeSentry (a passive asset discovery platform) means you can import an entire subdomain enumeration and immediately see which hosts the agents have actively tested.

Gotcha

The LLM-drives-everything approach creates unpredictable costs and occasional logic failures. Since agents decide tool selection, parameter construction, and result interpretation through prompts, there's no learned exploration policy or deterministic fallback. If GPT-4 hallucinates invalid nmap syntax or misinterprets nuclei JSON output, the framework has no validation layer to catch it—the tool call just fails and the agent moves on. Token costs accumulate fast on large attack surfaces (imagine 200 subdomains × 3 turns per host × $0.03/1K tokens), with no budget enforcement per task or agent to prevent runaway spending.

Database migrations are append-only SQL executed on every boot rather than versioned with proper up/down semantics. Adding a table? Fine. Renaming a column or changing a type? The watchdog can rollback the binary to artex.old, but PostgreSQL stays on the new schema with no automated downgrade path. You're manually writing ALTER statements in psql while the old binary expects the previous schema.

The SSE transport for real-time updates breaks silently through default reverse proxy configs. Nginx buffers responses unless you explicitly set proxy_buffering off; proxy_read_timeout 86400;. The README documents this, but first-time deployers will see perpetual loading spinners in the UI while events queue server-side. There's no health check endpoint that validates the SSE path works end-to-end, so you discover the issue in production when stakeholders complain the dashboard froze.

Verdict

Use if: You're running ScopeSentry or similar asset discovery and want LLM-augmented active reconnaissance across dozens of subdomains, you need a self-contained binary for air-gapped environments where Docker registries are bureaucratic nightmares, or you're building a security command center that combines passive monitoring with autonomous exploration. The MCP abstraction makes this more architecturally sound than LangChain demos that hardcode tool integrations. Skip if: You need deterministic, cost-controlled scanning (stick with Nuclei YAML templates), want agent learning from past runs (there's no RL or fine-tuning here), require Windows/mobile app testing (browser MCP is web-only), or expect this to replace Burp Suite for deep manual testing. ARTEX is a first-pass explorer that hands off findings to human analysts, not a full-stack exploitation platform. Budget for LLM API costs and occasional hallucinated tool calls—this trades determinism for adaptability.