Fortinet white logo
Fortinet white logo

CLI Reference

waf mcp-security rule

waf mcp-security rule

Use this command to define the technical constraints for MCP traffic, such as URL matching and message size limits.

Syntax

config waf mcp-security rule

edit <mcp-security_rule_name>

set host-status {enable|disable}

set host <host_str>

set url-type {plain|regular}

set url <string>

set exception <mcp-security_exception_name>

set size-limit <integer>

set action {alert|alert_deny|block-period|client-id-block-period|deny_no_log}

set block-period <integer>

set severity {High|Info|Low|Medium}

set trigger <trigger-policy_name>

next

end

Variable

Description

Default

<mcp-security_rule_name> Enter a unique name for the rule that can be referenced by other parts of the configuration.

No default.

host-status {enable|disable} Enable this to restrict the rule to specific hostnames. If disabled, the rule applies to all hosts.

disable

host <host_str> Enter the specific hostname of the AI application or MCP server.

No default.

url-type {plain|regular}

Select whether the Request URL is a Simple String or a Regular Expression.

  • plain — simple string

  • regular — regular expression

plain

url <string>

Enter the URL path where MCP traffic is sent. You can use wildcards (e.g., /folder1/*) to match multiple URLs.

No default.

exception <mcp-security_exception_name> Select an existing MCP Security Policy Exception to exclude trusted traffic from being scanned by this specific rule.

No default.

size-limit <integer> Specify the maximum allowed size (in bytes) for a streamed MCP message block. The range is 0 to 8388607, where 0 means no limitation. This limit applies to the response direction.

4194303

action {alert|alert_deny|block-period|client-id-block-period|deny_no_log}

Select which action FortiWeb will take when it detects a violation of the MCP security policy:

  • alert—Accept the connection and generate an alert email and/or log message.
  • deny_no_log—Block the request (or reset the connection).
  • alert_deny—Block the request (or reset the connection) and generate an alert and/or log message.
  • block-period—Block subsequent requests from the client for a number of seconds.
  • client-id-block-period—Block subsequent requests from the client based on the FortiWeb generated client ID for a number of seconds.

alert

block-period <integer>

Enter the number of seconds that you want to block subsequent requests from the client after the FortiWeb appliance detects that the client has violated the rule.

This setting is available only if action is set to block-period or client-id-block-period. The valid range is from 1 to 3,600 seconds (1 hour).

600

severity {High|Info|Low|Medium}

When rule violations are recorded in the attack log, each log message contains a Severity Level (severity_level) field. Select which severity level to use when FortiWeb logs a violation of the rule:

  • Info
  • Low
  • Medium
  • High

Low

trigger <trigger-policy_name> Select which trigger, if any, to use when FortiWeb logs and/or sends an alert email about a violation of the rule. For details, see "Viewing log messages" on page 1.

No default.

Related topics

waf mcp-security policy

waf mcp-security exception

waf mcp-security rule

waf mcp-security rule

Use this command to define the technical constraints for MCP traffic, such as URL matching and message size limits.

Syntax

config waf mcp-security rule

edit <mcp-security_rule_name>

set host-status {enable|disable}

set host <host_str>

set url-type {plain|regular}

set url <string>

set exception <mcp-security_exception_name>

set size-limit <integer>

set action {alert|alert_deny|block-period|client-id-block-period|deny_no_log}

set block-period <integer>

set severity {High|Info|Low|Medium}

set trigger <trigger-policy_name>

next

end

Variable

Description

Default

<mcp-security_rule_name> Enter a unique name for the rule that can be referenced by other parts of the configuration.

No default.

host-status {enable|disable} Enable this to restrict the rule to specific hostnames. If disabled, the rule applies to all hosts.

disable

host <host_str> Enter the specific hostname of the AI application or MCP server.

No default.

url-type {plain|regular}

Select whether the Request URL is a Simple String or a Regular Expression.

  • plain — simple string

  • regular — regular expression

plain

url <string>

Enter the URL path where MCP traffic is sent. You can use wildcards (e.g., /folder1/*) to match multiple URLs.

No default.

exception <mcp-security_exception_name> Select an existing MCP Security Policy Exception to exclude trusted traffic from being scanned by this specific rule.

No default.

size-limit <integer> Specify the maximum allowed size (in bytes) for a streamed MCP message block. The range is 0 to 8388607, where 0 means no limitation. This limit applies to the response direction.

4194303

action {alert|alert_deny|block-period|client-id-block-period|deny_no_log}

Select which action FortiWeb will take when it detects a violation of the MCP security policy:

  • alert—Accept the connection and generate an alert email and/or log message.
  • deny_no_log—Block the request (or reset the connection).
  • alert_deny—Block the request (or reset the connection) and generate an alert and/or log message.
  • block-period—Block subsequent requests from the client for a number of seconds.
  • client-id-block-period—Block subsequent requests from the client based on the FortiWeb generated client ID for a number of seconds.

alert

block-period <integer>

Enter the number of seconds that you want to block subsequent requests from the client after the FortiWeb appliance detects that the client has violated the rule.

This setting is available only if action is set to block-period or client-id-block-period. The valid range is from 1 to 3,600 seconds (1 hour).

600

severity {High|Info|Low|Medium}

When rule violations are recorded in the attack log, each log message contains a Severity Level (severity_level) field. Select which severity level to use when FortiWeb logs a violation of the rule:

  • Info
  • Low
  • Medium
  • High

Low

trigger <trigger-policy_name> Select which trigger, if any, to use when FortiWeb logs and/or sends an alert email about a violation of the rule. For details, see "Viewing log messages" on page 1.

No default.

Related topics

waf mcp-security policy

waf mcp-security exception