MCP. - MCP Server Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations > !Server-Lifecycle - Commands for managing the MCP server lifecycle (init, start, stop) >

MCP. - MCP Server Operations

MCP.StartSprServer

Previous Top Next


SPR Script Language

 

MCP.StartSprServer

Starts the MCP server in the dedicated Listener Mode for SSPR integration.

 

Intention

 

This command is a specialized shortcut for launching the MCP server in Listener Mode. It is the primary method for integrating the server with a main SSPR application. It automatically uses the main SSPR window handle (`HG`) to ensure the server thread can shut down correctly when the main application closes.

 

The server will start listening for TCP connections and place any received commands into a queue, which the main script can then poll using HTP.MCPGetNextCommand.

 

Syntax

 

MCP.StartSprServer[|$$cfg|$$ret]

 

Parameter Explanation

 

P1 - $$cfg - (Variable, Optional)

A variable containing the path to a JSON configuration file. If omitted, uses default settings.

 

P2 - $$ret - (Variable, Optional)

A variable to store the thread handle. Receives a positive number on success, or 0 on failure. If omitted, the handle is pushed to the stack.

 

Examples

 

'***********************************

' MCP.StartSprServer - Sample 1: Start with defaults

'***********************************

MCP.StartSprServer||$$thr

JIZ.$$thr|Fail

MBX.Listener Server started with thread handle: $$thr

...

MCP.Stop

 

'***********************************

' MCP.StartSprServer - Sample 2: Start with custom config

'***********************************

VAR.$$cfg=?path\mcp_config.json

MCP.StartSprServer|$$cfg|$$thr

JIZ.$$thr|Fail

PRT.Listener Server started with thread handle: $$thr

...

MCP.Stop

 

 

Remarks

 

- This is a wrapper for MCP.Start||1|HG|.... It ensures the server starts in the correct mode and is linked to the main application window.

- Use this command instead of the generic MCP.Start when you intend for your SSPR script to be the primary processor of commands.

 

See also:

 

MCP.Start

MCP.GetNextCommand

MCP.Stop