#294

fix(mcp): remove stray self. references breaking two AI analysis tools

Openharshitgavita-07wants to merge intofrom

What

Removes five stray self. references in hexstrike_mcp.py that make two MCP tools crash on every call.

ai_generate_attack_suite and comprehensive_api_audit are nested inside setup_mcp_server() and registered as FastMCP tools. There is no self in that scope, so both raise NameError: name 'self' is not defined the moment they reach their first internal call:

  • ai_generate_attack_suite -> self.ai_generate_payload(...) (line 2910)
  • comprehensive_api_audit -> self.api_fuzzer(...), self.api_schema_analyzer(...), self.jwt_analyzer(...), self.graphql_scanner(...) (lines 3129-3159)

The fix calls the sibling tool functions directly; they are closures in the same enclosing scope, so no behavior changes beyond the crash being gone.

Reproduction

from hexstrike_mcp import HexStrikeClient, setup_mcp_server
client = HexStrikeClient("http://127.0.0.1:9", timeout=2)
mcp = setup_mcp_server(client)
mcp._tool_manager.get_tool("ai_generate_attack_suite").fn(
    target_url="http://example.com", attack_types="xss")
# NameError: name 'self' is not defined

Same for comprehensive_api_audit(base_url="http://example.com").

Verification

After the change both tools execute end to end (against an unreachable server they complete gracefully, recording the failed sub-request in their results instead of raising). ruff check --select F821 is now clean for the file; the remaining self.* uses are legitimate HexStrikeClient methods.

One concern per PR: no other changes.