# Install globally from npm
npm install -g code-audit-mcp
# Verify installation
code-audit --version# Clone repository
git clone <repository-url>
cd code-audit-mcp
# Install dependencies
npm install
# Build the package
npm run build
# Test locally
npm run test-local# Run interactive setup wizard
code-audit setup
# Or use preset configurations
code-audit setup --minimal # Essential models only (~4GB)
code-audit setup --comprehensive # Recommended setup (~15GB)# Start in foreground (for testing)
code-audit start
# Start as background daemon
code-audit start --daemon
# Stop the server
code-audit stop# Basic health check
code-audit health
# Detailed health information
code-audit health --detailed
# JSON output for scripting
code-audit health --jsonInteractive setup wizard for first-time configuration.
code-audit setup [options]
Options:
--force Force re-setup even if already configured
--minimal Minimal setup with essential models only
--comprehensive Full setup with all recommended modelsWhat it does:
- Checks prerequisites (Node.js, Ollama)
- Guides model selection and installation
- Creates configuration files
- Tests the complete setup
Start the MCP server for code auditing.
code-audit start [options]
Options:
-d, --daemon Run as daemon process
-p, --port Port for HTTP transport (optional)
--stdio Use stdio transport (default)Examples:
# Start in foreground (good for testing)
code-audit start
# Start as background daemon
code-audit start --daemon
# Start with HTTP transport on custom port
code-audit start --port 3001Stop the running MCP server.
code-audit stopCheck system health and configuration.
code-audit health [options]
Options:
--detailed Show detailed health information
--json Output as JSONHealth Checks:
- β Ollama installation and service status
- β AI model availability and health
- β Configuration validity
- β Network connectivity
- β Disk space and system resources
Manage AI models for code analysis.
code-audit models [options]
Options:
--list List installed models
--pull <model> Pull a specific model
--remove <model> Remove a specific model
--update Update all models to latest versions
--recommend Show system-specific recommendations
--health Check model health statusExamples:
# List all installed models
code-audit models --list
# Install a specific model
code-audit models --pull codellama:7b
# Remove a model (with confirmation)
code-audit models --remove old-model:latest
# Update all models
code-audit models --update
# Get recommendations for your system
code-audit models --recommendManage configuration settings.
code-audit config [options]
Options:
--show Show current configuration
--reset Reset to default configuration
--set <key=value> Set a configuration value
--get <key> Get a configuration valueExamples:
# Show current configuration
code-audit config --show
# Set Ollama host
code-audit config --set ollama.host=http://remote-server:11434
# Get a specific value
code-audit config --get ollama.models.primary
# Reset to defaults (with confirmation)
code-audit config --reset
# Interactive configuration menu
code-audit configCheck for and install updates.
code-audit update [options]
Options:
--check Only check for updates, don't install
--force Force update even if no new versionExamples:
# Check for updates
code-audit update --check
# Interactive update with confirmation
code-audit update
# Force update to latest version
code-audit update --forceBest for: Getting started, limited resources
code-audit models --pull codellama:7b
code-audit models --pull granite-code:8bBest for: Most users, balanced performance/accuracy
code-audit models --pull codellama:7b
code-audit models --pull granite-code:8b
code-audit models --pull deepseek-coder:6.7b
code-audit models --pull starcoder2:7b
code-audit models --pull qwen2.5-coder:7bBest for: Maximum accuracy, high-end systems
# Includes all comprehensive models plus:
code-audit models --pull codellama:13b
code-audit models --pull deepseek-coder:33b
code-audit models --pull starcoder2:15b
code-audit models --pull llama3.1:8b| Model | Best For | Size | RAM Required |
|---|---|---|---|
codellama:7b |
General purpose, fast analysis | ~4GB | 8GB+ |
granite-code:8b |
Security analysis | ~5GB | 8GB+ |
deepseek-coder:6.7b |
Performance optimization | ~4GB | 8GB+ |
starcoder2:7b |
Testing and quality | ~4GB | 8GB+ |
qwen2.5-coder:7b |
Documentation analysis | ~4GB | 8GB+ |
codellama:13b |
Higher accuracy general | ~7GB | 16GB+ |
deepseek-coder:33b |
Maximum accuracy | ~20GB | 32GB+ |
Global configuration is stored in:
- macOS/Linux:
~/.code-audit/config.json - Windows:
%USERPROFILE%\.code-audit\config.json
Project-specific overrides can be placed in:
.code-audit.json(project root).code-audit/config.json(project directory)package.json(incodeAuditsection)
{
"ollama": {
"host": "http://localhost:11434",
"timeout": 30000,
"models": {
"primary": "codellama:7b",
"fallback": ["granite-code:8b"]
}
},
"audit": {
"rules": {
"security": true,
"completeness": true,
"performance": true
},
"output": {
"format": "json",
"includeMetrics": true
}
},
"server": {
"port": 3000,
"transport": "stdio"
}
}Add to your Claude Code MCP configuration:
{
"mcpServers": {
"code-audit": {
"command": "code-audit",
"args": ["start", "--stdio"],
"env": {}
}
}
}Once configured, you can use the audit tools:
Analyze this code for security issues:
[paste your code]
The MCP server will automatically:
- β Detect the programming language
- β Select the appropriate AI model
- β Perform comprehensive analysis
- β Return structured results with suggestions
# Check if Ollama is installed
ollama --version
# Install Ollama from https://ollama.ai
# Then restart the setup
code-audit setup --force# Check disk space
df -h
# Check network connectivity
code-audit health --detailed
# Try pulling models manually
ollama pull codellama:7b# For global installation issues
sudo npm install -g code-audit-mcp
# For configuration access issues
chmod 755 ~/.code-audit/# Check if already running
code-audit stop
# Check health status
code-audit health
# Check logs
code-audit start # Run in foreground to see errorsEnable verbose output for troubleshooting:
export DEBUG=code-audit:*
code-audit health --detailed# General help
code-audit --help
# Command-specific help
code-audit start --help
code-audit models --help# Full test suite
npm run full-test
# Quick local test
npm run test-local
# Verbose testing
npm run test-local-verbose# Clone and build
git clone <repository>
cd code-audit-mcp
npm install
npm run build
# Test locally before publishing
npm run pack-testSee our Contributing Guidelines for development setup and guidelines.
Need more help? Check our GitHub Issues or start a Discussion.