|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > MCP Commands - Server Operations |
MiniRobot Language (MRL) - MCP Server Feature
MCP Server Operations
Control, Execute, and Manage the MCP Server
What are Server Operations?
The MCP Server Operations commands provide advanced control over the MCP server beyond basic lifecycle management. These commands enable execution of server-side actions, signal-based control, registration with external services, and communication with the calling environment.
Key Features
• Server Control Signals: Send control signals for reload, shutdown, flush, and maintenance
• Action Execution: Execute server-side actions and tools programmatically
• External Registration: Register with LM Studio and custom host applications
• Command Execution: Run system commands on the MCP server with output capture
• Event Simulation: Simulate MCP events for testing and debugging
• Result Handling: Return results to callers and manage command responses
• Dynamic Configuration: Modify server configuration without restart
Available Commands
Execution Commands:
MCP.Exec - Execute an action or tool on the MCP server
MCP.RunCommand - Run a system command on the MCP server with timeout and output capture
Server Control Commands:
MCP.Signal - Send control signals (RELOAD, SHUTDOWN, FLUSH, etc.) to the server
MCP.WriteConfig - Write configuration settings dynamically
Registration Commands:
MCP.RegisterLMStudio - Register the MCP server with LM Studio for LLM integration
MCP.RegisterWithHost - Register with a custom host application or MCP client
Communication Commands:
MCP.ReturnResult - Return results to the original caller (for custom processors)
MCP.Simulate - Simulate MCP events for testing and debugging
SLL Implementation
The Server Operations commands are implemented in the following core MCP source files:
MCP_Register.inc
• RegisterLMStudio - Registration with LM Studio
• RegisterWithHost - Registration with host application
• WriteConfig - Configuration file management
Core Server (MCP_Server.bas)
• Exec - Action execution handler
• Signal - Signal processing and dispatch
• Simulate - Event simulation engine
• ReturnResult - Result callback handler
SystemTools
• RunCommand - System command execution with security controls
Server Control (Signals)
The MCP.Signal command provides controlled management of the MCP server through signal-based operations:
RELOAD - Reload configuration from disk without restart
SHUTDOWN - Initiate graceful server shutdown
FLUSH - Clear caches and temporary data
ROTATE_LOGS - Rotate log files
PING - Check server responsiveness
RESET - Reset internal state and connections
Registration
LM Studio Registration:
Use MCP.RegisterLMStudio to connect the MCP server with LM Studio for local LLM capabilities. This enables AI-powered tool integrations and model context protocol features.
Host Registration:
Use MCP.RegisterWithHost to register with custom host applications or third-party MCP clients. This provides a generic registration mechanism for any MCP-compatible host.
Execution
MCP.Exec:
Executes MCP server actions and tools through a generic interface. This is the primary way to invoke server capabilities programmatically from MiniRobot scripts.
MCP.RunCommand:
Executes system-level commands on the MCP server machine with comprehensive output capture (stdout, stderr, exit code, duration). Includes timeout controls and security considerations.
Example Usage
' Register with LM Studio for AI capabilities
MCP.RegisterLMStudio|localhost|1234|$$RegResult
PRT.LM Studio registration: $$RegResult
' Reload configuration without restart
MCP.Signal|RELOAD||$$ReloadResult
' Execute a server action
MCP.Exec|GetSystemInfo||$$SysInfo
' Run system command with timeout
MCP.RunCommand|dir|/b|30|$$DirOutput
' Simulate an event for testing
$$EventData={"command":"TEST","source":"debug"}
MCP.Simulate|COMMAND_RECEIVED|$$EventData|$$SimResult
Important Notes
• Server Operations commands require the MCP server to be running
• MCP.RunCommand has security implications - use with proper access controls
• Registration commands may need to be reissued after server restart
• Signal processing is asynchronous - check return values for status
• MCP.WriteConfig changes are persisted but may require reload to take effect
• Use MCP.Simulate only in development/testing environments
See also:
• MCP.RegisterLMStudio - LM Studio Registration
• MCP.RunCommand - Run Command