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 http request mcp

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

Overview

Concrete MCP tool that sends a custom HTTP request with scope enforcement, auth injection, and evidence collection, returning the response with elapsed time and evidence artifacts.

Description

The http_request MCP tool lets the MCP host model send arbitrary HTTP requests during an engagement. It supports all standard HTTP methods (GET, HEAD, POST, PUT, PATCH, OPTIONS, DELETE, PURGE, TRACE).

Key behaviors:

  • Scope enforcement: The URL host:port must match the engagement target; otherwise returns `{"error": "out_of_scope"}`
  • Auth injection: Auth resolved from auth_profile or engagement cache, injected into the request
  • Destructive methods: DELETE, PURGE, TRACE require `allow_destructive=True`
  • Evidence collection: EvidenceCollector records the HTTP exchange
  • Response truncation: Response body truncated to 4KB for MCP payload size

Usage

This is an MCP tool called by the MCP host model for custom HTTP probing.

Code Reference

Source Location

Signature

@mcp.tool()
async def http_request(
    method: str,
    url: str,
    engagement_id: str,
    headers: dict[str, str] | None = None,
    body: str = "",
    json_body: dict[str, Any] | None = None,
    auth_profile: str = "",
    allow_destructive: bool = False,
) -> dict[str, Any]:
    """Send a custom HTTP request with scope enforcement."""

I/O Contract

Inputs

Name Type Required Description
method str Yes GET/HEAD/POST/PUT/PATCH/OPTIONS/DELETE/PURGE/TRACE
url str Yes Must match engagement target host:port
engagement_id str Yes Required for scope enforcement
headers None No Custom headers
body str No Request body
json_body None No JSON request body
auth_profile str No Named auth profile
allow_destructive bool No Required for DELETE/PURGE/TRACE

Outputs

Name Type Description
returns status, headers, response_body (4KB max), response_bytes_total, elapsed_ms, evidence_artifacts
error {"error": "out_of_scope"} if URL host ≠ engagement target

Usage Examples

Called via MCP

Tool: http_request
Arguments: {
    "method": "POST",
    "url": "https://app.example.com/api/login",
    "engagement_id": "a1b2c3d4",
    "json_body": {"username": "admin", "password": "test"},
    "headers": {"Content-Type": "application/json"}
}

Response:
{
    "status": 200,
    "headers": {"Set-Cookie": "session=abc123"},
    "response_body": "{\"success\": true}",
    "response_bytes_total": 16,
    "elapsed_ms": 42,
    "evidence_artifacts": [...]
}

Related Pages

Implements Principle

Requires Environment

Page Connections

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