Security-Use MCP Server

Security-Use MCP Server

Enables AI assistants to scan project dependencies and Infrastructure as Code files for security vulnerabilities and misconfigurations. It also provides automated fixing capabilities to remediate identified security issues.

Category
访问服务器

README

Security-Use MCP Server

An MCP (Model Context Protocol) server that gives AI assistants like Cursor, Claude, and other MCP-compatible tools the ability to scan for security vulnerabilities and automatically fix them.

What It Does

This MCP server exposes four powerful security tools to your AI assistant:

Tool Description
scan_dependencies Scans your project's dependencies (requirements.txt, package.json, pyproject.toml, etc.) for known vulnerabilities using the OSV database
scan_iac Scans Infrastructure as Code files (Terraform, CloudFormation) for security misconfigurations
fix_vulnerability Automatically updates vulnerable packages to secure versions
fix_iac Generates and applies fixes for IaC security issues

Supported Formats

Dependency Scanning

  • Python: requirements.txt, pyproject.toml, Pipfile, Pipfile.lock, poetry.lock, setup.py
  • JavaScript/Node.js: package.json, package-lock.json
  • Java: pom.xml

Infrastructure as Code

  • Terraform (.tf files)
  • AWS CloudFormation (.yaml, .yml, .json)
  • AWS SAM templates
  • AWS CDK synthesized output

IaC Security Rules

The scanner checks for common AWS misconfigurations including:

  • CKV_AWS_20: S3 buckets with public access (CRITICAL)
  • CKV_AWS_19: S3 buckets without encryption (HIGH)
  • CKV_AWS_23: Security groups with unrestricted ingress (HIGH)
  • CKV_AWS_16: RDS instances without encryption (HIGH)
  • CKV_AWS_3: EBS volumes without encryption (HIGH)
  • CKV_AWS_35: CloudTrail not enabled (MEDIUM)
  • CKV_AWS_14: IAM users without MFA (MEDIUM)
  • CKV_AWS_12: VPC without flow logs (MEDIUM)

Installation

From PyPI

pip install security-use-mcp

From Source

git clone https://github.com/security-use/mcp.git
cd mcp
pip install -e .

Quick Setup for Cursor

  1. Install the package (see above)

  2. Add to Cursor's MCP configuration (~/.cursor/mcp.json):

{
  "mcpServers": {
    "security-use": {
      "command": "security-use-mcp",
      "args": [],
      "env": {}
    }
  }
}

If you installed from source or use a virtual environment:

{
  "mcpServers": {
    "security-use": {
      "command": "python",
      "args": ["-m", "security_use_mcp.server"],
      "env": {}
    }
  }
}
  1. Restart Cursor

  2. Test it - Open Cursor's AI chat and ask:

    "Scan this project for security vulnerabilities"

Usage Examples

Once configured, you can ask your AI assistant things like:

Dependency Scanning

  • "Scan this project for vulnerable dependencies"
  • "Check if my Python packages have any CVEs"
  • "Are there any security issues in my requirements.txt?"

IaC Scanning

  • "Scan my Terraform files for security issues"
  • "Check this CloudFormation template for misconfigurations"
  • "Are my S3 buckets configured securely?"

Fixing Vulnerabilities

  • "Fix the requests vulnerability"
  • "Update django to a secure version"
  • "Fix the S3 bucket public access issue in main.tf"

Example Output

Dependency Scan Results

## Dependency Security Scan Results

**Found 2 vulnerabilities**

### CRITICAL (1)

#### requests (2.25.0)
- **ID**: GHSA-xxxx-yyyy-zzzz
- **Title**: CVE-2023-32681 - Unintended leak of Proxy-Authorization header
- **Fixed in**: 2.31.0

### HIGH (1)

#### django (3.1.0)
- **ID**: CVE-2023-xxxxx
- **Title**: SQL Injection in QuerySet.values()
- **Fixed in**: 3.2.19

IaC Scan Results

## IaC Security Scan Results

**Found 2 security issues**

### CRITICAL (1)

#### CKV_AWS_20: S3 bucket with public access
- **File**: `s3.tf:15`
- **Resource**: aws_s3_bucket.my-bucket
- **Remediation**: Set acl to 'private'

### HIGH (1)

#### CKV_AWS_23: Security group allows unrestricted ingress
- **File**: `sg.tf:8`
- **Resource**: aws_security_group.web
- **Remediation**: Restrict CIDR blocks to specific IPs

Configuration Options

Environment Variables

Variable Description Default
SECURITY_USE_LOG_LEVEL Logging level (DEBUG, INFO, WARN, ERROR) INFO
SECURITY_USE_CACHE_DIR Directory for caching vulnerability data System temp

Example configuration with environment variables:

{
  "mcpServers": {
    "security-use": {
      "command": "security-use-mcp",
      "args": [],
      "env": {
        "SECURITY_USE_LOG_LEVEL": "DEBUG"
      }
    }
  }
}

Development

Setup

# Clone the repository
git clone https://github.com/security-use/mcp.git
cd mcp

# Install with dev dependencies
pip install -e ".[dev]"

# Also install the core security-use package
pip install -e ../security-use

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=security_use_mcp

# Run specific test file
pytest tests/test_handlers.py -v

Linting

# Check code style
ruff check src/ tests/

# Auto-fix issues
ruff check src/ tests/ --fix

Testing the Server

You can test the MCP server directly:

# Start the server (it communicates via stdin/stdout)
python -m security_use_mcp.server

# Or use the entry point
security-use-mcp

Troubleshooting

Server Not Starting

  1. Check Python version (requires 3.10+):

    python --version
    
  2. Verify installation:

    pip show security-use-mcp
    pip show security-use
    
  3. Test the server directly:

    python -c "from security_use_mcp.server import server; print('OK')"
    

Tools Not Appearing in Cursor

  1. Restart Cursor after changing mcp.json
  2. Check that the JSON is valid
  3. Look for errors in Cursor's Developer Tools (Help > Toggle Developer Tools)

Scan Returns No Results

  1. Make sure you have dependency files (requirements.txt, package.json, etc.) or IaC files (.tf, .yaml) in your project
  2. Check that the path is correct when scanning specific directories

Architecture

security-use-mcp/
├── src/security_use_mcp/
│   ├── server.py          # MCP server implementation
│   ├── models.py          # Data models for results
│   └── handlers/          # Tool handlers
│       ├── dependency_handler.py
│       └── iac_handler.py
└── tests/
    ├── test_server.py     # Server tests
    ├── test_handlers.py   # Handler unit tests
    └── test_integration.py # Integration tests

The MCP server wraps the security-use Python package, which provides:

  • Dependency scanning via the OSV (Open Source Vulnerabilities) database
  • IaC scanning with configurable security rules
  • Automated fixing capabilities

Related Projects

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选