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 MCP Client

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

Overview

Concrete tool for loading external MCP servers as additional tool sources via a config file, provided by the pentest-ai engine.

Description

The mcp_client module lets pentest-ai consume tools from other Model Context Protocol servers the same way Claude Desktop / VS Code does. External MCP tools become just another category in the registry, available to the agents. Configuration lives at ~/.pentest-ai/mcp_servers.json with servers declaring name, command/url, and transport (stdio or sse). CLI integration: ptai mcp-client add/list/remove/tools.

Usage

Import this module when you need to manage external MCP server configurations. Used by the CLI commands ptai mcp-client.

Code Reference

Source Location

Signature

@dataclass(frozen=True)
class MCPServerConfig:
    name: str
    command: str
    transport: str  # "stdio" or "sse"

def load_servers(path: Path | None = None) -> list[MCPServerConfig]: ...
def save_servers(servers: list[MCPServerConfig], path: Path | None = None) -> None: ...
def add_server(name: str, command: str, transport: str = "stdio") -> None: ...
def remove_server(name: str) -> None: ...
def list_servers() -> list[MCPServerConfig]: ...

Import

from engine.mcp_client import MCPServerConfig, load_servers, save_servers, add_server, remove_server, list_servers

I/O Contract

Inputs

Name Type Required Description
name str Yes Server name
command str Yes Command (stdio) or URL (sse)
transport str No "stdio" or "sse" (default: "stdio")

Outputs

Name Type Description
servers list[MCPServerConfig] Configured external MCP servers

Usage Examples

Add and List External MCP Servers

from engine.mcp_client import add_server, list_servers

add_server("hexstrike", "python3 hexstrike_mcp.py", transport="stdio")
add_server("third-party", "http://localhost:9000/mcp", transport="sse")

for s in list_servers():
    print(f"  {s.name}: {s.command} ({s.transport})")

Related Pages

Page Connections

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