Skip to content

MCP Server

thibaut severac edited this page Oct 27, 2026 · 1 revision

MCP server

crowdsec-mcp exposes CrowdSec decisions, alerts and allowlists to an LLM through the Model Context Protocol. It is read-only by default and supports the stdio and Streamable HTTP transports.

Full documentation: package README.

Quick start

npx -y crowdsec-mcp

With a bouncer API key (read decisions):

CROWDSEC_URL=https://crowdsec:8080 \
CROWDSEC_API_KEY=your-bouncer-key \
npx -y crowdsec-mcp

With a watcher (alerts, allowlists, write tools):

CROWDSEC_URL=https://crowdsec:8080 \
CROWDSEC_MACHINE_ID=crowdsec-mcp \
CROWDSEC_PASSWORD=your-password \
npx -y crowdsec-mcp

Authentication

The mode is detected from the provided credentials, or forced with CROWDSEC_AUTH:

Mode Credentials Capabilities
bouncer CROWDSEC_API_KEY read decisions
watcher CROWDSEC_MACHINE_ID + CROWDSEC_PASSWORD alerts, decisions, allowlists, writes
either CROWDSEC_TLS_CERT + CROWDSEC_TLS_KEY + CROWDSEC_TLS_CA mutual TLS

See Authentications for how to create these credentials.

Safety

  • Read-only by default (CROWDSEC_MCP_READONLY=true); enable write tools explicitly.
  • The HTTP transport requires a bearer token (CROWDSEC_MCP_HTTP_TOKEN).
  • delete_alerts stays disabled unless CROWDSEC_MCP_ENABLE_ALERT_DELETE=true.
  • CROWDSEC_MCP_MAX_BAN_DURATION caps the ban duration (default 24h) unless force is used.
  • Prefer environment variables over command-line arguments for secrets: command lines are visible in the process list.

Client configuration

The package README contains ready-to-copy snippets for Claude Desktop/Code, Cursor and opencode. In short, register npx -y crowdsec-mcp as a stdio MCP server and pass the CROWDSEC_* variables in its env block.

Clone this wiki locally