A universal security agent that combines the capabilities of multiple static code analysis tools through MCP (Model Context Protocol).
-
Multiple Security Tools:
- Bandit: Python code security analysis
- Detect Secrets: Secret detection in code
- Pip Audit: Python package vulnerability scanning
- Circle Test: Security policy compliance checking
- Semgrep: Advanced static code analysis
-
User-friendly Web Interface:
- File upload for analysis
- Security tool selection
- Detailed reports
- Fix suggestions
- Corrected code download
-
Install Node.js and npm:
# Download and install Node.js from: https://nodejs.org/ # Verify installation: node --version npm --version # On macOS with Homebrew: brew install node
-
Clone the repository:
git clone <repository-url> cd agent
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # for Linux/Mac # or venv\Scripts\activate # for Windows
-
Install main application dependencies:
pip install -r requirements.txt
-
Install MCP server dependencies:
# Install dependencies for each MCP server cd ../mcp/mcp-bandit pip install -r requirements.txt cd ../mcp-detect_secrets pip install -r requirements.txt cd ../mcp-pip_audit pip install -r requirements.txt cd ../mcp-circle_test pip install -r requirements.txt cd ../mcp-semgrep pip install -r requirements.txt
-
Configure environment variables:
cp .env.example .env # if exists, or create .env file # Edit .env file and add your Nebius API key: # NEBIUS_API_KEY=your_api_key_here # CIRCLE_API_URL=link
Open 5 separate terminals and run each MCP server:
# Terminal 1 - Bandit MCP Server (Port 7861)
cd agent/mcp/mcp-bandit
python app.py
# Terminal 2 - Detect Secrets MCP Server (Port 7862)
cd agent/mcp/mcp-detect_secrets
python app.py
# Terminal 3 - Pip Audit MCP Server (Port 7863)
cd agent/mcp/mcp-pip_audit
python app.py
# Terminal 4 - Circle Test MCP Server (Port 7864)
cd agent/mcp/mcp-circle_test
python app.py
# Terminal 5 - Semgrep MCP Server (Port 7865)
cd agent/mcp/mcp-semgrep
python app.py
# Terminal 6 - Main Gradio Application
cd agent
python main.py
Open your browser and go to:
http://localhost:7860
- Upload a code file (supports .py, .js, .java, .go, .rb)
- Select security tools to use for analysis
- (Optional) Specify particular checks in the text field
- Click "Run Scan" to start the security analysis
- Review the analysis results in the interface
- Download the corrected code if fixes are suggested
- Bandit: 7861
- Detect Secrets: 7862
- Pip Audit: 7863
- Circle Test: 7864
- Semgrep: 7865
- Gradio App: 7860
Create a .env
file in the gradio-app
directory:
NEBIUS_API_KEY=your_nebius_api_key_here
CIRCLE_API_URL=your_circle_api_url_here # for Circle Test
- Upload a Python file
- Keep all tools selected (default)
- Click "Run Scan"
- Review comprehensive security analysis
- Upload any supported code file
- Enter specific checks: "SQL injection, shell injection, secrets"
- Select relevant tools (e.g., Bandit, Detect Secrets)
- Run the analysis for focused results
- Upload your project files one by one
- Use all tools for comprehensive coverage
- Review detailed vulnerability reports
- Download fixed versions of your code
-
"Server not available" errors:
- Ensure all MCP servers are running on their respective ports
- Check if ports 7861-7865 are not occupied by other processes
-
"API key not found" errors:
- Make sure
.env
file exists ingradio-app
directory - Verify
NEBIUS_API_KEY
is set correctly
- Make sure
-
JSON parsing errors:
- This usually indicates MCP server communication issues
- Restart the problematic MCP server
- Check server logs for detailed error information
-
Port conflicts:
# Check if ports are in use: lsof -i :7860-7865 # Kill processes if needed: kill -9 <PID>
- Bandit Documentation
- Detect Secrets Documentation
- Pip Audit Documentation
- Semgrep Documentation
- MCP Specification
- Gradio Documentation
test_docker/agent/
├── README.md # This file
├── .gitignore # Git ignore rules
├── gradio-app/ # Main application
│ ├── main.py # Gradio web interface
│ ├── requirements.txt # Python dependencies
│ └── .env # Environment variables
└── mcp/ # MCP servers
├── mcp-bandit/ # Bandit security scanner
├── mcp-detect_secrets/ # Secret detection
├── mcp-pip_audit/ # Package vulnerability scanner
├── mcp-circle_test/ # Policy compliance checker
└── mcp-semgrep/ # Advanced static analysis
- All MCP servers must be running before starting the main application
- Gradio interface will be available on
http://localhost:7860
- Network connectivity is required for Nebius API calls
- File upload limits apply based on Gradio's default settings
- Analysis time varies depending on file size and selected tools