A standard MCP server for SAST tools (Bandit, njsscan, Bearer, Semgrep, Trivy, CodeQL, Checkov, Gitleaks, OSV-Scanner, ZAP) โ scan code for security vulnerabilities from any AI agent
Project description
SAST MCP Server
Static Application Security Testing (SAST) for AI agents. A production-ready MCP server that gives any AI agent the ability to scan code for security vulnerabilities.
Supports 10 industry-standard scanners:
| Scanner | Languages / Scope | Type |
|---|---|---|
| Bandit | Python | Security linter |
| njsscan | JavaScript, Node.js | Static analysis |
| Bearer | Python, JS, Ruby, Java, Go, PHP | Data-flow SAST |
| Semgrep | 30+ languages | Rule-based SAST |
| Trivy | All (CVEs, Secrets, IaC) | Multi-scanner |
| CodeQL | Python, JS, Java, Go, C/C++, C#, Ruby, Swift | Semantic SAST |
| Checkov | Terraform, K8s, Docker, CloudFormation | IaC policy scanner |
| Gitleaks | All (.git history) | Deep secret scanning |
| OSV-Scanner | Multiple (lockfiles, sboms) | SCA |
| OWASP ZAP | RUNTIME | Dynamic (DAST) via Docker |
Works with any MCP-compatible agent: Gemini CLI, Claude Desktop, OpenAI Agents, Cursor, Windsurf, and more.
Features
- ๐ 10 SAST/SCA/DAST scanners with a unified output format
- ๐ณ AST-aware context โ shows the full enclosing function, not just a line number
- ๐ Severity & confidence filtering โ focus on what matters
- ๐ Git diff mode โ scan only modified files for incremental reviews
- ๐ Ignore management โ suppress false positives with audit trail
- ๐ Pagination โ handle large codebases without overwhelming the agent
- ๐ Dual transport โ stdio (local) or Streamable HTTP (remote deployments)
- ๐ JWT & API key authentication โ secure remote deployments
- ๐ฆ One command install โ
pip install sast-mcp-server - ๐ Multi-scanner mode โ run all installed scanners in parallel with deduplication
- ๐ SARIF export โ CI/CD integration with GitHub, GitLab, Azure DevOps
- ๐๏ธ IaC scanning โ Terraform, Kubernetes, Docker security policies
- ๐ Secret detection โ find hardcoded API keys, tokens, and passwords in code and git history
- ๐ฆ SCA / dependency CVEs โ scan lock files for known vulnerabilities against the OSV database
- ๐ท๏ธ DAST โ dynamic baseline scans of running apps via OWASP ZAP + Docker
- ๐ Baselines & trend tracking โ cache scans and diff against a saved baseline
- ๐ค MCP Prompts & Resources โ pre-built security workflows and live dashboards for agents
- ๐ค Dashboard integrations โ push SARIF results to DefectDojo or GitHub Code Scanning
- ๐ฉน AI-assisted remediation โ generate fix prompts and apply agent-written patches via
git apply
Quick Start
Install
pip install sast-mcp-server
Or run directly without installing:
uvx sast-mcp-server
Install at least one scanner
# Python projects
pip install bandit
# JavaScript/Node.js projects
pip install njsscan
# Multi-language (recommended)
pip install semgrep
# IaC, secrets, and dependency CVEs (recommended)
# See: https://aquasecurity.github.io/trivy/latest/getting-started/installation/
# IaC policy scanning
pip install checkov
# Deep semantic analysis
# See: https://github.com/github/codeql-cli-binaries/releases
# Data-flow analysis
# See: https://docs.bearer.com/installation/
Usage with AI Agents
Gemini CLI
Install as an extension:
gemini extensions install https://github.com/Skyrxin/sast-mcp-server
Or add to your ~/.gemini/settings.json:
{
"mcpServers": {
"sast": {
"command": "uvx",
"args": ["sast-mcp-server"]
}
}
}
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"sast": {
"command": "uvx",
"args": ["sast-mcp-server"]
}
}
}
See full Claude Desktop guide.
Cursor IDE
Add to Cursor Settings โ MCP Servers:
{
"mcpServers": {
"sast": {
"command": "uvx",
"args": ["sast-mcp-server"]
}
}
}
See full Cursor guide.
OpenAI Agents SDK
from agents.mcp import MCPServerStdio
sast_server = MCPServerStdio(command="uvx", args=["sast-mcp-server"])
See full OpenAI guide.
Available MCP Tools
scan_vulnerabilities
Scan a directory for security vulnerabilities using a specific scanner.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Path to scan |
scanner_name |
string | "bearer" |
Scanner: bandit, njsscan, bearer, semgrep, trivy, codeql, checkov |
min_severity |
string | "LOW" |
Minimum severity: LOW, MEDIUM, HIGH, CRITICAL |
min_confidence |
string | "LOW" |
Minimum confidence: LOW, MEDIUM, HIGH |
git_diff_only |
bool | false |
Only scan git-modified files |
limit |
int | 50 |
Max findings to return |
offset |
int | 0 |
Pagination offset |
scan_all
Run ALL installed scanners in parallel with automatic deduplication. Recommended for comprehensive security scanning.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Path to scan |
min_severity |
string | "MEDIUM" |
Minimum severity (higher default to reduce noise) |
min_confidence |
string | "LOW" |
Minimum confidence |
git_diff_only |
bool | false |
Only scan git-modified files |
limit |
int | 50 |
Max findings to return |
offset |
int | 0 |
Pagination offset |
scan_git_history
Scan the entire .git history for leaked secrets and credentials using Gitleaks.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | "." |
Path to the repository root (must contain .git) |
min_severity |
string | "LOW" |
Minimum severity to report |
run_active_scan
Run a dynamic (DAST) baseline scan with OWASP ZAP by orchestrating a Docker Compose stack.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Directory containing the docker-compose file |
docker_compose_file |
string | required | Name of the docker-compose file (e.g. docker-compose.yml) |
target_url |
string | required | URL of the running app once it's up (e.g. http://localhost:8080) |
export_sarif
Export scan results in SARIF 2.1.0 format for CI/CD integration.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Path to scan |
scanner_name |
string | "bearer" |
Scanner to use |
min_severity |
string | "LOW" |
Minimum severity |
min_confidence |
string | "LOW" |
Minimum confidence |
output_path |
string | "" |
File path to write SARIF (empty = return as string) |
list_scanners
List available scanners, their installation status, and supported languages.
ignore_vulnerability
Suppress a finding from future scans (with audit trail).
unignore_vulnerability
Re-enable a previously suppressed finding.
list_ignored_vulnerabilities
Show all currently suppressed findings for a project.
save_baseline
Run a scan and cache the results as a named baseline for future trend comparison.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Path to scan |
tag |
string | "latest" |
Name for this baseline (e.g. main, pre-release) |
scanner_name |
string | "bearer" |
Scanner to use |
min_severity |
string | "LOW" |
Minimum severity to include |
min_confidence |
string | "LOW" |
Minimum confidence to include |
compare_baseline
Compare a fresh scan against a saved baseline to highlight new and fixed findings.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Path to scan |
tag |
string | "latest" |
Baseline tag to compare against |
scanner_name |
string | "bearer" |
Scanner to use |
min_severity |
string | "LOW" |
Minimum severity to include |
min_confidence |
string | "LOW" |
Minimum confidence to include |
upload_to_defectdojo
Import a SARIF export into a DefectDojo engagement. Requires DEFECTDOJO_URL
and DEFECTDOJO_API_KEY environment variables.
| Parameter | Type | Default | Description |
|---|---|---|---|
sarif_path |
string | required | Path to a SARIF file from export_sarif |
engagement_id |
int | required | Target DefectDojo engagement ID |
active |
bool | true |
Mark imported findings active |
verified |
bool | false |
Mark imported findings verified |
upload_to_github
Upload a SARIF report to GitHub Code Scanning. Requires a GITHUB_TOKEN with
security_events: write scope.
| Parameter | Type | Default | Description |
|---|---|---|---|
sarif_path |
string | required | Path to a SARIF file from export_sarif |
repo |
string | required | Repository in owner/name form |
commit_sha |
string | required | Full commit SHA the results apply to |
ref |
string | required | Fully qualified ref, e.g. refs/heads/main |
generate_fix_prompt
Package a cached finding's vulnerable code and context into an LLM-ready prompt that asks for a strict unified diff fix.
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Scanned project root (with .sast-mcp-cache) |
finding_hash |
string | required | Hash of the finding to fix (from scan output) |
context_window |
int | 15 |
Source lines to include before/after the finding |
apply_patch
Apply an agent-generated unified diff to disk via git apply (paths that escape
the target directory are rejected).
| Parameter | Type | Default | Description |
|---|---|---|---|
target_path |
string | required | Directory the patch paths are relative to |
patch |
string | required | The unified diff text to apply |
check_only |
bool | false |
Validate without modifying files |
SARIF / CI/CD Integration
Export scan results in SARIF 2.1.0 format for integration with CI/CD platforms:
# In your CI pipeline, use the MCP tool:
# export_sarif(target_path=".", scanner_name="semgrep", output_path="results.sarif")
# Then upload to GitHub Code Scanning:
# gh api /repos/{owner}/{repo}/code-scanning/sarifs -f sarif=@results.sarif
Compatible with: GitHub Code Scanning, GitLab SAST, Azure DevOps, VS Code SARIF Viewer.
Remote Deployment (Streamable HTTP)
For remote or cloud-hosted deployments, the 2026 MCP standard uses Streamable HTTP.
You can secure the server with JWT Bearer Authentication by setting a secret. Alternatively, for backward compatibility, you can use a static API key.
# Set JWT secret for secure authentication
export SAST_MCP_JWT_SECRET="your_hmac_sha256_secret"
# Or use the legacy API key method
export SAST_MCP_API_KEY="your_secure_api_key_here"
# Start the server with streamable-http transport
uv run sast-mcp-server --transport streamable-http --port 8080 --host 0.0.0.0
Note: The old
ssetransport is deprecated. Please migrate tostreamable-http.
Core Workflows
1. Unified Vulnerability Scanning
Run any of the installed scanners individually (scan_vulnerabilities(scanner_name="bandit")) or run all of them at once using scan_all.
2. Deep Secret & Dynamic Scanning
Use scan_git_history to find API keys leaked years ago, or run_active_scan to spin up your application with Docker Compose and test it dynamically with OWASP ZAP.
3. Baseline & Trend Tracking
Save a scan as a named baseline and compare future scans against it to track new vulnerabilities, fixed issues, and severity trends over time.
save_baseline(target_path=".", tag="main")compare_baseline(target_path=".", tag="main")
4. CI/CD Integration
Export scan results to SARIF format (export_sarif) to integrate with GitHub Code Scanning, GitLab SAST, or any other SARIF-compatible platform.
5. MCP Prompts (Security Workflows)
Pre-built security workflows that guide AI agents:
security_review: Full codebase assessmentfix_vulnerability: Focused remediation advisorpr_security_check: Scan only git diffs and enforce a severity gatecompliance_report: Generate an OWASP Top 10 or PCI-DSS report
6. MCP Resources (Security Dashboards)
Read-only contextual data for AI agents without running a full scan:
sast://dashboard/{path}: Security posture dashboardsast://config: Server configuration and statussast://scanners: Available scanners and languagessast://cache/{path}/latest: Latest scan results metadata
7. Dashboard Upload & AI-Assisted Remediation
Push SARIF results to external platforms and remediate findings with agent-written patches:
upload_to_defectdojo/upload_to_github: Push a SARIF export to a dashboardgenerate_fix_prompt: Build an LLM-ready prompt for a specific findingapply_patch: Apply the resulting unified diff viagit apply
Docker
docker build -t sast-mcp-server .
docker run -p 8080:8080 -e SAST_MCP_API_KEY=your-key sast-mcp-server --transport sse
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
SAST_MCP_TIMEOUT |
300 |
Scan timeout in seconds |
SAST_MCP_LOG_LEVEL |
INFO |
Log level: DEBUG, INFO, WARNING, ERROR |
SAST_MCP_API_KEY |
(none) | API key for remote (HTTP) authentication |
SAST_MCP_JWT_SECRET |
(none) | HMAC-SHA256 secret for JWT bearer auth |
DEFECTDOJO_URL |
(none) | Base URL of a DefectDojo instance (for upload_to_defectdojo) |
DEFECTDOJO_API_KEY |
(none) | DefectDojo API v2 token |
GITHUB_TOKEN |
(none) | Token with security_events: write (for upload_to_github) |
Development
# Clone and install with dev dependencies
git clone https://github.com/Skyrxin/sast-mcp-server.git
cd sast-mcp-server
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check sast_mcp_server/
# Run locally
python -m sast_mcp_server
Project Structure
sast_mcp_server/
โโโ __init__.py # Package version
โโโ __main__.py # python -m entry point
โโโ server.py # FastMCP server with all tools
โโโ models.py # Typed data models (Finding, Severity, etc.)
โโโ sarif.py # SARIF 2.1.0 export and parsing
โโโ aggregator.py # Multi-scanner parallel execution + deduplication
โโโ cache.py # Scan result caching, baselines, and comparison
โโโ auth.py # JWT / API key authentication for remote transports
โโโ prompts.py # MCP prompt templates (security workflows)
โโโ resources.py # MCP resources (sast:// dashboards and metadata)
โโโ scanners/
โ โโโ base.py # Abstract scanner base class
โ โโโ factory.py # Scanner registry and factory
โ โโโ bandit.py # Bandit (Python)
โ โโโ njsscan.py # njsscan (JavaScript)
โ โโโ bearer.py # Bearer (multi-language)
โ โโโ semgrep.py # Semgrep (30+ languages)
โ โโโ trivy.py # Trivy (CVEs, secrets, IaC)
โ โโโ codeql.py # CodeQL (deep semantic SAST)
โ โโโ checkov.py # Checkov (IaC policies)
โ โโโ gitleaks.py # Gitleaks (git history secret scanning)
โ โโโ osv_scanner.py # OSV-Scanner (SCA / dependency CVEs)
โ โโโ zap.py # OWASP ZAP (DAST via Docker)
โโโ enrichment/
โ โโโ ast_context.py # AST-aware code context extraction
โ โโโ git_diff.py # Git diff for incremental scanning
โ โโโ ignore_manager.py # Finding ignore list management
โ โโโ patch_prompt.py # Builds LLM prompts to fix a cached finding
โ โโโ patch_apply.py # Applies agent-generated diffs via `git apply`
โโโ integrations/
โโโ defectdojo.py # Upload SARIF to DefectDojo
โโโ github.py # Upload SARIF to GitHub Code Scanning
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sast_mcp_server-0.6.0.tar.gz.
File metadata
- Download URL: sast_mcp_server-0.6.0.tar.gz
- Upload date:
- Size: 206.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d2e3842cc1863fa729901d4a5906b2545231dcb3b2c3fcc22f201c78cdb1ad7
|
|
| MD5 |
3880d045b4ff76c401f07dfa451a8103
|
|
| BLAKE2b-256 |
c347c94e91cca65e9a0ee82859dd2790488b62bff57ed5046293ccf00b6a79a0
|
Provenance
The following attestation bundles were made for sast_mcp_server-0.6.0.tar.gz:
Publisher:
ci.yml on Skyrxin/sast-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sast_mcp_server-0.6.0.tar.gz -
Subject digest:
3d2e3842cc1863fa729901d4a5906b2545231dcb3b2c3fcc22f201c78cdb1ad7 - Sigstore transparency entry: 1818262918
- Sigstore integration time:
-
Permalink:
Skyrxin/sast-mcp-server@4629bad380facc817b73732199f98210c3c65d89 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Skyrxin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@4629bad380facc817b73732199f98210c3c65d89 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sast_mcp_server-0.6.0-py3-none-any.whl.
File metadata
- Download URL: sast_mcp_server-0.6.0-py3-none-any.whl
- Upload date:
- Size: 76.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad566f81f516c1fd913d4d6aa98b2543f43bcd215557f48b5a177ec210ff5e45
|
|
| MD5 |
689f967ac14d47f81e61898da2603924
|
|
| BLAKE2b-256 |
d3661383a0c5aad1b5d634ff1995bd2ed64f2d12342ff2927ecbad6312d02350
|
Provenance
The following attestation bundles were made for sast_mcp_server-0.6.0-py3-none-any.whl:
Publisher:
ci.yml on Skyrxin/sast-mcp-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sast_mcp_server-0.6.0-py3-none-any.whl -
Subject digest:
ad566f81f516c1fd913d4d6aa98b2543f43bcd215557f48b5a177ec210ff5e45 - Sigstore transparency entry: 1818262947
- Sigstore integration time:
-
Permalink:
Skyrxin/sast-mcp-server@4629bad380facc817b73732199f98210c3c65d89 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Skyrxin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@4629bad380facc817b73732199f98210c3c65d89 -
Trigger Event:
push
-
Statement type: