Implementation:0xSteph Pentest ai MCP Setup
| Knowledge Sources | |
|---|---|
| Domains | MCP, Client_Configuration, CLI |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
Concrete tool for detecting installed MCP clients and writing pentest-ai server configuration into their config files, provided by the pentest-ai CLI module.
Description
The mcp_setup module detects installed MCP clients (Claude Desktop, Cursor, VS Code Copilot) by checking for their platform-specific config directories. It can write, update, and verify the pentest-ai MCP server entry (pentest-ai mcp) into each client's config file. Supports Linux, macOS, and Windows/WSL2 paths. Used by ptai mcp setup to wire pentest-ai into a user's LLM client.
Usage
Import this module when you need to detect MCP clients or write pentest-ai server configuration. Used by the ptai mcp setup CLI command.
Code Reference
Source Location
- Repository: 0xSteph_Pentest_ai
- File: cli/mcp_setup.py
- Lines: 1-233
Signature
MCP_CLIENTS: dict[str, dict[str, Any]] # claude_desktop, cursor, vscode
def detect_installed_clients() -> list[dict[str, Any]]: ...
def write_config(client_key: str) -> dict[str, Any]: ...
def show_status() -> None: ...
def setup_interactive() -> int: ...
Import
from cli.mcp_setup import detect_installed_clients, write_config, show_status, setup_interactive
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| client_key | str | Yes | Client identifier: "claude_desktop", "cursor", "vscode" |
Outputs
| Name | Type | Description |
|---|---|---|
| detected clients | list[dict] | Clients with config directories found |
| write result | dict | Success/failure of config write with path |
Usage Examples
Detect and Configure Clients
from cli.mcp_setup import detect_installed_clients, write_config
clients = detect_installed_clients()
for c in clients:
print(f" {c['name']}: config at {c['config_path']}")
# Write pentest-ai MCP entry into Claude Desktop config
result = write_config("claude_desktop")
print(f"Config written: {result}")