crowdsec-local-mcp

v0.9.3
crowdsec-local-mcp Checked 14 hours ago Published 1 month ago

An MCP exposing prompts and tools to help users write WAF rules, scenarios etc.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_waf_top_level_prompt

Get the top-level CrowdSec WAF workflow prompt that explains how to approach rule and test creation

get_waf_prompt

Get the main WAF rule generation prompt for CrowdSec

get_waf_examples

Get WAF rule generation examples for CrowdSec

generate_waf_rule

Get the complete WAF rule generation prompt (main prompt + examples) for CrowdSec

ParameterTypeDescription
nuclei_templatestringOptional Nuclei template to include in the prompt for immediate processing

generate_waf_tests

Get the WAF test generation prompt for producing config.yaml and adapted Nuclei templates

ParameterTypeDescription
nuclei_templatestringOptional Nuclei template to include so the assistant can adapt it for testing
rule_filenamestringOptional path to the generated rule (e.g. ./appsec-rules/crowdsecurity/vpatch-CVE-XXXX-YYYY.yaml)

get_waf_pr_prompt

Get the WAF PR preparation prompt for writing test assets and drafting a PR comment

get_waf_rule_challenge_prompt

Get the prompt for challenging drafted WAF rules to reduce false positives and weak detections

run_waf_tests

Start the WAF harness and execute the provided nuclei test template against it. If this action fails because docker isn't present or cannot be run, prompt the user to set it up manually.

ParameterTypeDescription
nuclei_yaml *stringAdapted nuclei template YAML that should trigger a block (HTTP 403)
rule_yaml *stringCrowdSec WAF rule YAML to load into the harness before running tests

validate_waf_rule

Validate that a CrowdSec WAF rule YAML is syntactically correct

ParameterTypeDescription
rule_yaml *stringThe YAML content of the WAF rule to validate

lint_waf_rule

Lint a CrowdSec WAF rule and provide warnings/hints for improvement

ParameterTypeDescription
rule_yaml *stringThe YAML content of the WAF rule to lint

deploy_waf_rule

Get deployment instructions for CrowdSec WAF rules

prepare_waf_pr

Help prepare a pull request in a local clone of the CrowdSec hub repository by adding the generated WAF rule and associated test files.

ParameterTypeDescription
hub_dir *stringPath to the local clone of the CrowdSec hub repository
nuclei_filename *stringFilename for the nuclei test template
rule_filename *stringRelative path (from hub root) for the rule file
rule_yaml *stringGenerated WAF rule YAML content
test_config_yaml *stringGenerated AppSec test config.yaml content
test_nuclei_yaml *stringGenerated adapted nuclei template content
collection_namestringTarget collection in the format author/name (mapped to collections/author/name.yaml)

fetch_nuclei_exploit

Retrieve nuclei templates from the official repository for a CVE to help with generation of WAF rules

ParameterTypeDescription
cve *stringCVE identifier to search for (e.g. CVE-2024-12345)

manage_waf_stack

Start or stop the Docker-based CrowdSec AppSec test stack so the rule can be exercised with allowed and blocked requests. If this action fails because docker isn't present or cannot be run, prompt the user to set it up manually.

ParameterTypeDescription
action *stringWhether to start or stop the stack
rule_yamlstringWAF rule YAML content to mount into the stack when starting

curl_waf_endpoint

Execute an HTTP request against the local WAF test endpoint (http://localhost:8081)

ParameterTypeDescription
method *stringHTTP method to use
path *stringRequest path (e.g. /, /admin?x=y). Automatically prefixed with http://localhost:8081
bodystringOptional request body
headersobjectOptional headers to include
timeoutnumberOptional curl timeout in seconds

get_scenario_prompt

Retrieve the base prompt for authoring CrowdSec scenarios

get_scenario_examples

Retrieve example CrowdSec scenarios and annotations

get_scenario_expr_helpers

Retrieve helper expressions for CrowdSec scenario authoring

validate_scenario_yaml

Validate CrowdSec scenario YAML structure for required fields

ParameterTypeDescription
scenario_yaml *stringScenario YAML to validate

lint_scenario_yaml

Lint CrowdSec scenario YAML and highlight potential improvements

ParameterTypeDescription
scenario_yaml *stringScenario YAML to lint

deploy_scenario

Retrieve guidance for packaging and deploying a CrowdSec scenario

manage_scenario_stack

Manage the lifecycle of the scenario testing stack (ONLY USE FOR TESTING SCENARIOS)

ParameterTypeDescription
action *stringAction to perform on the scenario testing stack

explain_scenario

Shows how crowdsec processes a single log line: what is extracted by the parsers, and which scenarios match. A match does not mean an alert is generated, only that the event was of interest for the scenario. This tool MUST NEVER be called with multiple log lines. If you need to test whether a scenario generates an alert, use the `test_scenario` tool instead. The scenario stack (manage_scenario_stack) must be running to use this tool.

ParameterTypeDescription
collections *arrayList of CrowdSec collections to install alongside the scenario
log_line *stringA single example log line that should trigger the scenario
log_type *stringType of logs the scenario is intended to analyze
scenario_yaml *stringScenario YAML to explain

test_scenario

Test a CrowdSec scenario against multiple log lines (effectively replaying the events as if they were occurring in real-time).

ParameterTypeDescription
collections *arrayList of CrowdSec collections to install alongside the scenario
log_lines *arrayList of log lines to test against the scenario
log_type *stringType of logs the scenario is intended to analyze
scenario_yaml *stringScenario YAML to test