A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
This pattern describes how to implement a Model Context Protocol (MCP) server that integrates three industry-standard se
This pattern describes how to implement a Model Context Protocol (MCP) server that integrates four industry-standard security scanning tools (Checkov, Semgrep, Bandit, and ASH) to provide comprehensive code security analysis. The server enables AI coding assistants to automatically scan code snippets and Infrastructure as Code (IaC) configurations for security vulnerabilities, misconfigurations, and compliance violations.
The solution combines Checkov for scanning IaC files (including Terraform, CloudFormation, and Kubernetes manifests), Semgrep for analyzing multiple programming languages (such as Python, JavaScript, Java, and others), Bandit for specialized Python security scanning, and ASH (Automated Security Helper) for comprehensive multi-tool scanning with aggregated results.
It provides a unified interface for security scanning with standardized response formats, making it easier to integrate security checks into development workflows. The pattern uses Python and the MCP framework to deliver automated security feedback, helping developers identify and address security issues early in the development process while learning about security best practices through detailed findings.
This pattern is particularly valuable for organizations looking to enhance their development security practices through AI-assisted coding tools, providing continuous security scanning capabilities across multiple programming languages and infrastructure definitions.
Key features:
Try these sample prompts with your AI assistant:

Try these sample prompts to generate secure code:


This MCP server enables AI assistants to perform comprehensive security analysis on code snippets using four powerful security scanning tools:
scan_with_semgrep tool.grype/, .checkov/, .bandit/, .semgrep/, .ash/, .sbom/, .trivy/return_output=True parameter to get full results insteadNote: The following instructions are for macOS/Linux. For Windows and other code assistants, see the AWS MCP Repository README for platform-specific instructions.
This MCP server is not available via PyPI for enhanced security and control:
You can install this server using one of two methods:
Clone or download the repository locally:
git clone git@github.com:aws-samples/sample-mcp-security-scanner.git
cd sample-mcp-security-scanner
Then configure your MCP client to use the local path (see configuration examples below).
Configure your MCP client to install directly from GitHub using:
git+https://github.com/aws-samples/sample-mcp-security-scanner.git@main
This method automatically downloads and installs the server without requiring a local clone (see configuration examples below).
The server automatically installs:
checkov>=3.0.0 - IaC security scannersemgrep>=1.45.0 - Source code security scannerbandit>=1.7.5 - Python security scannermcp[cli]>=1.11.0 - MCP frameworkpydantic>=1.10.0 - Data validationloguru>=0.6.0 - LoggingFor comprehensive multi-tool scanning with ASH (Automated Security Helper):
# Install ASH using uvx (recommended)
uvx git+https://github.com/awslabs/automated-security-helper.git@v3.2.5
# Or install with pip
pip install git+https://github.com/awslabs/automated-security-helper.git@v3.2.5
# Or install with pipx (isolated environment)
pipx install git+https://github.com/awslabs/automated-security-helper.git@v3.2.5
# Verify installation
ash --version
ASH provides additional scanners beyond the core three:
Note: ASH requires Python 3.10+ and uses UV for package management. Some scanners may require additional dependencies (see ASH documentation).
Configure your MCP client to use the server. The configuration varies by client and supports both local path and GitHub installation methods.
See Kiro Model Context Protocol Documentation for details.
Kiro > MCP ServersOpen MCP Config button.Replace /path/to/sample-mcp-security-scanner with your actual repository path:
.kiro/settings/mcp.json (local) or ~/.kiro/settings/mcp.json (global){
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"/path/to/sample-mcp-security-scanner",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000,
"disabled": false,
"autoApprove": []
}
}
}
{
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/aws-samples/sample-mcp-security-scanner.git@main",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000,
"disabled": false,
"autoApprove": []
}
}
}
See Amazon Q Developer documentation for details.
~/.aws/amazonq/mcp.json (global) or .amazonq/mcp.json (local).Replace /path/to/sample-mcp-security-scanner with your actual repository path:
~/.aws/amazonq/mcp.json{
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"/path/to/sample-mcp-security-scanner",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000
}
}
}
{
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/aws-samples/sample-mcp-security-scanner.git@main",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000
}
}
}
cline_mcp_settings.json file.Replace /path/to/sample-mcp-security-scanner with your actual repository path:
cline_mcp_settings.json{
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"/path/to/sample-mcp-security-scanner",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000,
"disabled": false,
"autoApprove": []
}
}
}
{
"mcpServers": {
"security-scanner": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/aws-samples/sample-mcp-security-scanner.git@main",
"security_scanner_mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR",
"WORKSPACE_ROOT": "/path/to/your/workspace"
},
"timeout": 120000,
"disabled": false,
"autoApprove": []
}
}
}
For configuration instructions for Cursor, Windsurf, VS Code, Claude Desktop, and other MCP clients, see the AWS MCP Repository README.
scan_with_checkovScan Infrastructure as Code files for security issues.
Parameters:
code (string): IaC content to scanformat_type (string): Format type (terraform, cloudformation, kubernetes, dockerfile, etc.)scan_with_semgrepScan source code for security vulnerabilities.
Parameters:
code (string): Source code content to scanlanguage (string): Programming language (python, javascript, java, etc.)scan_with_banditScan Python code for security issues (Python-specific).
Parameters:
code (string): Python code content to scanscan_with_ashScan code using ASH for comprehensive multi-tool security analysis.
Parameters:
code (string): Code content to scanfile_extension (string): File extension (e.g., .py, .tf, .js, Dockerfile)severity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMFeatures:
scan_with_trivyScan Infrastructure as Code or Dockerfile using Trivy for security issues.
Parameters:
code (string): Code content to scan (Dockerfile or IaC config)scan_type (string, optional): Type of scan (dockerfile, terraform, kubernetes, config). Default: dockerfilecheck_ash_availabilityCheck if ASH is installed and available, including which individual scanners are available.
Returns: Installation status, version information, scanner availability details, and a formatted report
Example Response:
{
"success": true,
"available": true,
"version": "3.2.1",
"message": "ASH is installed and available: 3.2.1",
"scanner_summary": {
"available": 6,
"total": 9,
"unavailable": 3
},
"formatted_report": "ASH Status: ✅ Installed (version 3.2.1)\nScanner Availability: 6 out of 9 scanners available\n\n✅ Available Scanners:\n • Bandit - Python security linter (python-based)\n • Semgrep - Multi-language SAST (python-based)\n • Checkov - IaC security scanner (python-based)\n • cdk-nag - AWS CDK security scanner (npm-based)\n • detect-secrets - Secret detection (python-based)\n • npm-audit - Node.js dependency scanner (npm-based)\n\n❌ Missing Scanners:\n • cfn-nag - CloudFormation security scanner (ruby-based)\n Install with: gem install cfn-nag\n • Grype - Vulnerability scanner (binary)\n Install with: Install Grype from official source\n • Syft - SBOM generator (binary)\n Install with: Install Syft from official source\n\nThe tool successfully shows which scanners are available and which ones need additional OS-level dependencies.",
"scanners": {
"bandit": {
"name": "Bandit",
"description": "Python security linter",
"available": true,
"dependency_type": "python",
"file_types": [".py"],
"status": "installed"
},
"semgrep": {
"name": "Semgrep",
"description": "Multi-language SAST",
"available": true,
"dependency_type": "python",
"file_types": [".py", ".js", ".ts", ".java", ".go", ".rb", ".php"],
"status": "installed"
},
"checkov": {
"name": "Checkov",
"description": "IaC security scanner",
"available": true,
"dependency_type": "python",
"file_types": [".tf", ".yaml", ".yml", ".json", "Dockerfile"],
"status": "installed"
},
"cfn-nag": {
"name": "cfn-nag",
"description": "CloudFormation security scanner",
"available": false,
"dependency_type": "ruby",
"file_types": [".yaml", ".yml", ".json", ".template"],
"status": "not installed",
"install_hint": "gem install cfn-nag"
},
"cdk-nag": {
"name": "cdk-nag",
"description": "AWS CDK security scanner",
"available": true,
"dependency_type": "npm",
"file_types": [".ts", ".js"],
"status": "installed"
},
"detect-secrets": {
"name": "detect-secrets",
"description": "Secret detection",
"available": true,
"dependency_type": "python",
"file_types": ["*"],
"status": "installed"
},
"grype": {
"name": "Grype",
"description": "Vulnerability scanner",
"available": false,
"dependency_type": "binary",
"file_types": ["*"],
"status": "not installed",
"install_hint": "Install Grype from official source"
},
"syft": {
"name": "Syft",
"description": "SBOM generator",
"available": false,
"dependency_type": "binary",
"file_types": ["*"],
"status": "not installed",
"install_hint": "Install Syft from official source"
},
"npm-audit": {
"name": "npm-audit",
"description": "Node.js dependency scanner",
"available": true,
"dependency_type": "npm",
"file_types": ["package.json", "package-lock.json"],
"status": "installed"
}
}
}
Formatted Report Output:
When you call this tool, the AI assistant will display the formatted_report field which provides a clean, readable summary:
ASH Status: ✅ Installed (version 3.2.1)
Scanner Availability: 6 out of 9 scanners available
✅ Available Scanners:
• Bandit - Python security linter (python-based)
• Semgrep - Multi-language SAST (python-based) (disabled in ASH - use standalone scan_with_semgrep tool)
• Checkov - IaC security scanner (python-based)
• cdk-nag - AWS CDK security scanner (npm-based)
• detect-secrets - Secret detection (python-based)
• npm-audit - Node.js dependency scanner (npm-based)
❌ Missing Scanners:
• cfn-nag - CloudFormation security scanner (ruby-based)
Install with: gem install cfn-nag
• Grype - Vulnerability scanner (binary)
Install with: Install Grype from official source
• Syft - SBOM generator (binary)
Install with: Install Syft from official source
The tool successfully shows which scanners are available and which ones need additional OS-level dependencies.
Note: Semgrep is excluded from ASH scans to avoid duplication with the standalone scan_with_semgrep tool, which provides more focused and faster scanning.
Use this tool to:
get_supported_formatsGet information about supported formats and languages for all tools.
generate_security_reportGenerate a SECURITY.md report from scan results.
Parameters:
project_name (string): Name of the project being analyzedscan_results (string): JSON string with scan results from any scanning tool. Can be a single result object or an array of result objects.Workflow:
generate_security_report with project_name and scan_results (JSON string)report field as SECURITY.mdReport includes:
The following tools scan entire project directories and save results to files by default to prevent context window overflow:
scan_directory_with_grypeScan a project directory for dependency vulnerabilities.
Parameters:
directory_path (string): Path to the directory to scanseverity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .grype/grype_scan_{directory}_{timestamp}.json and returns summary
scan_directory_with_checkovScan a project directory for IaC security issues.
Parameters:
directory_path (string): Path to the directory to scanseverity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .checkov/checkov_scan_{directory}_{timestamp}.json and returns summary
scan_directory_with_banditScan a project directory for Python security issues.
Parameters:
directory_path (string): Path to the directory to scanseverity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .bandit/bandit_scan_{directory}_{timestamp}.json and returns summary
scan_directory_with_semgrepScan a project directory for source code security issues.
Parameters:
directory_path (string): Path to the directory to scanseverity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .semgrep/semgrep_scan_{directory}_{timestamp}.json and returns summary
scan_directory_with_ashScan a project directory with ASH for comprehensive multi-tool security analysis.
Parameters:
directory_path (string): Path to the directory to scanseverity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .ash/ash_scan_{directory}_{timestamp}.json and returns summary
scan_directory_with_syftGenerate Software Bill of Materials (SBOM) for a project directory.
Parameters:
directory_path (string): Path to the directory to scanoutput_format (string, optional): Output format (json, cyclonedx-json, spdx-json, table). Default: jsonsave_sbom (bool, optional): Save full SBOM to file. Default: False (only returns summary)Output: Saves to .sbom/sbom_{directory}_{timestamp}.{extension} and returns summary
scan_image_with_trivyScan a container image for vulnerabilities.
Parameters:
image_name (string): Container image to scan (e.g., nginx:latest, python:3.9)severity_threshold (string, optional): Minimum severity threshold (LOW, MEDIUM, HIGH, CRITICAL). Default: MEDIUMreturn_output (bool, optional): Return full output instead of saving to file. Default: FalseOutput: Saves to .trivy/trivy_scan_{image}_{timestamp}.json and returns summary
Note: All directory scanning tools automatically save full results to dedicated folders and return lightweight summaries. Use return_output=True to get full results in the response instead. See SCANNER_FILE_OUTPUT.md for more details.
All scanning tools return a consistent response format:
{
"success": true,
"tool": "checkov|semgrep|bandit|ash",
"format_type": "terraform",
"language": "python",
"total_issues": 3,
"findings": [
{
"check_id": "CKV_AWS_20",
"severity": "HIGH",
"description": "S3 Bucket has an ACL defined which allows public access",
"line_number": 3,
"resource": "aws_s3_bucket.example"
}
],
"summary": {
"high": 1,
"medium": 2,
"low": 0
}
}
This MCP server is designed to work with AI coding assistants like Kiro, Amazon Q Developer, Cline and others. The AI can:
This repository is also packaged as a Kiro Power — a plug-and-play capability bundle that includes the MCP server, steering files, and documentation. Installing the power gives Kiro automatic access to all scanning tools without manual MCP configuration.
sample-mcp-security-scanner/
├── POWER.md # Power metadata and documentation (repo root)
├── mcp.json # Pre-configured MCP server (auto-approve all tools)
├── steering/
│ ├── scanning-workflows.md # Auto-included: scanner selection, scan-fix-rescan loop, report generation
│ └── secure-coding.md # Auto-included: application, infrastructure, and dependency security rules
├── security_scanner_mcp_server/ # MCP server source code
├── agents/ # Pre-built Kiro agent configs
├── hooks/ # Kiro hook definitions
├── tests/ # Test suite
└── docs/ # Documentation, examples, and assets
mcp.json — Pre-configured MCP server definition with all scanning tools auto-approved. Kiro automatically starts the security scanner server when the power is installed.scanning-workflows.md (auto-included steering) — Guides Kiro to pick the right scanner for each file type, run scan-fix-rescan loops, and generate SECURITY.md reports.secure-coding.md (auto-included steering) — Instructs Kiro to proactively apply secure coding practices when generating or reviewing code (input validation, parameterized queries, no hardcoded secrets, strong crypto, least-privilege IAM, etc.).https://github.com/aws-samples/sample-mcp-security-scanner
The power auto-configures the MCP server and steering files — no manual setup needed.
Once installed, Kiro automatically applies the steering rules in every conversation. You can use prompts like:
Kiro will automatically select the right scanner based on file type, apply secure coding practices, and follow the scan-fix-rescan workflow.
This repository includes a pre-built Kiro agent that uses the MCP Security Scanner to provide security-first coding assistance.
| Feature | Description |
|---|---|
| Auto-scan | Scans every code change with Semgrep, Bandit, or Checkov |
| Fix loop | Finds vulnerabilities → fixes them → re-scans until clean |
| SECURITY.md | Generates structured reports with STRIDE threat model |
| Secure by default | Applies security best practices when generating code |
| Compliance hints | Flags SOC2, PCI-DSS, HIPAA, GDPR relevant patterns |
# Global (all projects)
cp agents/sec-lazio/sec-lazio.json ~/.kiro/agents/
# Or project-specific
mkdir -p .kiro/agents
cp agents/sec-lazio/sec-lazio.json .kiro/agents/
/agent sec-lazio
Or use the keyboard shortcut: Ctrl+Shift+S
See agents/README.md for full documentation and example prompts.
Use the right scanner for the job:
| File type | Primary scanner | Secondary scanner |
|---|---|---|
| Python (.py) | scan_with_bandit | scan_with_semgrep |
| JavaScript (.js), TypeScript (.ts) | scan_with_semgrep | — |
| Java, Go, Rust, Kotlin, C# | scan_with_semgrep | — |
| Terraform (.tf, .tfvars) | scan_with_checkov | — |
| CloudFormation (.yaml, .yml, .json) | scan_with_checkov | — |
| Kubernetes manifests | scan_with_checkov | — |
| Dockerfile | scan_with_checkov | scan_with_trivy |
| Container images | scan_image_with_trivy | — |
| Dependency manifests | scan_directory_with_grype | — |
| Full project | scan_directory_with_* variants | — |
For Python files, run both Bandit and Semgrep — they catch different classes of issues.
| Severity | Action |
|---|---|
| CRITICAL | Must be fixed before deployment — block the release |
| HIGH | Fix in the current sprint — these are exploitable vulnerabilities |
| MEDIUM | Triage and plan — fix in the next sprint or accept with justification |
| LOW | Backlog — review for risk acceptance or opportunistic fix |
# Clone and install
git clone git@github.com:aws-samples/sample-mcp-security-scanner.git
cd sample-mcp-security-scanner
uv pip install -e .
# Run the server
python -m security_scanner_mcp_server.server
The project includes several test scripts to verify functionality:
# Test all scanners (Checkov, Semgrep, Bandit, ASH)
python tests/test_scanner.py
This script tests:
# Test ASH availability and scanning
python tests/test_ash_integration.py
This script tests:
# Test scanners without MCP dependencies
python tests/simple_test.py
This script tests:
# Verify ASH module can be imported
python test_ash_import.py
This script verifies:
The project includes sample Kiro hooks in the hooks/ directory that demonstrate automated security scanning workflows. These hooks can be installed in your Kiro IDE to enable automatic security scanning.
File: hooks/security-scan-on-save.kiro.hook
This hook automatically scans files when saved and offers to fix security issues:
Features:
Supported File Types:
.py, .js, .ts, .java, .go, .c, .cpp, .cs, .rb, .php, .scala, .kt, .rs.tf, .tfvars, .yaml, .yml, .json, .bicep, Dockerfile*File: hooks/security-scan-report-on-save.kiro.hook
This hook scans all open editor files and provides a security report without modifying code:
Features:
Use Cases:
Copy hooks to your project:
# Copy to workspace-level hooks (project-specific)
cp hooks/*.kiro.hook .kiro/hooks/
# Or copy to user-level hooks (global)
cp hooks/*.kiro.hook ~/.kiro/hooks/
Enable hooks in Kiro:
Customize hooks:
.kiro.hook files to adjust file patternsNote: Hooks require the security-scanner MCP server to be configured and running in Kiro.
| Issue | Solution |
|---|---|
| Environment setup issues | Verify Python 3.10+ is installed. Ensure uv package manager is installed. |
| Scanner issues | Verify file formats are supported. Check file syntax is valid. Ensure proper file extensions are used. |
| Integration problems | Verify the MCP server is running. Check the configuration file is correct. Validate API endpoints. |
| ASH not available | Install ASH using uvx git+https://github.com/awslabs/automated-security-helper.git@v3.2.5 |
| Trivy not found | macOS: brew install trivy. Linux: see Trivy installation. |
To enable debug logging, set "FASTMCP_LOG_LEVEL" to "DEBUG" in your MCP configuration.
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Pattern created by Ivan Girardi (AWS) and Iker Reina Fuente (AWS).
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
MCP server integration for DaVinci Resolve Studio
A Jetbrains IDE IntelliJ plugin aimed to provide coding agents the ability to leverage intelliJ's indexing of the codeba