MCP Commands - Logging & Security

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations >

MCP Commands - Logging & Security

MCP Logging & Security - Overview

PreviousTopNext


MiniRobot Language (MRL) - MCP Server Feature

 

MCP Logging & Security

Logging Configuration, Security, and Tool Management

 

What is Logging & Security?

 

The MCP Logging & Security category provides commands for controlling server behavior, managing security policies, and monitoring tool states. These commands allow scripts to configure logging verbosity, request permissions for sensitive operations, manage whitelists for automatic approvals, control tool availability, and set operational timeouts and retention policies.

 

Key Features

 

Flexible Logging: Control log levels, console output, and file logging independently

Permission System: Interactive approval for sensitive operations with user dialogs

Whitelist Support: Automatic approval of trusted actions without user interaction

Tool State Management: Enable, disable, and query tool availability at runtime

Operational Controls: Configure script timeouts and log retention policies

 

Available Commands

 

Logging Configuration:

MCP.SetLogLevel - Configure logging verbosity (DEBUG, INFO, WARNING, ERROR, NONE)

MCP.SetLogToConsole - Enable or disable console output for log messages

MCP.SetLogToFile - Enable or disable file logging with optional path specification

 

Security & Permissions:

MCP.Permission - Request user permission for sensitive operations

MCP.EnableWhitelist - Enable or disable the whitelist for automatic approvals

MCP.GetWhitelist - Retrieve the current whitelist entries

MCP.SetWhitelist - Set or modify the whitelist entries

 

Tool State Management:

MCP.ToolGetState - Get the current state (enabled/disabled) of a specific tool

MCP.ToolSetState - Enable or disable a specific tool

MCP.ToolGetStatePattern - Query tool states using wildcard patterns

 

Timeouts and Retention:

MCP.SetScriptTimeout - Set the maximum execution time for scripts

MCP.GetRetentionTime - Get the current log retention time setting

MCP.SetRetentionTime - Set the log retention time (how long logs are kept)

 

SLL Implementation

 

The Logging & Security commands are implemented in the core MCP server files. These functions are available as intrinsic server commands and operate on the server's internal state.

 

Core SLL Functions:

SetLogLevel - Sets the current logging verbosity level

SetLogToConsole - Controls console output for log messages

SetLogToFile - Controls file logging and log file path

Permission - Requests user permission for sensitive operations

EnableWhitelist - Enables or disables whitelist processing

GetWhitelist - Retrieves current whitelist entries

SetWhitelist - Sets whitelist entries for automatic approval

SetScriptTimeout - Sets maximum script execution time

GetRetentionTime - Gets the current log retention period

SetRetentionTime - Sets the log retention period

ToolGetState - Gets the enabled/disabled state of a tool

ToolSetState - Sets the enabled/disabled state of a tool

ToolGetStatePattern - Gets states of tools matching a pattern

 

Logging Configuration

 

The logging system provides fine-grained control over how log messages are handled:

 

Log Levels:

• DEBUG - All messages including detailed debug information

• INFO - Informational messages and above

• WARNING - Warnings and errors only

• ERROR - Errors only

• NONE - No logging

 

Console and file logging can be enabled independently. When file logging is enabled, log messages are written to a specified file path.

 

Security & Permissions

 

The permission system provides a security layer for sensitive operations:

• User confirmation dialogs for dangerous operations

• Whitelist for automatic approval of trusted actions

• Configurable action descriptions for user clarity

 

When the whitelist is enabled and an action matches a whitelist entry, permission is automatically granted without displaying a dialog.

 

Tool State Management

 

Tool state commands allow dynamic control over which MCP tools are available:

• Query individual tool states with MCP.ToolGetState

• Enable or disable tools at runtime with MCP.ToolSetState

• Query multiple tools using wildcards with MCP.ToolGetStatePattern

 

This is useful for creating restricted execution environments, testing scenarios, or dynamically adapting to system capabilities.

 

Timeouts and Retention

 

Operational controls manage script execution limits and log lifecycle:

• Script timeouts prevent runaway executions

• Log retention policies control storage usage

 

These settings help maintain system stability and prevent resource exhaustion from excessive log accumulation.

 

Example Usage

 

' Configure logging for troubleshooting

MCP.SetLogLevel|DEBUG

MCP.SetLogToConsole|TRUE

 

' Request permission before deleting files

MCP.Permission|FileDelete|Delete old temporary files?|$$Allowed

IVV.$$Allowed!TRUE

FIL.Delete|C:\temp\old.log

EIF.

 

' Check if a tool is available before using it

MCP.ToolGetState|RegistryWrite|$$RegState

IVV.$$RegState!ENABLED

REG.Write|HKCU\Software\MyApp|Value|Data

EIF.

 

Important Notes

 

• Logging settings take effect immediately but may not persist across server restarts

• Permission dialogs block script execution until the user responds

• Whitelist entries must match action identifiers exactly (case-sensitive)

• Tool state changes are immediate and affect all subsequent calls

• Script timeouts should be set based on expected execution time plus a safety margin

• Log retention policies may require periodic maintenance tasks to clean up old files

 

See also:

 

MCP.SetLogLevel - Set Logging Level

MCP.Permission - Request Permission

MCP.ToolGetState - Get Tool State

MCP Memory Bank - Overview

!HTP-MCP Overview