PentestMCP
Provides tools for Active Directory penetration testing using NetExec, Bloodhound, Nmap, Certipy, and John the Ripper, enabling network reconnaissance, credential attacks, hash cracking, certificate services enumeration, and attack path analysis. Repository is hosted on GitHub.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PentestMCP scan the network 192.168.1.0/24 for SMB services and check signing status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PentestMCP
This is an MCP server developed as part of a 2-month summer internship. This tool gives Large Language Models the ability to use active directory penetration testing tools. The goal is to save time, have the model analyze the result for you, decide the next step and the next tool/technique to use, but most importantly (for me and for the lazy red teamers out there at least) is that it documents findings for you.
π― Overview
The server provides a unified interface to tools like NetExec (CrackMapExec), Bloodhound, john, certipy and Nmap. This is an initial version that provides decent features but will always accept more tools so if you're looking for something that is able to compromise an active directory environment from 0 to 100 that's not it and I dont think that it'll be possible without human in the loop. The MCP server was tested locally with Claude Desktop as the MCP client. It's important to note that I used Claude Desktop for Debian (I used stdio as the transport layer). For installation instructions, see: https://github.com/aaddrick/claude-desktop-debian. For now only stdio transport layer is implemented and explained below, to use HTTP/SSE it's suggested that you download the repo, change the mcp.run() function in server.py to implement HTTP/SSE and change the mcp configuration file to fetch the target ip and port
Related MCP server: RedTeam MCP
π οΈ Requirements
The MCP server was developed using the amazing FastMCP: https://github.com/jlowin/fastmcp
Core Dependencies
Python 3.10+ with UV package manager
NetExec (successor to CrackMapExec)
Bloodhound Community Edition
Nmap
Certipy
psudohash https://github.com/t3l3machus/psudohash for password list generation ( included in the package, you dont have to download it )
john
π¦ Installation
1. Install the MCP server
Using PIP
pip install pentestmcp
By cloning the repo
git clone https://github.com/YoussefSahnoun/PentestMCP.git
cd PentestMCP
pip install -e .
2. Install Required Tools
NetExec
# Via pipx (recommended)
pipx install netexec
# Or via pip
pip install netexecBloodhound Community Edition
# Download from official releases
wget https://github.com/SpecterOps/BloodHound/releases/latest/bloodhound-linux-x64.zip
unzip bloodhound-linux-x64.zip
# Follow BloodHound setup instructionsNmap
# Ubuntu/Debian
sudo apt install nmap
# CentOS/RHEL
sudo yum install nmapCertipy
pip install certipy-adJohn
https://github.com/openwall/john/blob/bleeding-jumbo/doc/INSTALL
3. Configure MCP Client
For Claude Desktop
Add to your ~/.config/claude-desktop/config.json:
{
"mcpServers": {
"pentestmcp": {
"command": "uv",
"args": ["run", "pentestmcp"]
}
}
}For Other MCP Clients
Configure according to your client's documentation, pointing to pentestmcp as the command.
π Usage Examples
Before you run your MCP client:
Start bloodhound
Visit
~/.local/lib/python3.13/site-packages/pentestmcp/config/(typical path on linux) to your configureconfig.json(bloodhound api creds, prject directory to save findings in, etc.){ "PROJECT_DIRECTORY": "add_absolute_path_for_your_project_directory", "BHE_DOMAIN": "127.0.0.1", "BHE_PORT": 8080, "BHE_TOKEN_ID": "", "BHE_TOKEN_KEY": "" }
Example Workflow
Start with Network Discovery
"Scan the network 192.168.1.0/24 for SMB services and check signing status"Enumerate Users
"Find all users in the domain at 192.168.1.10"Credential Attacks
"Try password spraying with common passwords against the discovered users"Bloodhound Analysis
"Collect Bloodhound data ingest it, upload zip to bloodhound and find attack paths to Domain Admins"π§ Available Tools
πΊοΈ Nmap (Network Reconnaissance)
run_nmap_scan: Network and service discovery with customizable flags
β‘ NetExec (SMB/LDAP Operations)
SMB Enumeration & Authentication:
check_SMB_signing: Check SMB signing configurationenumerate_domain_users: Discover Active Directory usersbruteforce_rid_users: RID cycling for user enumerationpassword_spray: Multi-target password attacks
Kerberos Attacks:
ASREPRoast: Extract AS-REP hashes for offline crackingkerberoast: Extract TGS tickets for service accounts
Post-Exploitation:
spider_smb_shares: Comprehensive share enumeration and file collectiondump_ntds_dit: Extract domain credential database (NTDS.dit)dump_sam_hashes: Local account hash extractioncommand_execution: Remote PowerShell command execution
Bloodhound Data Collection:
bloodhound_ingest: Collect AD data using NetExec's BloodHound module
Module System:
check_module: List available NetExec modules for protocols (SMB, LDAP, WinRM, etc.)check_options: View module-specific options and parametersuse_module: Execute NetExec modules with custom options
π©Έ Bloodhound (Attack Path Analysis)
test_bloodhound_connection: Verify API connectivity and versionupload_zip_to_bloodhound: Import collected data into Bloodhoundlist_saved_queries: View saved Cypher queriesrun_bloodhound_query: Execute custom Cypher queries for attack path discovery
π John the Ripper (Hash Cracking)
get_john_formats: List available hash formats for crackingjohn_the_ripper: Crack hashes with specified format and wordlist
ποΈ Certipy (Certificate Services)
certipy_scan: Enumerate AD CS vulnerabilities and misconfigurations
π Utility & Data Management
save_partial_finding: Organize and store assessment resultsget_project_directory_files: View files in current project directoryread_files: Access collected data and configuration filesgenerate_pwd_wordlist: Create custom password wordlists based on target information
π§ Available Resources
Custom Bloodhound Queries: Some custom bloodhound queries that you can include as a resource to your MCP client. Note that you can add any resources you want just follow this resource:
@mcp.resource("data://bloodhound_cypher_queries")
def get_custom_queries():
# Resolve path relative to this script (safer than relying on current working dir)
p = Path(__file__).parent / "custom_bloodhound_queries.json"
# use 'encoding' (not 'encode') and json.load for file -> python object (if your data isn't json load it normally)
with p.open("r", encoding="utf-8") as f:
return json.load(f)
π Security Considerations
Responsible Use
This tool is intended for authorized security assessments only
Ensure proper authorization before testing any systems
Follow responsible disclosure practices for discovered vulnerabilities
Troubleshooting
Common Issues
Clock Skew Errors:
# Sync time with domain controller (requires root)
sudo ntpdate domain-controller.local
Permission Errors:
Ensure NetExec has appropriate permissions
Check that output directories are writable
Verify Bloodhound API credentials
## π€ Contributing
### Adding New Tools
1. Create a new tool function following the MCP pattern
2. Add appropriate input validation
3. Update documentation and examples
Available Tools
26 toolsASREPRoastC
Retrieve the Kerberos 5 AS-REP etype 23 hash of users without or with Kerberos pre-authentication required
Inputs: ips (required), usernames (required), passwords (required).
bloodhound_ingestC
use the netexec's bloodhound feature to extract the json data to be uploaded to bloodhound database
Inputs: ips (required), username (required), password (required), ntlm, +1 more.
bruteforce_rid_usersC
Bruteforce rid to enumerate users
Inputs: ips (required).
certipy_scanC
Call this to enumerating Active Directory Certificate Services (AD CS) vulnerabilities. username syntax is: username@domain
Inputs: ip (required), username (required), password (required), ntlm, +1 more.
check_moduleC
Call this before before using a module to check available exploit modules for a certain netexec supported protocol {rdp,ldap,winrm,smb,ssh,nfs,ftp,wmi,mssql,vnc} and based on the description of the modules chose one to perform
Inputs: prot (required).
check_optionsC
After selecting the right module call this to check what options that module presents
Inputs: prot (required), module (required).
check_SMB_signingC
used to check smb signgings of an ip address or some range of ip addresses with the needed options
Inputs: ips (required).
command_executionC
execute powershell commands if we have pwned the user, possible to use ntlm or password for authentication
Inputs: ips (required), username (required), password (required), command (required), +2 more.
dump_ntds_ditC
dump NTdS.dit which contains users and their hashes if we have some valid credentials
Inputs: ips (required), username (required), password (required), ntlm, +1 more.
dump_sam_hashesC
dump sam hashes if we have some redentials using the sec dump which is similar to secretdump,use ntlm hash or normal password
Inputs: ips (required), username (required), password (required), ntlm, +1 more.
enumerate_domain_usersC
enumerate users on an active directory domain, you can provide username or password if you have some
Inputs: ips (required), username, password.
generate_pwd_wordlistC
generate some password wordlist based on initial input of word(s), let this be the last resort if no other wordlist worked
Inputs: inp (required).
get_john_formatsC
check available john format before cracking a hash
Inputs: no named parameters.
get_project_directory_filesC
read existing files from the project directory to see what findings and data have been saved
Inputs: no named parameters.
john_the_ripperC
cracking hashes using john based on format and a wordlist
Inputs: hashfile (required), format (required), wordlist.
KerberoastD
The goal of Kerberoasting is to harvest TGS tickets for services that run on behalf of user accounts in the AD, not computer accounts. Thus, part of these TGS tickets is encrypted with keys derived from user passwords. As a consequence, their credentials could be cracked offline.
Inputs: ips (required), usernames (required), passwords (required), output_file (required).
list_saved_quereisB
list already saved queries in bloodhound
Inputs: no named parameters.
password_sprayD
spray passwords on an account or several accounts
Inputs: ips (required), usernames (required), passwords (required), onelogin.
read_filesD
read a file
Inputs: path (required).
run_blooodhound_queryB
Run a bloodhound cypher query of your choice (use this to collect information about the network and potentially identify attack vectors)
Inputs: query (required).
run_nmap_scanC
run an nmap scan on an ip or ip range (use the right nmap flags based on the first response)
Inputs: ips (required), flags (required).
save_partial_findingB
save partial findings for later use (like open ports, used protocols, versions etc.) if finding data is too long or already exists in another file dont save it
Inputs: filename (required), content (required).
test_bloodhound_connectionB
connect to bloodhoundapi and get version
Inputs: no named parameters.
upload_zip_to_bloodhoundB
Upload data zip to bloodhound to ingest and analyze (wait until it gets ingested before testing queries)
Inputs: zip_path (required).
use_moduleC
Call this to use the module with the right options and make sure to satisfy the need of certain variables like credentials etc.If no credentials are needed for the module or no valid credentials are found leave the username and password default (empty). Options syntax is ["option1=value1","options2=value2",...]
Inputs: ips (required), prot (required), module (required), options (required), +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 26 tools
The tools cover distinct pentesting tasks like ASREPRoast, Kerberoast, and nmap scanning, but there is significant overlap between some tools. For example, dump_ntds_dit and dump_sam_hashes both handle credential dumping with similar descriptions, and check_module/check_options/use_module form a confusing workflow that could lead to misselection. Descriptions help clarify, but the boundaries are not always clear.
Naming is highly inconsistent with mixed conventions: some use snake_case (bloodhound_ingest), others use camelCase (ASREPRoast), and some are verbose (get_project_directory_files). There is no predictable pattern across the set, making it hard for agents to infer tool purposes from names alone. This inconsistency reduces usability and coherence.
With 26 tools, the count is excessive for a single server, leading to a bloated and overwhelming interface. Many tools could be consolidated (e.g., the multiple hash-dumping and module-checking tools). This heavy toolset will likely confuse agents and increase the risk of misselection, detracting from the server's effectiveness.
The toolset provides comprehensive coverage for pentesting workflows, including reconnaissance (nmap scans), exploitation (module usage), credential attacks (ASREPRoast, Kerberoast), and data analysis (Bloodhound integration). Minor gaps exist, such as lacking tools for post-exploitation cleanup or reporting, but agents can work around these with the available tools for most attack scenarios.
Maintenance
Related MCP Connectors
Offline methodology engine for authorized penetration testing, CTF, and security research.
AI pentesting: run scans, triage vulnerabilities, review PRs, manage schedules and assets.
30 security tools for AI agents: phishing links, exposure maps, DNS, SSL, PQC, history, pivots.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Active Directory enumeration and abuse operations through the bloodyAD tool. Supports LDAP queries, user/group management, DNS operations, and security testing directly from AI assistants.15MIT
- FlicenseNot gradedqualityDmaintenanceAutonomous penetration testing powered by a local LLM, automating tool chaining for recon, vulnerability scanning, exploit research, and reporting.1-
- FlicenseBqualityCmaintenanceEnables LLMs to perform automated penetration testing and Active Directory reconnaissance through Mythic, with tools for executing PowerShell, AD recon, domain user enumeration, and Kerberoasting.121-
- AlicenseCqualityDmaintenanceEnables AI agents to orchestrate 25+ security tools for penetration testing through natural language, automating scans, vulnerability detection, and report generation.31MIT