CLI Configuration
Configure the MCPSafe CLI using config files, environment variables, or command-line options.
Configuration Priority
Configuration values are loaded in the following order (later values override earlier ones):
- 1Default values - Built-in defaults
- 2Global config file - ~/.mcpsafe/config.json
- 3Project config - package.json or mcp.config.json
- 4Environment variables - MCPSAFE_* variables
- 5Command-line options - Flags passed to commands
Config File Locations
Global Config
~/.mcpsafe/config.jsonUser-wide settings that apply to all projects
Project Config
./mcp.config.jsonProject-specific settings (or in package.json)
Configuration Options
apiKeyYour MCPSafe API key for authentication
mcp_abc12345_xxxxxxxxxxxxxxxxformatDefault output format for scan results
json | sarif | tablefailOnDefault severity threshold for failure
critical | high | medium | lowquietSuppress non-essential output
true | falseignorePatterns to ignore during scanning
["node_modules", "*.test.ts"]Project Configuration
package.json
Add mcpsafe config to your existing package.json
{
"mcpsafe": {
"ignore": [
"node_modules",
"dist",
"**/*.test.ts",
"**/*.spec.ts"
],
"failOn": "high",
"rules": {
"CMD001": "warn",
"PATH002": "error"
}
}
}mcp.config.json
Standalone configuration file in project root
{
"name": "my-mcp-server",
"version": "1.0.0",
"mcpsafe": {
"ignore": ["tests/**", "examples/**"],
"failOn": "critical"
}
}Environment Variables
MCPSAFE_API_KEYAPI key for authentication (overrides config file)
MCPSAFE_CONFIGPath to custom config file
MCPSAFE_FORMATDefault output format
MCPSAFE_FAIL_ONDefault failure threshold
CIWhen set, enables CI-friendly output (no colors, no spinners)
# Example .env or shell profile
export MCPSAFE_API_KEY="mcp_abc12345_xxxxxxxxxxxxxxxx"
export MCPSAFE_FORMAT="json"
export MCPSAFE_FAIL_ON="high"Rule Configuration
Custom Rule Severity
Override the default severity for specific rules
{
"mcpsafe": {
"rules": {
"CMD001": "error", // Treat as error (fail scan)
"PATH002": "warn", // Treat as warning (report but don't fail)
"INFO001": "off" // Disable this rule entirely
}
}
}"error" - Fail the scan if this rule triggers
"warn" - Report the issue but don't fail
"off" - Completely disable the rule