SAST MCP Server

SAST MCP Server

Integrates 15+ static application security testing tools (Semgrep, Bandit, TruffleHog, etc.) with Claude Code AI, enabling automated vulnerability scanning and security analysis through natural language commands. Supports cross-platform operation with remote execution on dedicated security VMs.

Category
访问服务器

README

MCP-SAST-Server

A comprehensive Model Context Protocol (MCP) server that integrates multiple SAST (Static Application Security Testing) tools with Claude Code AI, enabling automated security analysis and vulnerability scanning directly from your AI assistant.

Overview

This project provides a bridge between Claude Code and industry-standard security scanning tools, allowing developers to perform comprehensive security analysis through natural language commands.

Key Features

  • 15+ SAST Tools Integration: Semgrep, Bandit, ESLint Security, TruffleHog, Gitleaks, and more
  • MCP Protocol: Seamless integration with Claude Code AI
  • Remote Execution: Run security tools on a dedicated security VM (Kali Linux) while working on Windows
  • Path Resolution: Automatic Windows ↔ Linux path mapping for cross-platform operation
  • Flexible Architecture: Choose between full-featured or lightweight server
  • Comprehensive Coverage: Code analysis, secret scanning, dependency checking, IaC security

Architecture

┌─────────────────┐         ┌──────────────────┐         ┌─────────────────┐
│  Claude Code    │  MCP    │  MCP Client      │  HTTP   │  SAST Server    │
│  (Windows)      │◄───────►│  sast_mcp_client │◄───────►│  (Kali Linux)   │
│                 │         │  .py             │         │                 │
└─────────────────┘         └──────────────────┘         └─────────────────┘
                                                                  │
                                                                  ▼
                                                          ┌─────────────────┐
                                                          │  Security Tools │
                                                          │  - Semgrep      │
                                                          │  - Bandit       │
                                                          │  - TruffleHog   │
                                                          │  - Checkov      │
                                                          │  - And more...  │
                                                          └─────────────────┘

Supported Tools

Code Analysis

  • Semgrep - Multi-language static analysis (30+ languages)
  • Bandit - Python security scanner
  • ESLint Security - JavaScript/TypeScript security linting
  • Gosec - Go security checker
  • Brakeman - Ruby on Rails security scanner
  • Graudit - Grep-based source code auditing
  • Bearer - Security and privacy risk scanner

Secret Detection

  • TruffleHog - Secret scanner for git repos and filesystems
  • Gitleaks - Fast secret detection for git repositories

Dependency Scanning

  • Safety - Python dependency vulnerability checker
  • npm audit - Node.js dependency security audit
  • OWASP Dependency-Check - Multi-language dependency scanner

Infrastructure as Code

  • Checkov - Terraform, CloudFormation, Kubernetes, Dockerfile scanner
  • tfsec - Terraform security scanner
  • Trivy - Container and IaC vulnerability scanner

Installation

Prerequisites

Windows Machine (Client):

  • Python 3.8+
  • Claude Code installed

Linux Machine (Server - Kali Linux recommended):

Quick Start

1. Clone the Repository

git clone https://github.com/your-username/MCP-SAST-Server.git
cd MCP-SAST-Server

2. Install Python Dependencies

pip install -r requirements.txt

3. Configure Server (Optional)

Copy the example environment file and customize:

cp .env.example .env
# Edit .env with your settings (port, paths, timeouts)

4. Start SAST Server (on Kali Linux)

Option A: Full-Featured Server (recommended for complete functionality)

python3 sast_server.py --port 6000

Option B: Simple Server (no external dependencies, basic functionality)

python3 simple_sast_server.py --port 6000

5. Configure Claude Code (on Windows)

Option A: Use the example configuration

  1. Open config.example.json in the repository
  2. Copy the configuration that matches your setup
  3. Add it to your .claude.json file
  4. Update the paths and server URL

Option B: Manual configuration

Add the MCP server configuration to your .claude.json:

{
  "mcpServers": {
    "sast_tools": {
      "type": "stdio",
      "command": "python",
      "args": [
        "/path/to/MCP-SAST-Server/sast_mcp_client.py",
        "--server",
        "http://YOUR_KALI_IP:6000"
      ]
    }
  }
}

Important: Update these values:

  • /path/to/MCP-SAST-Server/sast_mcp_client.py - Full path to the MCP client script
  • YOUR_KALI_IP - Your Kali Linux machine's IP address (e.g., 192.168.1.100)
  • Port 6000 - Change if you configured a different port

Windows Path Examples:

  • C:/Projects/MCP-SAST-Server/sast_mcp_client.py
  • F:/work/MCP-SAST-Server/sast_mcp_client.py

Linux/Mac Path Examples:

  • /home/user/MCP-SAST-Server/sast_mcp_client.py
  • ~/projects/MCP-SAST-Server/sast_mcp_client.py

6. Verify Installation

On Kali Linux:

curl http://localhost:6000/health

In Claude Code:

@sast_tools

Check the SAST server health and show me available tools

Usage Examples

Security Scanning

Scan Python code for vulnerabilities:

@sast_tools

Run a Bandit scan on F:/work/MyProject/backend with high severity filter

Multi-language security audit:

@sast_tools

Use Semgrep with OWASP Top 10 rules to scan F:/work/MyProject

Find secrets in repository:

@sast_tools

Scan F:/work/MyProject for leaked secrets using TruffleHog

Dependency Checking

Check Python dependencies:

@sast_tools

Run Safety check on F:/work/MyProject/requirements.txt

Audit Node.js packages:

@sast_tools

Run npm audit on F:/work/MyProject/frontend with critical severity

Infrastructure Security

Scan Terraform files:

@sast_tools

Use Checkov to scan Terraform configurations in F:/work/MyProject/terraform

Check Docker security:

@sast_tools

Scan F:/work/MyProject/Dockerfile with Trivy

Tool Installation

Installing Security Tools on Kali Linux

Many tools come pre-installed on Kali Linux. For missing tools:

Semgrep:

pip3 install semgrep

Bandit:

pip3 install bandit

TruffleHog:

pip3 install trufflehog

Gitleaks:

wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.0/gitleaks_8.18.0_linux_x64.tar.gz
tar -xzf gitleaks_8.18.0_linux_x64.tar.gz
sudo mv gitleaks /usr/local/bin/

Checkov:

pip3 install checkov

Safety:

pip3 install safety

Trivy:

wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt update
sudo apt install trivy

For a complete installation guide, refer to each tool's official documentation.

Configuration

Server Configuration (.env file)

The server can be configured using environment variables or a .env file:

Using .env file (recommended):

# Copy the example file
cp .env.example .env

# Edit .env with your settings
nano .env

Available Configuration Options:

# Server Port (default: 6000)
API_PORT=6000

# Debug Mode (default: 0)
DEBUG_MODE=0

# Command Timeout in seconds (default: 3600)
COMMAND_TIMEOUT=3600

# Max timeout limit (default: 7200)
MAX_TIMEOUT=7200

# Path Mapping (for Windows/Linux cross-platform)
MOUNT_POINT=/mnt/work
WINDOWS_BASE=F:/work

Using environment variables directly:

export API_PORT=6000
export DEBUG_MODE=1
export MOUNT_POINT=/mnt/work
export WINDOWS_BASE=F:/work

Client Configuration (config.example.json)

For Claude Code configuration, see config.example.json which includes:

  • Windows with local Kali VM example
  • Windows with remote Kali server example
  • Linux/Mac configuration example

Simply copy the appropriate configuration to your .claude.json and update the paths and IP address.

Path Resolution

The server automatically resolves Windows paths to Linux mount paths:

  • F:/work/Project/mnt/work/Project
  • F:\work\Project/mnt/work/Project

Configure your mount point using environment variables if different.

API Endpoints

Health Check

GET /health

SAST Tools

POST /api/sast/semgrep
POST /api/sast/bandit
POST /api/sast/bearer
POST /api/sast/graudit
POST /api/sast/gosec
POST /api/sast/brakeman
POST /api/sast/eslint-security

Secret Scanning

POST /api/secrets/trufflehog
POST /api/secrets/gitleaks

Dependency Scanning

POST /api/dependencies/safety
POST /api/dependencies/npm-audit
POST /api/dependencies/dependency-check

Infrastructure as Code

POST /api/iac/checkov
POST /api/iac/tfsec

Container Security

POST /api/container/trivy

Custom Commands

POST /api/command

Project Structure

MCP-SAST-Server/
├── sast_server.py              # Full-featured SAST server (recommended)
├── simple_sast_server.py       # Lightweight alternative (minimal dependencies)
├── sast_mcp_client.py          # MCP client for Claude Code integration
├── requirements.txt            # Python dependencies
├── .env.example                # Server configuration template
├── config.example.json         # Claude Code configuration examples
├── .gitignore                  # Git ignore rules
├── LICENSE                     # MIT License
├── CONTRIBUTING.md             # Contribution guidelines
└── README.md                   # This file (main documentation)

File Descriptions

Core Files:

  • sast_server.py - Main SAST server with .env support and path resolution
  • sast_mcp_client.py - MCP client that connects Claude Code to the server
  • simple_sast_server.py - Alternative server with no external dependencies

Configuration:

  • .env.example - Environment variables template for server configuration
  • config.example.json - Claude Code integration examples for different setups

Documentation:

  • README.md - Complete project documentation (you're reading it!)
  • CONTRIBUTING.md - Guidelines for contributing to the project
  • LICENSE - MIT License terms

Troubleshooting

Connection Issues

Problem: Cannot connect to SAST server

Solution:

  1. Verify server is running: curl http://KALI_IP:6000/health
  2. Check firewall settings on Kali Linux
  3. Ensure IP address in .claude.json is correct
  4. Check network connectivity between Windows and Kali

Path Resolution Issues

Problem: Scans fail with "path not found"

Solution:

  1. Verify Windows share is mounted on Linux: ls /mnt/work
  2. Check mount point configuration matches MOUNT_POINT environment variable
  3. Ensure paths use forward slashes in .claude.json

Tool Not Available

Problem: Health check shows tool as unavailable

Solution:

  1. Install missing tools (see Tool Installation)
  2. Verify tool is in PATH: which semgrep
  3. Test tool manually: semgrep --version

Security Considerations

  • Network Security: Use firewall rules to restrict access to SAST server port
  • Authentication: Consider adding API authentication for production use
  • Secrets: Never commit API keys or credentials to the repository
  • Isolation: Run SAST server in isolated VM or container
  • Updates: Regularly update security tools to get latest vulnerability signatures

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Support

For issues, questions, or contributions:

Roadmap

  • [ ] Add authentication/authorization
  • [ ] Implement scan result caching
  • [ ] Add webhook notifications
  • [ ] Create web dashboard for scan results
  • [ ] Support for additional SAST tools
  • [ ] Docker containerization
  • [ ] CI/CD integration examples

Built with ❤️ for secure code development

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选