Skip to content

Configuration

MCP Stress Test can be configured through three methods, listed in order of precedence (highest first):

  1. CLI flags — Override any setting for a single command.
  2. Config file — A JSON file loaded via --config / -c flag.
  3. Environment variables — Prefixed with MCP_STRESS_.

If no configuration is provided, sensible defaults are used.

Create a stress-config.json file:

{
"llm": {
"provider": "ollama",
"model": "llama3.2",
"base_url": "http://localhost:11434",
"temperature": 0.7,
"max_tokens": 500,
"timeout_seconds": 30
},
"scanner": {
"default_scanner": "mock",
"tool_scan_path": null,
"timeout_ms": 5000,
"retry_count": 3
},
"report": {
"default_format": "markdown",
"output_dir": "./reports",
"include_raw_results": false,
"html_template": null
},
"fuzz": {
"max_generations": 10,
"mutation_rate": 0.3,
"evasion_threshold": 0.5,
"save_evasions": true,
"evasion_output_dir": "./evasions"
},
"chain": {
"max_chain_length": 5,
"step_delay_ms": 100,
"fail_fast": false
},
"verbose": false,
"parallel_workers": 1,
"cache_results": true,
"cache_dir": "./.stress-cache"
}

Pass it to any command:

Terminal window
mcp-stress -c stress-config.json scan compare -t read_file -s obfuscation

Controls the Ollama connection used for LLM-guided fuzzing.

FieldTypeDefaultDescription
providerstring"ollama"LLM provider (currently only ollama)
modelstring"llama3.2"Ollama model name
base_urlstring"http://localhost:11434"Ollama API base URL
temperaturefloat0.7Sampling temperature for mutations
max_tokensint500Max tokens per LLM response
timeout_secondsint30Request timeout

Controls which scanner is used and how it behaves.

FieldTypeDefaultDescription
default_scannerstring"mock"Scanner to use: mock, tool-scan, or cli
tool_scan_pathstringnullPath to tool-scan binary (auto-detected if on PATH)
timeout_msint5000Scan timeout per tool
retry_countint3Retries on scanner failure

Controls report generation defaults.

FieldTypeDefaultDescription
default_formatstring"markdown"Default output format
output_dirstring"./reports"Directory for report output
include_raw_resultsboolfalseInclude raw scan data in reports
html_templatestringnullCustom Jinja2 template for HTML reports

Controls fuzzing behavior and evasion testing.

FieldTypeDefaultDescription
max_generationsint10Maximum mutation generations per run
mutation_ratefloat0.3Probability of mutating each token
evasion_thresholdfloat0.5Scanner score below which evasion is declared
save_evasionsbooltrueAutomatically save discovered evasions
evasion_output_dirstring"./evasions"Directory for saved evasions

Controls attack chain execution.

FieldTypeDefaultDescription
max_chain_lengthint5Maximum steps in a chain
step_delay_msint100Delay between chain steps
fail_fastboolfalseStop chain on first detection
FieldTypeDefaultDescription
verboseboolfalseEnable verbose output
parallel_workersint1Number of parallel workers
cache_resultsbooltrueCache scan results
cache_dirstring"./.stress-cache"Cache directory

Every config field has a corresponding environment variable prefixed with MCP_STRESS_:

VariableMaps to
MCP_STRESS_LLM_MODELllm.model
MCP_STRESS_LLM_URLllm.base_url
MCP_STRESS_LLM_PROVIDERllm.provider
MCP_STRESS_SCANNER_DEFAULTscanner.default_scanner
MCP_STRESS_TOOL_SCAN_PATHscanner.tool_scan_path
MCP_STRESS_REPORT_FORMATreport.default_format
MCP_STRESS_REPORT_DIRreport.output_dir
MCP_STRESS_VERBOSEverbose (accepts true, 1, yes)
MCP_STRESS_WORKERSparallel_workers

Example:

Terminal window
export MCP_STRESS_LLM_MODEL=codellama
export MCP_STRESS_SCANNER_DEFAULT=tool-scan
mcp-stress scan compare -t read_file -s obfuscation

When using the Python API, create a StressConfig directly:

from mcp_stress_test.core.config import StressConfig, LLMConfig, ScannerConfig
config = StressConfig(
llm=LLMConfig(model="codellama", temperature=0.9),
scanner=ScannerConfig(default_scanner="tool-scan"),
verbose=True,
)
# Or load from file
config = StressConfig.from_file("stress-config.json")
# Or load from environment
config = StressConfig.from_env()
# Save current config
config.save("my-config.json")