Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai start engagement mcp

From Leeroopedia
Knowledge Sources
Domains Security_Testing, MCP
Last Updated 2026-10-23 12:00 GMT

Overview

Concrete MCP tool that starts a new pentest engagement against a target, running the full assessment pipeline asynchronously while the MCP client polls for progress.

Description

The start_engagement MCP tool is the entry point for driving pentest-ai through an MCP-compatible AI client (Claude Code, Cursor). It creates an engagement in the FindingsDB, optionally resolves an auth profile, and launches the full pipeline asynchronously.

The pipeline runs in a detached task (1-5 minutes depending on scope/tools) so the MCP client does not time out. The client polls `get_engagement_status` and `get_findings` for results.

Key behaviors:

  • Auth profile resolution: If `auth_profile` is passed, credentials are resolved via the secure credential-resolver path so secrets never enter the MCP/LLM payload
  • Rate limit respect: `respect_rate_limits=True` honors HTTP 429 / Retry-After with exponential backoff
  • Strict scope: `strict_scope=True` refuses any request whose host is outside the engagement target's host
  • Scope options: full, recon, web, ad, cloud
  • Intensity: stealth, safe, normal, aggressive

Usage

This is an MCP tool called by the MCP host model. It is not imported directly in Python code.

Code Reference

Source Location

Signature

@mcp.tool()
async def start_engagement(
    target: str,
    scope: str = "full",
    rules_of_engment: str = "",
    intensity: str = "normal",
    auth_profile: str = "",
    respect_rate_limits: bool = False,
    strict_scope: bool = False,
    ctx: Context | None = None,
) -> dict[str, Any]:
    """Start a new pentest engagement against a target.
    AUTHORIZED TARGETS ONLY."""

Import

# This is an MCP tool, not a direct import.
# It is exposed via the FastMCP server at mcp_server/server.py

I/O Contract

Inputs

Name Type Required Description
target str Yes Hostname, IP, or URL
scope str No recon/web/ad/cloud/full (default: full)
rules_of_engment str No Rules of engagement / exclusions
intensity str No stealth/safe/normal/aggressive (default: normal)
auth_profile str No Named auth profile for credentialed scanning
respect_rate_limits bool No Honor 429/Retry-After (default: False)
strict_scope bool No Per-request host guard (default: False)

Outputs

Name Type Description
returns engagement_id, target, scope, status: "running", message

Usage Examples

Called via MCP (from Claude Code)

The MCP host model calls this tool:

Tool: start_engagement
Arguments: {
    "target": "https://app.example.com",
    "scope": "full",
    "intensity": "normal",
    "auth_profile": "my-profile",
    "strict_scope": true
}

Response:
{
    "engagement_id": "a1b2c3d4",
    "target": "https://app.example.com",
    "scope": "full",
    "status": "running",
    "message": "Engagement a1b2c3d4 started..."
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment