Security MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Security MCP Server
An independent Model Context Protocol (MCP) server maintained by @dapperdivers that wraps the Bearer CLI security scanning tool, providing AI assistants with the ability to perform static application security testing (SAST) on codebases.
Note: This project is not affiliated with, endorsed by, or sponsored by Bearer. It is an independent implementation that uses the publicly available Bearer CLI tool.
Features
Security Scanning: Run Bearer security scans on directories and files
Multiple Output Formats: Support for JSON, YAML, SARIF, and HTML output formats
Rule Management: List and filter security rules by language and category
Configuration Management: Initialize Bearer configuration files in projects
Docker Support: Containerized deployment with Bearer CLI pre-installed
Working Directory Context: Proper handling of working directories from MCP configuration
Related MCP server: Offensive360 MCP Server
Bearer CLI Overview
Bearer is a static application security testing (SAST) tool that scans source code for security vulnerabilities and sensitive data leaks. It supports multiple programming languages including Go, Java, JavaScript, TypeScript, PHP, Python, and Ruby.
Installation
Prerequisites
Docker and Docker Compose
Python 3.10 or higher (for MCP client integration)
Docker Installation
Clone the repository:
git clone https://github.com/dapperdivers/security_mcp.git cd security_mcpBuild the Docker image:
docker build -t security-mcp-server .Or use Docker Compose:
docker-compose build
Configuration
MCP Client Configuration
Add the server to your MCP client configuration:
For Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"bearer-security": {
"command": "python",
"args": ["/path/to/security_mcp/bearer_mcp_server.py"],
"env": {
"MCP_WORKING_DIRECTORY": "/path/to/your/project"
}
}
}
}For generic MCP clients (mcp.json):
{
"mcpServers": {
"bearer-security": {
"command": "python",
"args": ["/path/to/security_mcp/bearer_mcp_server.py"],
"env": {
"MCP_WORKING_DIRECTORY": "/path/to/your/project"
}
}
}
}Docker Configuration
Using Docker Compose:
services:
bearer-mcp-server:
build: .
volumes:
- ./your-project:/workspace:ro
environment:
- MCP_WORKING_DIRECTORY=/workspaceUsing Docker directly:
docker run -it --rm \
-v /path/to/your/project:/workspace:ro \
-e MCP_WORKING_DIRECTORY=/workspace \
bearer-mcp-serverAvailable Tools
1. bearer_scan
Run Bearer security scan on a directory or file.
Parameters:
path(required): Path to scan (directory or file)format(optional): Output format -json,yaml,sarif,html(default:json)severity(optional): Minimum severity level -critical,high,medium,lowrules(optional): Comma-separated list of rule IDs to runskip_rules(optional): Comma-separated list of rule IDs to skipoutput_file(optional): Path to save scan results to filequiet(optional): Suppress progress output (default:false)
Example:
{
"path": "./src",
"format": "json",
"severity": "high",
"quiet": false
}2. bearer_version
Get Bearer CLI version information.
Parameters: None
3. bearer_list_rules
List available Bearer security rules.
Parameters:
language(optional): Filter by programming language (e.g.,javascript,python,java)category(optional): Filter by category (e.g.,security,privacy)
Example:
{
"language": "javascript",
"category": "security"
}4. bearer_init_config
Initialize Bearer configuration file in a project.
Parameters:
path(optional): Directory to create configuration in (defaults to working directory)
Usage Examples
Basic Security Scan
Ask your AI assistant:
"Scan the current project for security vulnerabilities using Bearer"The assistant will use the bearer_scan tool with the working directory configured in your MCP setup.
Detailed Scan with Filters
"Run a Bearer security scan on the ./src directory, showing only critical and high severity issues, and output the results in SARIF format"List Available Rules
"Show me all available Bearer security rules for JavaScript"Initialize Configuration
"Set up Bearer configuration for this project"Working Directory Handling
The server supports working directory context through:
Environment Variable: Set
MCP_WORKING_DIRECTORYin your MCP configurationRelative Paths: Relative paths in tool arguments are resolved against the working directory
Docker Volumes: Mount your project directory to
/workspacein the container
Error Handling
The server includes comprehensive error handling:
Bearer CLI Not Found: Clear error messages when Bearer isn't installed
Invalid Paths: Validation of file and directory paths
Command Failures: Detailed error reporting with exit codes and stderr output
JSON Parsing: Graceful handling of malformed Bearer output
Logging
Logs are written to stderr (required for STDIO transport) and include:
Command executions with working directories
Error conditions and debugging information
Bearer CLI installation status
Security Considerations
Read-only Scanning: The server only reads files for scanning
Path Validation: All paths are validated and resolved safely
Container Security: Docker image runs as non-root user
Resource Limits: Docker Compose includes resource constraints
Quick Start
After installation, configure your MCP client and start using Bearer security scanning:
Add to your MCP client configuration (see Configuration section)
Restart your MCP client
Ask your AI assistant: "Scan my project for security vulnerabilities with Bearer"
Development
Running Locally
# Install in development mode
pip install -e .
# Run the server directly
python bearer_mcp_server.py
# Run with specific working directory
MCP_WORKING_DIRECTORY=/path/to/project python bearer_mcp_server.pyTesting
# Run tests
python -m pytest tests/
# Run specific test file
python -m pytest tests/test_server.pyBuilding Docker Image
# Build the image
docker build -t bearer-mcp-server .
# Test the container
docker run --rm bearer-mcp-server bearer versionTroubleshooting
Bearer CLI Not Found
If you get "Bearer CLI not found" errors:
Local Installation: Ensure Bearer is installed and in PATH
Docker: Use the provided Docker image which includes Bearer CLI
Manual Installation: Follow the Bearer CLI installation guide
Permission Issues
For Docker deployments:
Ensure proper volume mounting permissions
The container runs as user
mcpuser(UID 1001)Mount project directories as read-only when possible
Path Resolution Issues
Check that
MCP_WORKING_DIRECTORYis set correctlyVerify that relative paths are correct from the working directory
Use absolute paths when in doubt
License
This MCP server is licensed under the MIT License. Bearer CLI is licensed under the Elastic License 2.0 (ELv2).
Contributing
Fork the repository
Create a feature branch
Make your changes with tests
Submit a pull request
Support
Bearer CLI Issues: https://github.com/Bearer/bearer/issues
MCP Protocol: https://modelcontextprotocol.io/
Server Issues: Create an issue in this repository
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Security scanner for AI-written code: SAST, secrets, dependencies, IaC, containers and DAST.
Security scanning for code, containers and IaC: request scans, read findings, report fixes.
Guardrail scans and rule generation for AI agents via scan_code, get_default_rules, and suggest_fix.
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to scan projects for secrets, manage incidents, and create honeytokens using GitGuardian's API.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to run Offensive360 SAST scans on local codebases, returning security findings with file/line, severity, and fixes, plus scan status tracking.257 npmMIT
- AlicenseNot gradedqualityFmaintenanceEnables triggering GuardBee security scans via natural language, checking scan status, filtering findings by severity or ID, and obtaining AI-assisted remediation guidance.MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to run read-only repository health checks for leaked secrets, code quality, and project structure. Exposes tools to scan repositories, retrieve Markdown or JSON reports, and filter findings by severity, rule, or path while confining access to allowed roots.1MIT