A Model Context Protocol (MCP) server for pentesting tools and vulnerability assessment. This FastAPI-based server provides an API for executing various penetration testing tools with proper schema validation and logging.
This project implements an MCP server that exposes penetration testing tools as callable endpoints. It includes support for testing common web vulnerabilities based on the OWASP Top 10 2021 framework. The server provides an API for automated vulnerability assessment across multiple vulnerability categories.
This tool implements detection and testing capabilities for the following OWASP Top 10 vulnerabilities:
Note: These tools represent partial implementations of each vulnerability category. Each OWASP Top 10 vulnerability is complex and multifaceted, requiring extensive testing across multiple vectors. The current implementations focus on key indicators and common patterns. For comprehensive penetration testing, additional testing methodologies and tools should be used in conjunction with these tools.
| OWASP | Vulnerability | Tool | Status |
|---|---|---|---|
| A01:2021 | Broken Access Control | IDOR Check | β |
| A02:2021 | Cryptographic Failures | Transport Security Check | β |
| A03:2021 | Injection | SQL Injection Check | β |
| A04:2021 | Insecure Design | Business Logic Check | β |
| A05:2021 | Security Misconfiguration | Directory Enumeration | β |
| A06:2021 | Vulnerable & Outdated Components | Component Version Check | β |
| A07:2021 | Broken Authentication | Auth Logic Check | β |
| A08:2021 | Software & Data Integrity Failures | Integrity Check | β |
| A09:2021 | Security Logging & Monitoring Failures | Logging Check | β |
| A10:2021 | Server-Side Request Forgery (SSRF) | Open Redirect, HTTP Request | β |
- HTTP Method Check - Test for dangerous HTTP methods (TRACE, PUT, DELETE)
- IDOR Check - Test for Insecure Direct Object Reference vulnerabilities
- Privilege Escalation Check - Detect privilege escalation vulnerabilities
- Client Storage Check - Analyze insecure client-side storage and cookies
- Transport Security Check - Verify HTTPS enforcement and HSTS headers
- Command Injection Check - Test for OS command injection vulnerabilities
- SQL Injection Check - Test for SQL injection vulnerabilities
- XSS Check - Test for Reflected Cross-Site Scripting vulnerabilities
- Business Logic Check - Detect missing rate limits and logic flaws
- Rate Limit Check - Verify presence of rate limiting mechanisms
- Directory Enumeration - Identify exposed directories and configuration files
- Info Exposure Check - Detect information leakage (stack traces, debug mode)
- Security Headers Check - Verify presence of security headers (HSTS, CSP, etc)
- Component Version Check - Detect exposed component versions in headers
- SBOM Analysis - Analyze Software Bill of Materials for known vulnerabilities
- Auth Logic Check - Detect weak authentication mechanisms
- Password Policy Check - Verify strong password policy enforcement
- Session Fixation Check - Test for session fixation vulnerabilities
- Code Signing Check - Verify code signature presence on artifacts
- Integrity Check - Check for missing SRI attributes on external resources
- Alert Trigger - Test alerting systems by triggering noisy events
- Logging Check - Detect verbose error messages and information leakage
- HTTP Request - Safely perform HTTP GET requests to in-scope URLs
- Open Redirect - Test for Open Redirect and potential SSRF vulnerabilities
- Dummy Tool - Test tool to validate MCP server flow
π For detailed information about each tool, input/output schemas, and examples, see TOOLS_DOCUMENTATION.md
MCPpenLLM/
βββ mcp_server/
β βββ main.py # FastAPI app and tool registration
β βββ server.py # Native MCP Server implementation (FastMCP)
β βββ registry.py # Tool registry management
β βββ executor.py # Tool execution logic
β βββ validator.py # Input validation
β βββ tools/ # Security testing tools (organized by OWASP Top 10)
β β βββ README.md # Tools documentation
β β βββ dummy.py # Test tool for validation
β β βββ A01/ # Broken Access Control
β β β βββ http_method.py
β β β βββ idor_check.py
β β β βββ priv_escalation.py
β β βββ A02/ # Cryptographic Failures
β β β βββ client_storage.py
β β β βββ transport_security.py
β β βββ A03/ # Injection
β β β βββ command_injection.py
β β β βββ sqli_check.py
β β β βββ xss_check.py
β β βββ A04/ # Insecure Design
β β β βββ business_logic_check.py
β β β βββ rate_limit.py
β β βββ A05/ # Security Misconfiguration
β β β βββ dir_enum.py
β β β βββ info_exposure.py
β β β βββ security_headers.py
β β βββ A06/ # Vulnerable Components
β β β βββ component_version_check.py
β β β βββ sbom_analysis.py
β β βββ A07/ # Authentication Failures
β β β βββ auth_check.py
β β β βββ password_policy.py
β β β βββ session_fixation.py
β β βββ A08/ # Software and Data Integrity Failures
β β β βββ code_signing.py
β β β βββ integrity_check.py
β β βββ A09/ # Security Logging & Monitoring Failures
β β β βββ alert_trigger.py
β β β βββ logging_check.py
β β βββ A10/ # Server-Side Request Forgery
β β βββ http_request.py
β β βββ open_redirect.py
β βββ schemas/ # JSON schemas (organized by OWASP Top 10)
β β βββ A01/ # Broken Access Control schemas
β β βββ A02/ # Cryptographic Failures schemas
β β βββ A03/ # Injection schemas
β β βββ A04/ # Insecure Design schemas
β β βββ A05/ # Security Misconfiguration schemas
β β βββ A06/ # Vulnerable Components schemas
β β βββ A07/ # Authentication Failures schemas
β β βββ A08/ # Integrity Failures schemas
β β βββ A09/ # Logging & Monitoring schemas
β β βββ A10/ # SSRF schemas
β β βββ dummy_tool_input.json
β β βββ dummy_tool_output.json
β βββ logs/
β β βββ runs.jsonl # Event logs
β βββ utils/
β βββ logger.py # Logging utilities
βββ test_tools.py # Testing script for all tools
βββ requirements.txt # Python dependencies
βββ .gitignore # Git ignore file
βββ TOOLS_DOCUMENTATION.md # Detailed tool documentation
βββ README.md # This file
- Python 3.10+
- Virtual environment (recommended)
- Clone the repository:
git clone https://github.com/Codexhack286/MCP_server_Pentest.git
cd MCPpenLLM- Create and activate virtual environment:
python -m venv .venv
.venv\Scripts\Activate.ps1 # On Windows PowerShell
# or
source .venv/bin/activate # On macOS/Linux- Install dependencies:
pip install -r requirements.txtYou can run the project in two modes: as a standard FastAPI server (for easy testing via HTTP) or as a native MCP server.
Navigate to the mcp_server directory and start the server:
cd mcp_server
uvicorn main:app --reloadThe server will start at http://127.0.0.1:8000
Run the MCP server directly using Python:
cd mcp_server
python server.pyThis runs the FastMCP server, which handles transport for MCP clients (like Claude for Desktop).
GET /tools- List all available tools and their schemasPOST /execute- Execute a registered tool
Use the provided test script to test all tools:
python test_tools.pycurl -X POST http://127.0.0.1:8000/execute \
-H "Content-Type: application/json" \
-d '{
"tool_name": "http_request",
"arguments": {
"url": "http://localhost:8000/tools",
"headers": {"User-Agent": "MCP-Client"}
}
}'Input:
url(string, required): Target URL to requestheaders(object, optional): HTTP headers to include
Output:
status_code: HTTP response statusheaders: Response headersbody_preview: Response body (first 5000 bytes)
Input:
endpoint(string, required): Endpoint with{id}placeholderid_values(array, required): IDs to test (2-5 items)
Output:
inconsistent_access(boolean): Whether inconsistent access patterns foundevidence(array): Status codes for each tested ID
Use Case: Test if users can access resources belonging to other users by manipulating object references.
Input:
url(string, required): Target URL to evaluatecheck_hsts(boolean, optional): Check for HSTS header (default: true)timeout(integer, optional): Request timeout in seconds (default: 5)
Output:
vulnerable(boolean): Whether vulnerabilities detectedevidence(array): Detailed findings from security checks
Use Case: Verify HTTPS enforcement and presence of security headers like HSTS.
Input:
url(string, required): Target endpoint to testparam(string, required): Query parameter name to inject intopayloads(array, optional): SQL injection test payloads (max 5)
Output:
potential_injection(boolean): Whether SQL injection detectedevidence(array): Matched payloads with error signatures
Use Case: Detect SQL injection vulnerabilities by testing common payloads and looking for database error messages.
Input:
url(string, required): Base endpoint to testparam(string, required): Redirect parameter nametest_urls(array, optional): External URLs for testing (max 3)
Output:
vulnerable(boolean): Whether open redirect vulnerability detectedevidence(array): Details of redirect attempts
Use Case: Detect unvalidated redirects that could lead to phishing or SSRF attacks.
Input:
base_url(string, required): Base URL to enumeratepaths(array, optional): Custom paths to test (default: common paths)
Output:
vulnerable(boolean): Whether exposed paths foundfound(array): List of accessible directories with status codes
Use Case: Identify misconfigured or exposed directories like .git, admin, backup, etc.
Input:
login_url(string, required): Login endpoint URLusername(string, required): Test usernamepasswords(array, required): Test passwords (2-4 items)
Output:
weak_authentication(boolean): Whether weak authentication detectedevidence(array): Status codes for each login attempt
Use Case: Detect missing rate limiting or account lockout mechanisms by testing multiple login attempts.
This project currently uses FastAPI as the HTTP server wrapper for testing and validation purposes. This allows:
- Easy testing with cURL and HTTP clients
- Simple integration testing with vulnerable applications
- Clear separation of concerns (transport layer vs. business logic)
The project now includes a fully functional MCP server (mcp_server/server.py) using FastMCP. This enables:
- Direct integration with Claude for Desktop and other MCP clients
- Native tool execution
- Structured tool invocation by AI agents
- Full local execution (no external API calls)
All tool schemas are designed to be framework-agnostic:
{
"name": "tool_name",
"description": "Tool description",
"input_schema": { /* JSON Schema */ },
"output_schema": { /* JSON Schema */ }
}This means tools can be used by:
- β FastAPI HTTP endpoints (current)
- β MCP servers (future)
- β CLI tools
- β Direct Python imports
- β Container orchestrators
Phase 1 (Current): FastAPI for testing and validation
- Tools thoroughly tested against DVWA/WebGoat
- Schema structures validated
- False positive rates measured
Phase 2 (Next): MCP Server implementation
- Minimal code changes (only transport layer)
- All tool logic reused
- LLM integration ready
Phase 3 (Optional): Advanced features
- Multi-session support
- Tool result caching
- Rate limiting per LLM prompt
- Auto-generated pentesting reports
Edit validator.py to modify the ALLOWED_HOSTS set:
ALLOWED_HOSTS = {"localhost", "127.0.0.1"}Modify http_request_tool timeout in tools/http_request.py (default: 5 seconds)
Modify MAX_BODY_SIZE in tools/http_request.py (default: 5000 bytes)
This project is configured as a private repository on GitHub:
- Repository: https://github.com/Codexhack286/MCP_server_Pentest
.gitignoreexcludes virtual environments, cache files, and IDE settings
To push updates:
git add .
git commit -m "Your message"
git push origin mainSee requirements.txt for all dependencies. Main packages:
fastapi- Web frameworkuvicorn- ASGI serverpydantic- Data validationrequests- HTTP client librarymcp- Model Context Protocol SDK
Client Request
β
FastAPI Endpoint (/execute)
β
Input Validation (validator.py)
β
Tool Registry (registry.py)
β
Tool Executor (executor.py)
β
Tool Implementation (tools/*.py)
β
Result + Logging
β
Response to Client
- Determine the appropriate OWASP category (A01-A10) for your tool
- Create tool implementation in
tools/A0X/new_tool.py(where X is the category number) - Add input/output schemas in
schemas/A0X/directory - Import and register in
main.py:
# In the appropriate OWASP section
from tools.A0X.new_tool import new_tool_handler
# In the registration section
register_tool(
name="new_tool",
description="Tool description with OWASP category reference",
input_schema="new_tool_input",
output_schema="new_tool_output",
handler=new_tool_handler
)- Update
tools/README.mdto document the new tool
- A01: Broken Access Control
- A02: Cryptographic Failures
- A03: Injection
- A04: Insecure Design
- A05: Security Misconfiguration
- A06: Vulnerable and Outdated Components
- A07: Identification and Authentication Failures
- A08: Software and Data Integrity Failures
- A09: Security Logging and Monitoring Failures
- A10: Server-Side Request Forgery (SSRF)
This project is private and owned by Codexhack286.
This is a private repository. Contact the owner for access and contribution guidelines.
For issues or questions, please refer to the GitHub repository or contact the project owner.
Last Updated: February 4, 2026 - Reorganized tools and schemas into OWASP A01-A10 folder structure