Resources & Tools
Security Testing Tools
๐งช Vulnerable MCP Server
Intentionally vulnerable server for security testing and research
๐ MCP Scanner
Automated security scanning tools for MCP implementations
๐ Security Analyzer
Comprehensive security analysis and reporting tools
๐ security-tools.md
Security Tools for MCP
Static Analysis Tools
Code Scanners
- Bandit: Python security scanner
- Semgrep: Multi-language static analysis
- CodeQL: Semantic code analysis
- SonarQube: Code quality and security
Dependency Scanners
# Check for vulnerable dependencies
npm audit
pip-audit
safety check
Dynamic Analysis Tools
Web Application Scanners
- OWASP ZAP: Web app security scanner
- Burp Suite: Professional web security testing
- Nuclei: Fast vulnerability scanner
API Security Testing
# Example using OWASP ZAP
zap-baseline.py -t http://localhost:8000/api
MCP-Specific Tools
Custom Security Scanner
A comprehensive Python-based scanner for MCP implementations:
#!/usr/bin/env python3
"""
MCP Security Scanner
Scans MCP servers for common vulnerabilities
"""
class MCPScanner:
def __init__(self, target_url):
self.target_url = target_url
self.session = requests.Session()
def scan_sql_injection(self):
"""Test for SQL injection vulnerabilities"""
payloads = [
"'; DROP TABLE users; --",
"' OR '1'='1",
"' UNION SELECT NULL--"
]
# Implementation details...
def scan_command_injection(self):
"""Test for command injection vulnerabilities"""
# Implementation details...
def scan_authentication_bypass(self):
"""Test for authentication bypass"""
# Implementation details...
Container Security
Docker Security Scanning
# Scan container images
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
aquasec/trivy image your-mcp-server:latest
# Use docker-bench-security
git clone https://github.com/docker/docker-bench-security.git
cd docker-bench-security
sudo sh docker-bench-security.sh
Network Security Tools
TLS/SSL Testing
# Test SSL configuration
sslyze --regular your-mcp-server.com:443
# Use testssl.sh
testssl.sh https://your-mcp-server.com
Network Scanning
# Port scanning with nmap
nmap -sV -sC your-mcp-server.com
# Service discovery
nmap -sU -sS your-mcp-server.com
CI/CD Integration
Automated Security Testing
# .github/workflows/security.yml
name: Security Scan
on: [push, pull_request]
jobs:
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Bandit Security Scan
run: |
pip install bandit
bandit -r . -f json -o bandit-report.json
- name: Run Safety Check
run: |
pip install safety
safety check --json --output safety-report.json
Monitoring and Logging
Security Event Monitoring
# Example: Send security events to SIEM
def send_security_event(event_type, details):
event = {
"timestamp": "2024-01-01T00:00:00Z",
"source": "mcp-server",
"event_type": event_type,
"details": details,
"severity": get_severity(event_type)
}
# Send to SIEM/SOAR platform
requests.post(
"https://your-siem.com/api/events",
headers={"Authorization": "Bearer TOKEN"},
json=event
)