MCP Commands - Command Filtering

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > Status & Configuration - Server status and features >

MCP Commands - Command Filtering

MCP.SetCMDFilter - Set Command Filter

PreviousTopNext


MiniRobot Language (MRL) - MCP Command Filtering Commands

 

MCP.SetCMDFilter

Set Command Filter Rules

 

Purpose

 

The MCP.SetCMDFilter command configures command filtering rules for the MCP server. This allows selective enabling or disabling of specific commands or command patterns for security and access control purposes.

 

This command is useful for:

• Restricting available commands for security

• Creating sandboxed environments

• Implementing command whitelists or blacklists

• Controlling access to sensitive operations

 

Syntax

 

MCP.SetCMDFilter|$$FILTER_TYPE|$$FILTER_PATTERN|$$ACTION

 

Parameters

 

$$FILTER_TYPE - The type of filter: INCLUDE (whitelist), EXCLUDE (blacklist), REGEX (regular expression pattern), or PREFIX (command prefix matching).

 

$$FILTER_PATTERN - The pattern to match against commands. Can be a specific command name, wildcard pattern, or regular expression depending on filter type.

 

$$ACTION - The action to take when pattern matches: ALLOW or DENY.

 

Return Value

 

Returns a status code indicating the result:

OK - Filter rule was successfully added

INVALID - Invalid filter type or pattern

ERROR - Failed to set filter

 

Examples

 

' Example 1: Block all registry commands

MCP.SetCMDFilter|PREFIX|REG.|DENY

PRT.Registry commands blocked

 

' Example 2: Whitelist only memory commands

MCP.SetCMDFilter|INCLUDE|MEM.*|ALLOW

MCP.SetCMDFilter|INCLUDE|MCP.GetStatus|ALLOW

MCP.SetCMDFilter|INCLUDE|DEFAULT|DENY

 

' Example 3: Block specific dangerous command

MCP.SetCMDFilter|EXCLUDE|SYS.EXEC|DENY

 

Remarks

 

Command filters are processed in order, with the first matching filter determining the action. Filters persist until cleared or the server restarts. Use DEFAULT as the pattern to specify the default action for unmatched commands.

 

When using INCLUDE filters, remember to explicitly allow essential commands like MCP.GetStatus. Filters are evaluated before any feature checks.

 

Error Conditions

 

The command will fail with an error if:

• The filter type parameter is missing or invalid

• The pattern parameter is missing

• The action parameter is missing or invalid

• Too many parameters are provided

 

See also:

 

MCP.GetCMDFilter - Get Command Filter

MCP.SaveCMDFilter - Save Command Filter

MCP.LoadCMDFilter - Load Command Filter