MCPServer Component
Properties Methods Events Config Settings Errors
Implements an easy way to expose custom tools, prompts, and resources to Model Context Protocol (MCP) clients.
Syntax
TsdmMCPServer
Remarks
The MCPServer component provides a simple, event-driven API for interacting with clients that use the Model Context Protocol (MCP).
Supported Transport Mechanisms
The MCPServer component supports multiple transport mechanisms that are used to facilitate communication, which can be specified by setting the Transport property.
For local communication scenarios, such as when the server is launched as a subprocess of a client application, the component is capable of communicating via standard input and output streams. This setup is simple and enables direct data exchange between the client and server within the same process environment.
In remote deployment scenarios, where the server must be accessible to multiple concurrent clients across a network, the component also supports HTTP as the transport layer, using standard HTTP requests and responses for communication. To accommodate different hosting needs, the component includes a built-in embedded HTTP server, but it can also be integrated into an existing web infrastructure such as ASP.NET Core, Apache Tomcat, or other frameworks.
While the developer experience is largely the same between these, there are some differences in authentication and request processing depending on how the server is hosted. Comprehensive information on these hosting options and configuration can be found in the Hosting Options page.
Key Features
The MCPServer component supports all major MCP functionality, including tools, prompts, resources, and sampling.
Tools
Tools provide an opportunity for LLM clients to execute custom code, interact with external systems, and access dynamic or external data. Anything for which a function can be written can also be exposed as a tool. Common examples include database queries, file operations, or computations.
Registering Tools
Tools must be registered with the server via the RegisterTool method to be exposed to the client. Each registration requires a unique Name and a natural language Description. The name identifies the tool, while the description helps LLM clients determine when to use it. Since tool selection is client-driven, writing clear and specific descriptions is key to improving tool usage accuracy.
A tool may have zero or more associated parameters. Each parameter must be registered before the tool it will be associated with. Each parameter requires a Name and a Required boolean indicating if that parameter is required.
server.RegisterToolParam("limit", false);
server.RegisterTool("random-num", "Generates a random number");
Handling Tool Invocations
Once a tool is registered, the client may invoke it at any time. When this occurs, the ToolRequest event is fired. This event includes the Name of the requested tool, which the server can use to determine how to respond. If the tool requires input, the server can retrieve parameters from the client using the GetToolParamValue method.
If the tool completes successfully and needs to return output, the server may respond using the AddToolMessage method. If an error occurs, such as an unrecognized tool is requested or a failure occurs during execution, the server should set the IsError parameter to true to inform the client that the request failed.
server.OnToolRequest += (s, e) =>
{
if (e.Name == "random-num")
{
server.AddToolMessage((int)TToolMessageTypes.mtText, randomNum);
}
else
{
e.IsError = true;
}
};
Prompts
Prompts are predefined conversation starters or instructions that can be quickly inserted into the LLM's context to guide specific interactions or workflows. Prompts serve as standardized templates for common conversational patterns and allow for consistent responses for tasks like reviewing code, analyzing data, or answering specific types of questions. Prompts may also include arguments that allow runtime customization.
Unlike tools, prompts are user-driven. The client does not select prompts on its own; instead, the user chooses when and which prompt to insert, which allows for consistent and reusable guidance tailored to specific workflows.
Registering Prompts
Prompts must be registered with the server via the RegisterPrompt method to be exposed to the client. Each registration requires a unique Name and a natural language Description. The name identifies the prompt, while the description helps the user understand its purpose. Once registered, the prompt becomes available for the end user to insert into the client context as needed.
A prompt may have zero or more associated arguments. Each argument must be registered before the prompt it will be associated with. Each argument requires a Name and a Required boolean indicating if that argument is required.
// Define argument schema.
server.RegisterPromptArg("code", true);
server.RegisterPromptArg("language", false);
// Register the prompt.
string name = "explain-code";
string description = "Explain how code works";
server.RegisterPrompt(name, description);
Handling Prompt Requests
When a user selects a prompt, the client notifies the server, causing the PromptRequest event to be fired. This event includes the Name of the requested prompt, allowing the server to determine the correct response to be sent using the AddPromptMessage method. Any related prompt arguments may also be retrieved by their associated name using the GetPromptParamValue method.
server.OnPromptRequest += (s, e) =>
{
// Retrieve runtime values sent by client.
string code = server.GetPromptParamValue("code");
string language = server.GetPromptParamValue("language") ?? "Unknown";
// Build response messages.
// Assuming the client sent 'a = 1 + 2;' for the 'code' argument, and 'python' for the 'language' argument.
server.AddPromptMessage((int)TRoles.rtAssistant, "Don't add comments.");
server.AddPromptMessage((int)TRoles.rtUser, $"Explain how this {language} code works:\n\n{code}");
};
Resources
Resources provide persistent, read-only content that can be requested once by the user and reused throughout the session. These are typically static files such as documentation, source code, or other reference materials that help provide context for LLM interactions.
Registering Resources
Resources must be registered with the server via the RegisterResource method to be exposed to the client. Each registration requires a unique Uri, a short display Name, and a natural language Description.
server.RegisterResource("file://server.cs", "Server Demo", "The source code for a simple MCP SDK Server Demo");
Handling Resource Requests
When a user requests a resource, the ResourceRequest event is fired. This event includes the Uri of the requested resource, allowing the server to locate and load the correct resource using the AddResourceContent method. The client will manage the resource afterward, making it available for reuse as needed.
server.OnResourceRequest += (s, e) =>
{
string fileName = e.Uri.Substring("file://".Length);
if (File.Exists(fileName))
{
string content = File.ReadAllText(fileName);
server.AddResourceContent(e.Uri, content, "text/plain");
}
};
Property List
The following is the full list of the properties of the component with short descriptions. Click on the links for further details.
Listening | Whether the component is listening for incoming connections. |
ProcessingMode | The mode in which the component will be hosted. |
PromptCount | The number of records in the Prompt arrays. |
PromptDescription | The brief, human-readable description of what the prompt does. |
PromptName | The unique name associated with the prompt. |
RegisteredPromptArgCount | The number of records in the RegisteredPromptArg arrays. |
RegisteredPromptArgDescription | The brief, human-readable description of what information should be provided to this argument. |
RegisteredPromptArgName | The unique name associated with the prompt argument. |
RegisteredPromptArgRequired | Whether the prompt argument must be supplied by the client when requesting the prompt. |
RegisteredToolParamCount | The number of records in the RegisteredToolParam arrays. |
RegisteredToolParamParamType | The type of data associated with the tool parameter. |
RegisteredToolParamValue | The value associated with the tool parameter. |
Request | The body of the HTTP request to be processed by the component. |
RequestHeaders | The full set of headers of the HTTP request to be processed by the component. |
ResourceCount | The number of records in the Resource arrays. |
ResourceDescription | The brief, human-readable description of the purpose of the resource as well as appropriate use cases. |
ResourceMimetype | The media type of the resource content. |
ResourceName | The display name associated with the resource. |
ResourceSize | The size of the resource content, in bytes. |
ResourceUri | The unique resource identifier associated with the resource. |
Response | The body of the HTTP response generated after processing a request with the component. |
ResponseHeaders | The full set of headers of the HTTP response generated after processing a request with the component. |
SamplingMessageCount | The number of records in the SamplingMessage arrays. |
SamplingMessageRole | The speaker or author of the message. |
SamplingMessageText | The instruction that can be passed into the client's language model. |
ServerCertEffectiveDate | The date on which this certificate becomes valid. |
ServerCertExpirationDate | The date on which the certificate expires. |
ServerCertExtendedKeyUsage | A comma-delimited list of extended key usage identifiers. |
ServerCertFingerprint | The hex-encoded, 16-byte MD5 fingerprint of the certificate. |
ServerCertFingerprintSHA1 | The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. |
ServerCertFingerprintSHA256 | The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. |
ServerCertIssuer | The issuer of the certificate. |
ServerCertPrivateKey | The private key of the certificate (if available). |
ServerCertPrivateKeyAvailable | Whether a PrivateKey is available for the selected certificate. |
ServerCertPrivateKeyContainer | The name of the PrivateKey container for the certificate (if available). |
ServerCertPublicKey | The public key of the certificate. |
ServerCertPublicKeyAlgorithm | The textual description of the certificate's public key algorithm. |
ServerCertPublicKeyLength | The length of the certificate's public key (in bits). |
ServerCertSerialNumber | The serial number of the certificate encoded as a string. |
ServerCertSignatureAlgorithm | The text description of the certificate's signature algorithm. |
ServerCertStore | The name of the certificate store for the client certificate. |
ServerCertStorePassword | If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store. |
ServerCertStoreType | The type of certificate store for this certificate. |
ServerCertSubjectAltNames | Comma-separated lists of alternative subject names for the certificate. |
ServerCertThumbprintMD5 | The MD5 hash of the certificate. |
ServerCertThumbprintSHA1 | The SHA-1 hash of the certificate. |
ServerCertThumbprintSHA256 | The SHA-256 hash of the certificate. |
ServerCertUsage | The text description of UsageFlags . |
ServerCertUsageFlags | The flags that show intended use for the certificate. |
ServerCertVersion | The certificate's version number. |
ServerCertSubject | The subject of the certificate used for client authentication. |
ServerCertEncoded | The certificate (PEM/Base64 encoded). |
ServerSettingsAllowedAuthMethods | Specifies the authentication schemes that the component will allow. |
ServerSettingsLocalHost | Specifies the name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
ServerSettingsLocalPort | Includes the Transmission Control Protocol (TCP) port in the local host where the component listens. |
ServerSettingsTimeout | Specifies the timeout in seconds for the component. |
SystemPrompt | An instruction sent to the client's language model to influence its behavior during a sampling request. |
ToolCount | The number of records in the Tool arrays. |
ToolDescription | The brief, human-readable description of what the tool does. |
ToolName | The unique name associated with the tool. |
Transport | The transport mechanism used for communication. |
Method List
The following is the full list of the methods of the component with short descriptions. Click on the links for further details.
AddPromptMessage | Adds a prompt message to be returned during a prompt request. |
AddResourceContent | Adds data to be returned during a resource request. |
AddToolMessage | Adds a tool message to be returned during a tool request. |
Config | Sets or retrieves a configuration setting. |
DoEvents | Processes events from the internal queue. |
GetPromptParamValue | Retrieves the value of an existing prompt parameter. |
GetToolParamValue | Retrieves the value of an existing tool parameter. |
ProcessRequest | Processes the request and sends the result. |
ProcessRequests | Instructs the component to start processing incoming requests. |
RegisterPrompt | Registers a prompt that can be requested by the client. |
RegisterPromptArg | Registers an argument for a prompt. |
RegisterResource | Registers a resource that can be requested by the client. |
RegisterTool | Registers a tool that can be requested by the client. |
RegisterToolParam | Registers a parameter for a tool. |
SendSamplingRequest | Requests language model reasoning from the client. |
StartListening | Instructs the component to start listening for incoming connections. |
StopListening | Instructs the component to stop listening for new connections. |
UnregisterPrompt | Unregisters an existing prompt. |
UnregisterResource | Unregisters an existing resource. |
UnregisterTool | Unregisters an existing tool. |
Event List
The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.
Error | Fires when an error occurs during operation. |
Log | Fires once for each log message. |
PromptRequest | Fires when a prompt is requested by the client. |
ResourceRequest | Fires when a resource is requested by the client. |
SessionEnd | Fires when the component ends a session. |
SessionStart | Fires when the component starts a session. |
ToolRequest | Fires when a tool is requested by the client. |
Config Settings
The following is a list of config settings for the component with short descriptions. Click on the links for further details.
LogLevel | Specifies the level of detail that is logged. |
MaxTokens | Specifies the maximum number of tokens to generate when sampling the client's LLM. |
PageSizePrompts | Specifies the page size to use when responding to prompt listing requests from the client. |
PageSizeResources | Specifies the page size to use when responding to resource listing requests from the client. |
PageSizeTools | Specifies the page size to use when responding to tool listing requests from the client. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
MaskSensitiveData | Whether sensitive data is masked in log messages. |
UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
Listening Property (MCPServer Component)
Whether the component is listening for incoming connections.
Syntax
__property bool Listening = { read=FListening };
Default Value
false
Remarks
When the Transport property is set to ttStdio, or it is set to ttHTTP and the ProcessingMode property is set to modeEmbeddedServer, this property indicates whether the component is listening for connections on the port specified by the property.
The StartListening and StopListening methods can be used to control whether the component is listening.
This property is read-only.
Data Type
Boolean
ProcessingMode Property (MCPServer Component)
The mode in which the component will be hosted.
Syntax
__property TsdmMCPServerProcessingModes ProcessingMode = { read=FProcessingMode, write=FSetProcessingMode };
enum TsdmMCPServerProcessingModes { modeEmbeddedServer=0, modeExternalServer=1, modeOffline=2 };
Default Value
modeEmbeddedServer
Remarks
When the Transport property is set to ttHTTP, this property governs whether the component operates via the embedded HTTP server, an external server, or in a fully-offline mode. Possible values are as follows:
- modeEmbeddedServer (0, default): Uses the embedded server.
- modeExternalServer (1): Uses an external server framework.
- modeOffline (2): Uses offline processing.
Please refer to the Hosting Options pages to learn more about the different processing modes and how they relate to configuring a host server.
Data Type
Integer
PromptCount Property (MCPServer Component)
The number of records in the Prompt arrays.
Syntax
__property int PromptCount = { read=FPromptCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at PromptCount - 1.This property is read-only and not available at design time.
Data Type
Integer
PromptDescription Property (MCPServer Component)
The brief, human-readable description of what the prompt does.
Syntax
__property String PromptDescription[int PromptIndex] = { read=FPromptDescription };
Default Value
""
Remarks
The brief, human-readable description of what the prompt does.
This property holds a brief, human-readable description of what the prompt does, which is critical in helping the client to understand the purpose and functionality of the prompt.
The PromptIndex parameter specifies the index of the item in the array. The size of the array is controlled by the PromptCount property.
This property is read-only and not available at design time.
Data Type
String
PromptName Property (MCPServer Component)
The unique name associated with the prompt.
Syntax
__property String PromptName[int PromptIndex] = { read=FPromptName };
Default Value
""
Remarks
The unique name associated with the prompt.
This property identifies the unique name associated with the prompt.
The PromptIndex parameter specifies the index of the item in the array. The size of the array is controlled by the PromptCount property.
This property is read-only and not available at design time.
Data Type
String
RegisteredPromptArgCount Property (MCPServer Component)
The number of records in the RegisteredPromptArg arrays.
Syntax
__property int RegisteredPromptArgCount = { read=FRegisteredPromptArgCount, write=FSetRegisteredPromptArgCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at RegisteredPromptArgCount - 1.This property is not available at design time.
Data Type
Integer
RegisteredPromptArgDescription Property (MCPServer Component)
The brief, human-readable description of what information should be provided to this argument.
Syntax
__property String RegisteredPromptArgDescription[int RegisteredPromptArgIndex] = { read=FRegisteredPromptArgDescription, write=FSetRegisteredPromptArgDescription };
Default Value
""
Remarks
The brief, human-readable description of what information should be provided to this argument.
This property holds a brief, human-readable description of what information should be provided to this argument.
The RegisteredPromptArgIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RegisteredPromptArgCount property.
This property is not available at design time.
Data Type
String
RegisteredPromptArgName Property (MCPServer Component)
The unique name associated with the prompt argument.
Syntax
__property String RegisteredPromptArgName[int RegisteredPromptArgIndex] = { read=FRegisteredPromptArgName, write=FSetRegisteredPromptArgName };
Default Value
""
Remarks
The unique name associated with the prompt argument.
This property identifies the unique name associated with the prompt argument.
The RegisteredPromptArgIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RegisteredPromptArgCount property.
This property is not available at design time.
Data Type
String
RegisteredPromptArgRequired Property (MCPServer Component)
Whether the prompt argument must be supplied by the client when requesting the prompt.
Syntax
__property bool RegisteredPromptArgRequired[int RegisteredPromptArgIndex] = { read=FRegisteredPromptArgRequired, write=FSetRegisteredPromptArgRequired };
Default Value
true
Remarks
Whether the prompt argument must be supplied by the client when requesting the prompt.
This property indicates whether the prompt argument must be supplied by the client when requesting the prompt.
The RegisteredPromptArgIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RegisteredPromptArgCount property.
This property is not available at design time.
Data Type
Boolean
RegisteredToolParamCount Property (MCPServer Component)
The number of records in the RegisteredToolParam arrays.
Syntax
__property int RegisteredToolParamCount = { read=FRegisteredToolParamCount, write=FSetRegisteredToolParamCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at RegisteredToolParamCount - 1.This property is not available at design time.
Data Type
Integer
RegisteredToolParamParamType Property (MCPServer Component)
The type of data associated with the tool parameter.
Syntax
__property TsdmMCPServerRegisteredToolParamParamTypes RegisteredToolParamParamType[int RegisteredToolParamIndex] = { read=FRegisteredToolParamParamType, write=FSetRegisteredToolParamParamType };
enum TsdmMCPServerRegisteredToolParamParamTypes { ptString=0, ptNumber=1, ptBool=2, ptArray=3, ptObject=4 };
Default Value
ptString,
Remarks
The type of data associated with the tool parameter.
This property indicates the type of data associated with the tool parameter.
Valid data types include:
- 0 (ptString)
- 1 (ptNumber)
- 2 (ptBool)
- 3 (ptArray)
- 4 (ptObject)
The RegisteredToolParamIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RegisteredToolParamCount property.
This property is not available at design time.
Data Type
Integer
RegisteredToolParamValue Property (MCPServer Component)
The value associated with the tool parameter.
Syntax
__property String RegisteredToolParamValue[int RegisteredToolParamIndex] = { read=FRegisteredToolParamValue, write=FSetRegisteredToolParamValue };
Default Value
""
Remarks
The value associated with the tool parameter.
This property contains the value associated with the tool parameter.
The RegisteredToolParamIndex parameter specifies the index of the item in the array. The size of the array is controlled by the RegisteredToolParamCount property.
This property is not available at design time.
Data Type
String
Request Property (MCPServer Component)
The body of the HTTP request to be processed by the component.
Syntax
__property String Request = { read=FRequest, write=FSetRequest }; __property DynamicArray<Byte> RequestB = { read=FRequestB, write=FSetRequestB };
Default Value
""
Remarks
When the Transport property is set to ttHTTP and the ProcessingMode property is set to modeOffline, the component processes inbound HTTP requests via this property and the RequestHeaders property.
After setting this property to the full body content of the HTTP request, as well as setting any headers in the RequestHeaders property, the component will begin processing the request when the ProcessRequest method is called.
Data Type
Byte Array
RequestHeaders Property (MCPServer Component)
The full set of headers of the HTTP request to be processed by the component.
Syntax
__property String RequestHeaders = { read=FRequestHeaders, write=FSetRequestHeaders };
Default Value
""
Remarks
When the Transport property is set to ttHTTP and the ProcessingMode property is set to modeOffline, the component processes inbound HTTP requests via this property and the Request property.
After setting this property to the header content of the HTTP request, as well as setting the body content in the Request property, the component will begin processing the request when the ProcessRequest method is called.
Data Type
String
ResourceCount Property (MCPServer Component)
The number of records in the Resource arrays.
Syntax
__property int ResourceCount = { read=FResourceCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at ResourceCount - 1.This property is read-only and not available at design time.
Data Type
Integer
ResourceDescription Property (MCPServer Component)
The brief, human-readable description of the purpose of the resource as well as appropriate use cases.
Syntax
__property String ResourceDescription[int ResourceIndex] = { read=FResourceDescription };
Default Value
""
Remarks
The brief, human-readable description of the purpose of the resource as well as appropriate use cases.
This property holds a brief, human-readable description of the purpose of the resource as well as appropriate use cases.
The ResourceIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ResourceCount property.
This property is read-only and not available at design time.
Data Type
String
ResourceMimetype Property (MCPServer Component)
The media type of the resource content.
Syntax
__property String ResourceMimetype[int ResourceIndex] = { read=FResourceMimetype };
Default Value
""
Remarks
The media type of the resource content.
This property holds the media type of resource content (e.g., text/plain, image/png, etc.) and helps clients interpret the resource correctly and determine how it should be processed or displayed.
The ResourceIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ResourceCount property.
This property is read-only and not available at design time.
Data Type
String
ResourceName Property (MCPServer Component)
The display name associated with the resource.
Syntax
__property String ResourceName[int ResourceIndex] = { read=FResourceName };
Default Value
""
Remarks
The display name associated with the resource.
This property indicates the display associated with the resource that is shown to end users by the client.
The ResourceIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ResourceCount property.
This property is read-only and not available at design time.
Data Type
String
ResourceSize Property (MCPServer Component)
The size of the resource content, in bytes.
Syntax
__property int ResourceSize[int ResourceIndex] = { read=FResourceSize };
Default Value
0
Remarks
The size of the resource content, in bytes.
This property indicates the size of the resource content, in bytes.
The ResourceIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ResourceCount property.
This property is read-only and not available at design time.
Data Type
Integer
ResourceUri Property (MCPServer Component)
The unique resource identifier associated with the resource.
Syntax
__property String ResourceUri[int ResourceIndex] = { read=FResourceUri };
Default Value
""
Remarks
The unique resource identifier associated with the resource.
This property identifies the unique resource identifier associated with the resource.
The ResourceIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ResourceCount property.
This property is read-only and not available at design time.
Data Type
String
Response Property (MCPServer Component)
The body of the HTTP response generated after processing a request with the component.
Syntax
__property String Response = { read=FResponse, write=FSetResponse }; __property DynamicArray<Byte> ResponseB = { read=FResponseB, write=FSetResponseB };
Default Value
""
Remarks
When the Transport property is set to ttHTTP and the ProcessingMode property is set to modeOffline, this property holds the body of the HTTP response that was generated as a result of calling the ProcessRequest method.
Note that this response is not sent to a client, and instead the component simply populates this property along with the ResponseHeaders property.
Data Type
Byte Array
ResponseHeaders Property (MCPServer Component)
The full set of headers of the HTTP response generated after processing a request with the component.
Syntax
__property String ResponseHeaders = { read=FResponseHeaders, write=FSetResponseHeaders };
Default Value
""
Remarks
When the Transport property is set to ttHTTP and the ProcessingMode property is set to modeOffline, this property holds the headers of the HTTP response that was generated as a result of calling the ProcessRequest method.
Note that this response is not sent to a client, and instead the component simply populates this property along with the Response property.
Data Type
String
SamplingMessageCount Property (MCPServer Component)
The number of records in the SamplingMessage arrays.
Syntax
__property int SamplingMessageCount = { read=FSamplingMessageCount, write=FSetSamplingMessageCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at SamplingMessageCount - 1.This property is not available at design time.
Data Type
Integer
SamplingMessageRole Property (MCPServer Component)
The speaker or author of the message.
Syntax
__property TsdmMCPServerSamplingMessageRoles SamplingMessageRole[int SamplingMessageIndex] = { read=FSamplingMessageRole };
enum TsdmMCPServerSamplingMessageRoles { rtUser=0, rtAssistant=1 };
Default Value
rtUser
Remarks
The speaker or author of the message.
This property indicates who authored each message and helps provide conversational context to language models. Valid roles include:
0 (rtUser) | Message from the end user requesting assistance. |
1 (rtAssistant) | Message from the client providing responses. |
The SamplingMessageIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SamplingMessageCount property.
This property is read-only and not available at design time.
Data Type
Integer
SamplingMessageText Property (MCPServer Component)
The instruction that can be passed into the client's language model.
Syntax
__property String SamplingMessageText[int SamplingMessageIndex] = { read=FSamplingMessageText, write=FSetSamplingMessageText };
Default Value
""
Remarks
The instruction that can be passed into the client's language model.
This property contains natural language describing an instruction that can be passed into the client's language model (e.g., Review python code, Summarize an article, or Provide an example of using the /n software MCP SDK).
The SamplingMessageIndex parameter specifies the index of the item in the array. The size of the array is controlled by the SamplingMessageCount property.
This property is not available at design time.
Data Type
String
ServerCertEffectiveDate Property (MCPServer Component)
The date on which this certificate becomes valid.
Syntax
__property String ServerCertEffectiveDate = { read=FServerCertEffectiveDate };
Default Value
""
Remarks
The date on which this certificate becomes valid. Before this date, it is not valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2000 15:00:00.
This property is read-only.
Data Type
String
ServerCertExpirationDate Property (MCPServer Component)
The date on which the certificate expires.
Syntax
__property String ServerCertExpirationDate = { read=FServerCertExpirationDate };
Default Value
""
Remarks
The date on which the certificate expires. After this date, the certificate will no longer be valid. The date is localized to the system's time zone. The following example illustrates the format of an encoded date:
23-Jan-2001 15:00:00.
This property is read-only.
Data Type
String
ServerCertExtendedKeyUsage Property (MCPServer Component)
A comma-delimited list of extended key usage identifiers.
Syntax
__property String ServerCertExtendedKeyUsage = { read=FServerCertExtendedKeyUsage };
Default Value
""
Remarks
A comma-delimited list of extended key usage identifiers. These are the same as ASN.1 object identifiers (OIDs).
This property is read-only.
Data Type
String
ServerCertFingerprint Property (MCPServer Component)
The hex-encoded, 16-byte MD5 fingerprint of the certificate.
Syntax
__property String ServerCertFingerprint = { read=FServerCertFingerprint };
Default Value
""
Remarks
The hex-encoded, 16-byte MD5 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: bc:2a:72:af:fe:58:17:43:7a:5f:ba:5a:7c:90:f7:02
This property is read-only.
Data Type
String
ServerCertFingerprintSHA1 Property (MCPServer Component)
The hex-encoded, 20-byte SHA-1 fingerprint of the certificate.
Syntax
__property String ServerCertFingerprintSHA1 = { read=FServerCertFingerprintSHA1 };
Default Value
""
Remarks
The hex-encoded, 20-byte SHA-1 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 30:7b:fa:38:65:83:ff:da:b4:4e:07:3f:17:b8:a4:ed:80:be:ff:84
This property is read-only.
Data Type
String
ServerCertFingerprintSHA256 Property (MCPServer Component)
The hex-encoded, 32-byte SHA-256 fingerprint of the certificate.
Syntax
__property String ServerCertFingerprintSHA256 = { read=FServerCertFingerprintSHA256 };
Default Value
""
Remarks
The hex-encoded, 32-byte SHA-256 fingerprint of the certificate. This property is primarily used for keys which do not have a corresponding X.509 public certificate, such as PEM keys that only contain a private key. It is commonly used for SSH keys.
The following example illustrates the format: 6a:80:5c:33:a9:43:ea:b0:96:12:8a:64:96:30:ef:4a:8a:96:86:ce:f4:c7:be:10:24:8e:2b:60:9e:f3:59:53
This property is read-only.
Data Type
String
ServerCertIssuer Property (MCPServer Component)
The issuer of the certificate.
Syntax
__property String ServerCertIssuer = { read=FServerCertIssuer };
Default Value
""
Remarks
The issuer of the certificate. This property contains a string representation of the name of the issuing authority for the certificate.
This property is read-only.
Data Type
String
ServerCertPrivateKey Property (MCPServer Component)
The private key of the certificate (if available).
Syntax
__property String ServerCertPrivateKey = { read=FServerCertPrivateKey };
Default Value
""
Remarks
The private key of the certificate (if available). The key is provided as PEM/Base64-encoded data.
NOTE: The ServerCertPrivateKey may be available but not exportable. In this case, ServerCertPrivateKey returns an empty string.
This property is read-only.
Data Type
String
ServerCertPrivateKeyAvailable Property (MCPServer Component)
Whether a PrivateKey is available for the selected certificate.
Syntax
__property bool ServerCertPrivateKeyAvailable = { read=FServerCertPrivateKeyAvailable };
Default Value
false
Remarks
Whether a ServerCertPrivateKey is available for the selected certificate. If ServerCertPrivateKeyAvailable is True, the certificate may be used for authentication purposes (e.g., server authentication).
This property is read-only.
Data Type
Boolean
ServerCertPrivateKeyContainer Property (MCPServer Component)
The name of the PrivateKey container for the certificate (if available).
Syntax
__property String ServerCertPrivateKeyContainer = { read=FServerCertPrivateKeyContainer };
Default Value
""
Remarks
The name of the ServerCertPrivateKey container for the certificate (if available). This functionality is available only on Windows platforms.
This property is read-only.
Data Type
String
ServerCertPublicKey Property (MCPServer Component)
The public key of the certificate.
Syntax
__property String ServerCertPublicKey = { read=FServerCertPublicKey };
Default Value
""
Remarks
The public key of the certificate. The key is provided as PEM/Base64-encoded data.
This property is read-only.
Data Type
String
ServerCertPublicKeyAlgorithm Property (MCPServer Component)
The textual description of the certificate's public key algorithm.
Syntax
__property String ServerCertPublicKeyAlgorithm = { read=FServerCertPublicKeyAlgorithm };
Default Value
""
Remarks
The textual description of the certificate's public key algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_DH") or an object identifier (OID) string representing the algorithm.
This property is read-only.
Data Type
String
ServerCertPublicKeyLength Property (MCPServer Component)
The length of the certificate's public key (in bits).
Syntax
__property int ServerCertPublicKeyLength = { read=FServerCertPublicKeyLength };
Default Value
0
Remarks
The length of the certificate's public key (in bits). Common values are 512, 1024, and 2048.
This property is read-only.
Data Type
Integer
ServerCertSerialNumber Property (MCPServer Component)
The serial number of the certificate encoded as a string.
Syntax
__property String ServerCertSerialNumber = { read=FServerCertSerialNumber };
Default Value
""
Remarks
The serial number of the certificate encoded as a string. The number is encoded as a series of hexadecimal digits, with each pair representing a byte of the serial number.
This property is read-only.
Data Type
String
ServerCertSignatureAlgorithm Property (MCPServer Component)
The text description of the certificate's signature algorithm.
Syntax
__property String ServerCertSignatureAlgorithm = { read=FServerCertSignatureAlgorithm };
Default Value
""
Remarks
The text description of the certificate's signature algorithm. The property contains either the name of the algorithm (e.g., "RSA" or "RSA_MD5RSA") or an object identifier (OID) string representing the algorithm.
This property is read-only.
Data Type
String
ServerCertStore Property (MCPServer Component)
The name of the certificate store for the client certificate.
Syntax
__property String ServerCertStore = { read=FServerCertStore, write=FSetServerCertStore }; __property DynamicArray<Byte> ServerCertStoreB = { read=FServerCertStoreB, write=FSetServerCertStoreB };
Default Value
"MY"
Remarks
The name of the certificate store for the client certificate.
The ServerCertStoreType property denotes the type of the certificate store specified by ServerCertStore. If the store is password-protected, specify the password in ServerCertStorePassword.
ServerCertStore is used in conjunction with the ServerCertSubject property to specify client certificates. If ServerCertStore has a value, and ServerCertSubject or ServerCertEncoded is set, a search for a certificate is initiated. Please see the ServerCertSubject property for details.
Designations of certificate stores are platform dependent.
The following designations are the most common User and Machine certificate stores in Windows:
MY | A certificate store holding personal certificates with their associated private keys. |
CA | Certifying authority certificates. |
ROOT | Root certificates. |
When the certificate store type is cstPFXFile, this property must be set to the name of the file. When the type is cstPFXBlob, the property must be set to the binary contents of a PFX file (i.e., PKCS#12 certificate store).
Data Type
Byte Array
ServerCertStorePassword Property (MCPServer Component)
If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.
Syntax
__property String ServerCertStorePassword = { read=FServerCertStorePassword, write=FSetServerCertStorePassword };
Default Value
""
Remarks
If the type of certificate store requires a password, this property is used to specify the password needed to open the certificate store.
Data Type
String
ServerCertStoreType Property (MCPServer Component)
The type of certificate store for this certificate.
Syntax
__property TsdmMCPServerServerCertStoreTypes ServerCertStoreType = { read=FServerCertStoreType, write=FSetServerCertStoreType };
enum TsdmMCPServerServerCertStoreTypes { cstUser=0, cstMachine=1, cstPFXFile=2, cstPFXBlob=3, cstJKSFile=4, cstJKSBlob=5, cstPEMKeyFile=6, cstPEMKeyBlob=7, cstPublicKeyFile=8, cstPublicKeyBlob=9, cstSSHPublicKeyBlob=10, cstP7BFile=11, cstP7BBlob=12, cstSSHPublicKeyFile=13, cstPPKFile=14, cstPPKBlob=15, cstXMLFile=16, cstXMLBlob=17, cstJWKFile=18, cstJWKBlob=19, cstSecurityKey=20, cstBCFKSFile=21, cstBCFKSBlob=22, cstPKCS11=23, cstAuto=99 };
Default Value
cstUser
Remarks
The type of certificate store for this certificate.
The component supports both public and private keys in a variety of formats. When the cstAuto value is used, the component will automatically determine the type. This property can take one of the following values:
0 (cstUser - default) | For Windows, this specifies that the certificate store is a certificate store owned by the current user.
NOTE: This store type is not available in Java. |
1 (cstMachine) | For Windows, this specifies that the certificate store is a machine store.
NOTE: This store type is not available in Java. |
2 (cstPFXFile) | The certificate store is the name of a PFX (PKCS#12) file containing certificates. |
3 (cstPFXBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in PFX (PKCS#12) format. |
4 (cstJKSFile) | The certificate store is the name of a Java Key Store (JKS) file containing certificates.
NOTE: This store type is only available in Java. |
5 (cstJKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in Java Key Store (JKS) format.
NOTE: This store type is only available in Java. |
6 (cstPEMKeyFile) | The certificate store is the name of a PEM-encoded file that contains a private key and an optional certificate. |
7 (cstPEMKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a private key and an optional certificate. |
8 (cstPublicKeyFile) | The certificate store is the name of a file that contains a PEM- or DER-encoded public key certificate. |
9 (cstPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains a PEM- or DER-encoded public key certificate. |
10 (cstSSHPublicKeyBlob) | The certificate store is a string (binary or Base64-encoded) that contains an SSH-style public key. |
11 (cstP7BFile) | The certificate store is the name of a PKCS#7 file containing certificates. |
12 (cstP7BBlob) | The certificate store is a string (binary) representing a certificate store in PKCS#7 format. |
13 (cstSSHPublicKeyFile) | The certificate store is the name of a file that contains an SSH-style public key. |
14 (cstPPKFile) | The certificate store is the name of a file that contains a PPK (PuTTY Private Key). |
15 (cstPPKBlob) | The certificate store is a string (binary) that contains a PPK (PuTTY Private Key). |
16 (cstXMLFile) | The certificate store is the name of a file that contains a certificate in XML format. |
17 (cstXMLBlob) | The certificate store is a string that contains a certificate in XML format. |
18 (cstJWKFile) | The certificate store is the name of a file that contains a JWK (JSON Web Key). |
19 (cstJWKBlob) | The certificate store is a string that contains a JWK (JSON Web Key). |
21 (cstBCFKSFile) | The certificate store is the name of a file that contains a BCFKS (Bouncy Castle FIPS Key Store).
NOTE: This store type is only available in Java and .NET. |
22 (cstBCFKSBlob) | The certificate store is a string (binary or Base64-encoded) representing a certificate store in BCFKS (Bouncy Castle FIPS Key Store) format.
NOTE: This store type is only available in Java and .NET. |
23 (cstPKCS11) | The certificate is present on a physical security key accessible via a PKCS#11 interface.
To use a security key, the necessary data must first be collected using the CertMgr component. The ListStoreCertificates method may be called after setting CertStoreType to cstPKCS11, CertStorePassword to the PIN, and CertStore to the full path of the PKCS#11 DLL. The certificate information returned in the CertList event's CertEncoded parameter may be saved for later use. When using a certificate, pass the previously saved security key information as the ServerCertStore and set ServerCertStorePassword to the PIN. Code Example. SSH Authentication with Security Key:
|
99 (cstAuto) | The store type is automatically detected from the input data. This setting may be used with both public and private keys and can detect any of the supported formats automatically. |
Data Type
Integer
ServerCertSubjectAltNames Property (MCPServer Component)
Comma-separated lists of alternative subject names for the certificate.
Syntax
__property String ServerCertSubjectAltNames = { read=FServerCertSubjectAltNames };
Default Value
""
Remarks
Comma-separated lists of alternative subject names for the certificate.
This property is read-only.
Data Type
String
ServerCertThumbprintMD5 Property (MCPServer Component)
The MD5 hash of the certificate.
Syntax
__property String ServerCertThumbprintMD5 = { read=FServerCertThumbprintMD5 };
Default Value
""
Remarks
The MD5 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
This property is read-only.
Data Type
String
ServerCertThumbprintSHA1 Property (MCPServer Component)
The SHA-1 hash of the certificate.
Syntax
__property String ServerCertThumbprintSHA1 = { read=FServerCertThumbprintSHA1 };
Default Value
""
Remarks
The SHA-1 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
This property is read-only.
Data Type
String
ServerCertThumbprintSHA256 Property (MCPServer Component)
The SHA-256 hash of the certificate.
Syntax
__property String ServerCertThumbprintSHA256 = { read=FServerCertThumbprintSHA256 };
Default Value
""
Remarks
The SHA-256 hash of the certificate. It is primarily used for X.509 certificates. If the hash does not already exist, it is automatically computed.
This property is read-only.
Data Type
String
ServerCertUsage Property (MCPServer Component)
The text description of UsageFlags .
Syntax
__property String ServerCertUsage = { read=FServerCertUsage };
Default Value
""
Remarks
The text description of ServerCertUsageFlags.
This value will be one or more of the following strings and will be separated by commas:
- Digital Signature
- Non-Repudiation
- Key Encipherment
- Data Encipherment
- Key Agreement
- Certificate Signing
- CRL Signing
- Encipher Only
If the provider is OpenSSL, the value is a comma-separated list of X.509 certificate extension names.
This property is read-only.
Data Type
String
ServerCertUsageFlags Property (MCPServer Component)
The flags that show intended use for the certificate.
Syntax
__property int ServerCertUsageFlags = { read=FServerCertUsageFlags };
Default Value
0
Remarks
The flags that show intended use for the certificate. The value of ServerCertUsageFlags is a combination of the following flags:
0x80 | Digital Signature |
0x40 | Non-Repudiation |
0x20 | Key Encipherment |
0x10 | Data Encipherment |
0x08 | Key Agreement |
0x04 | Certificate Signing |
0x02 | CRL Signing |
0x01 | Encipher Only |
Please see the ServerCertUsage property for a text representation of ServerCertUsageFlags.
This functionality currently is not available when the provider is OpenSSL.
This property is read-only.
Data Type
Integer
ServerCertVersion Property (MCPServer Component)
The certificate's version number.
Syntax
__property String ServerCertVersion = { read=FServerCertVersion };
Default Value
""
Remarks
The certificate's version number. The possible values are the strings "V1", "V2", and "V3".
This property is read-only.
Data Type
String
ServerCertSubject Property (MCPServer Component)
The subject of the certificate used for client authentication.
Syntax
__property String ServerCertSubject = { read=FServerCertSubject, write=FSetServerCertSubject };
Default Value
""
Remarks
The subject of the certificate used for client authentication.
This property must be set after all other certificate properties are set. When this property is set, a search is performed in the current certificate store to locate a certificate with a matching subject.
If a matching certificate is found, the property is set to the full subject of the matching certificate.
If an exact match is not found, the store is searched for subjects containing the value of the property.
If a match is still not found, the property is set to an empty string, and no certificate is selected.
The special value "*" picks a random certificate in the certificate store.
The certificate subject is a comma-separated list of distinguished name fields and values. For instance, "CN=www.server.com, OU=test, C=US, E=example@email.com". Common fields and their meanings are as follows:
Field | Meaning |
CN | Common Name. This is commonly a hostname like www.server.com. |
O | Organization |
OU | Organizational Unit |
L | Locality |
S | State |
C | Country |
E | Email Address |
If a field value contains a comma, it must be quoted.
Data Type
String
ServerCertEncoded Property (MCPServer Component)
The certificate (PEM/Base64 encoded).
Syntax
__property String ServerCertEncoded = { read=FServerCertEncoded, write=FSetServerCertEncoded }; __property DynamicArray<Byte> ServerCertEncodedB = { read=FServerCertEncodedB, write=FSetServerCertEncodedB };
Default Value
""
Remarks
The certificate (PEM/Base64 encoded). This property is used to assign a specific certificate. The ServerCertStore and ServerCertSubject properties also may be used to specify a certificate.
When ServerCertEncoded is set, a search is initiated in the current ServerCertStore for the private key of the certificate. If the key is found, ServerCertSubject is updated to reflect the full subject of the selected certificate; otherwise, ServerCertSubject is set to an empty string.
This property is not available at design time.
Data Type
Byte Array
ServerSettingsAllowedAuthMethods Property (MCPServer Component)
Specifies the authentication schemes that the component will allow.
Syntax
__property String ServerSettingsAllowedAuthMethods = { read=FServerSettingsAllowedAuthMethods, write=FSetServerSettingsAllowedAuthMethods };
Default Value
"Anonymous,Basic,Digest,NTLM,Negotiate"
Remarks
Specifies the authentication schemes that the component will allow.
This property must be set to a valid comma-separated string of authentication scheme values that the embedded server will allow. Possible values are as follows:
- Anonymous: Unauthenticated connection requests will be allowed.
- Basic: HTTP Basic authentication is allowed.
- Digest: Digest authentication is allowed.
- NTLM: NTLM authentication is allowed.
- Negotiate: Windows Negotiate (Kerberos) authentication is allowed.
Data Type
String
ServerSettingsLocalHost Property (MCPServer Component)
Specifies the name of the local host or user-assigned IP interface through which connections are initiated or accepted.
Syntax
__property String ServerSettingsLocalHost = { read=FServerSettingsLocalHost, write=FSetServerSettingsLocalHost };
Default Value
""
Remarks
Specifies the name of the local host or user-assigned IP interface through which connections are initiated or accepted.
This field contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.
In multihomed hosts (machines with more than one IP interface) setting LocalHost to the IP address of an interface will make the component initiate connections (or accept in the case of server components) only through that interface. It is recommended to provide an IP address rather than a hostname when setting this field to ensure the desired interface is used.
If the component is connected, the ServerSettingsLocalHost field shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).
NOTE: ServerSettingsLocalHost is not persistent. You must always set it in code, and never in the property window.
Data Type
String
ServerSettingsLocalPort Property (MCPServer Component)
Includes the Transmission Control Protocol (TCP) port in the local host where the component listens.
Syntax
__property int ServerSettingsLocalPort = { read=FServerSettingsLocalPort, write=FSetServerSettingsLocalPort };
Default Value
0
Remarks
Includes the Transmission Control Protocol (TCP) port in the local host where the component listens.
This field must be set before the component can start listening. If this is set to 0, then the TCP/IP subsystem will pick a port number at random.
The service port is not shared among servers, so two components cannot be listening on the same port at the same time.
Data Type
Integer
ServerSettingsTimeout Property (MCPServer Component)
Specifies the timeout in seconds for the component.
Syntax
__property int ServerSettingsTimeout = { read=FServerSettingsTimeout, write=FSetServerSettingsTimeout };
Default Value
60
Remarks
Specifies the timeout in seconds for the component.
If this is set to 0, all operations will run uninterrupted until successful completion or an error condition is encountered.
If this is set to a positive value, the component will wait for the operation to complete before returning control.
If the timeout expires, and the operation is not yet complete, the component throws an exception.
Note that all timeouts are inactivity timeouts, meaning the timeout period is extended by the value specified in this property when any amount of data is successfully sent or received.
Data Type
Integer
SystemPrompt Property (MCPServer Component)
An instruction sent to the client's language model to influence its behavior during a sampling request.
Syntax
__property String SystemPrompt = { read=FSystemPrompt, write=FSetSystemPrompt };
Default Value
""
Remarks
When the Transport property is set to ttStdio, this property specifies an instruction sent to the client's language model to influence its behavior when the SendSamplingRequest method is called. It acts as high-level guidance or context for how the language model should interpret and respond to the messages in the SamplingMessages properties.
Example:
server.SystemPrompt = "You are an assistant meant to summarize text only using a formal tone.";
SamplingMessage message = new SamplingMessage();
message.Role = TRoles.rtUser;
message.Text = "Summarize the following text: " + text;
server.SamplingMessages.Add(message);
string result = server.SendSamplingRequest();
Data Type
String
ToolCount Property (MCPServer Component)
The number of records in the Tool arrays.
Syntax
__property int ToolCount = { read=FToolCount };
Default Value
0
Remarks
This property controls the size of the following arrays:
The array indices start at 0 and end at ToolCount - 1.This property is read-only and not available at design time.
Data Type
Integer
ToolDescription Property (MCPServer Component)
The brief, human-readable description of what the tool does.
Syntax
__property String ToolDescription[int ToolIndex] = { read=FToolDescription };
Default Value
""
Remarks
The brief, human-readable description of what the tool does.
This property holds a brief, human-readable description of what the tool does, which is critical in helping the client to understand when the tool should be invoked.
The ToolIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ToolCount property.
This property is read-only and not available at design time.
Data Type
String
ToolName Property (MCPServer Component)
The unique name associated with the tool.
Syntax
__property String ToolName[int ToolIndex] = { read=FToolName };
Default Value
""
Remarks
The unique name associated with the tool.
This property identifies the unique name associated with the tool.
The ToolIndex parameter specifies the index of the item in the array. The size of the array is controlled by the ToolCount property.
This property is read-only and not available at design time.
Data Type
String
Transport Property (MCPServer Component)
The transport mechanism used for communication.
Syntax
__property TsdmMCPServerTransports Transport = { read=FTransport, write=FSetTransport };
enum TsdmMCPServerTransports { ttStdio=1, ttHTTP=2 };
Default Value
ttStdio
Remarks
This property indicates whether the component operates via the standard input/output or HTTP transport mechanism. Possible values are as follows:
- ttStdio (1, default): Enables communication through standard input and output streams, but the component is limited to serving a single client at once due to the server acting as a subprocess of a client application.
- ttHTTP (2): Enables communication via HTTP requests and responses, and allows the component to serve multiple clients at once.
This property is not available at design time.
Data Type
Integer
AddPromptMessage Method (MCPServer Component)
Adds a prompt message to be returned during a prompt request.
Syntax
void __fastcall AddPromptMessage(int role, String text);
Remarks
This method is used to add a new prompt message to be passed back to the client during an ongoing prompt request. It may only be called from within the PromptRequest event.
Role determines the message's origin and context within the conversation flow. Valid roles include:
0 (rtUser) | Message from the end user requesting assistance. |
1 (rtAssistant) | Message from the client providing responses. |
Text contains natural language describing the prompt that will be passed into the client's language model (e.g., Review python code, Summarize an article, or Provide an example of using the /n software MCP SDK).
Example:
server.OnPromptRequest += (s, e) =>
{
if (e.Name.Equals("Greeting"))
{
server.AddPromptMessage((int)TRoles.rtUser, "Hello!");
}
};
Advanced Example:
server.OnPromptRequest += (s, e) =>
{
if (e.Name.Equals("Code Review"))
{
string code = server.GetPromptParamValue("code");
string language = server.GetPromptParamValue("language");
string reviewType = server.GetPromptParamValue("reviewType");
string instructions = "Please review the following " + language + " code.";
if (!string.IsNullOrEmpty(reviewType))
{
instructions += " focusing on " + reviewType;
}
instructions += ":";
server.AddPromptMessage((int)TRoles.rtUser, instructions);
server.AddPromptMessage((int)TRoles.rtUser, code);
}
};
AddResourceContent Method (MCPServer Component)
Adds data to be returned during a resource request.
Syntax
void __fastcall AddResourceContent(String uri, String text, String mimeType);
Remarks
This method is used to add resource content to be passed back to the client during an ongoing resource request, providing the actual data that clients are requesting when they access a specific resource. It may only be called from within the ResourceRequest event and may be called multiple times during the same resource request to provide multiple related resources or different versions of the same content.
Uri specifies the unique resource identifier that corresponds to the content being provided.
Text contains text data that will be included in the response for the ongoing resource request.
MimeType (e.g., text/plain or application/json) informs the client of how the data passed into Text should be interpreted and processed.
Example:
server.OnResourceRequest += (s, e) =>
{
string uri = e.Uri.ToString();
if (uri.StartsWith("file:///"))
{
string fileName = uri.Substring("file:///".Length).Replace('/', Path.DirectorySeparatorChar);
string fullPath = Path.Combine(baseDir, fileName);
if (File.Exists(fullPath))
{
string data = File.ReadAllText(fullPath);
server.AddResourceContent(uri, data, "text/plain");
}
}
};
Advanced Example
server.OnResourceRequest += (s, e) =>
{
string uri = e.Uri.ToString();
if (uri.StartsWith("file:///"))
{
string fileName = uri.Substring("file:///".Length).Replace('/', Path.DirectorySeparatorChar);
string fullPath = Path.Combine(baseDir, fileName);
string fileExtension = Path.GetExtension(fullPath).ToLower();
string mimeType = GetMimeType(fileExtension);
if (IsImageFile(fileExtension))
{
// Handle image files.
byte[] imageBytes = File.ReadAllBytes(fullPath);
string base64Image = Convert.ToBase64String(imageBytes);
server.AddResourceContent(uri, base64Image, mimeType);
}
else
{
// Handle text files.
string data = File.ReadAllText(fullPath);
server.AddResourceContent(uri, data, mimeType);
}
}
};
AddToolMessage Method (MCPServer Component)
Adds a tool message to be returned during a tool request.
Syntax
void __fastcall AddToolMessage(int messageType, String value);
Remarks
This method is used to add a new tool message to be passed back to the client during an ongoing tool request. It may only be called from within the ToolRequest event, and should only be called once per each type of data to be returned.
MessageType identifies the data type of the message being added. Valid data types include:
0 (mtText) | Natural language text data. |
1 (mtAudio) | A base64-encoded string representing audio data (e.g., MP3 or WAV). |
2 (mtImage) | A base64-encoded string representing image data (e.g., PNG or JPEG). |
3 (mtResource) | A string message representing the contents of a text-based resource (e.g., file://logs/output.txt). |
Value contains text that will be included in the response for the ongoing tool request.
Config Method (MCPServer Component)
Sets or retrieves a configuration setting.
Syntax
String __fastcall Config(String ConfigurationString);
Remarks
Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
DoEvents Method (MCPServer Component)
Processes events from the internal queue.
Syntax
void __fastcall DoEvents();
Remarks
This method causes the component to process any available events. If no events are available, it waits for a preset period of time and then returns.
GetPromptParamValue Method (MCPServer Component)
Retrieves the value of an existing prompt parameter.
Syntax
String __fastcall GetPromptParamValue(String Name);
Remarks
This method is used to retrieve the value of an existing prompt parameter. It may only be called from within the PromptRequest event.
Name contains a unique identifier for the prompt parameter that is being retrieved. This must match the value passed into the RegisterPromptArg method when the parameter was registered.
The value associated with the prompt parameter is returned when calling this method. If the specified parameter does not exist or was not provided by the client, then an empty string is returned.
Example:
// Define argument schema.
server.RegisterPromptArg("code", "Code to explain", true);
server.RegisterPromptArg("language", "Programming language", false);
// Register the prompt.
string name = "explain-code";
string description = "Explain how code works";
server.RegisterPrompt(name, description);
// Handling the prompt request.
server.OnPromptRequest += (s, e) =>
{
// Retrieve runtime values sent by client.
string code = server.GetPromptParamValue("code");
string language = server.GetPromptParamValue("language") ?? "Unknown";
// Build response messages.
// Assuming the client sent 'a = 1 + 2;' for the 'code' argument, and 'python' for the 'language' argument.
// The following response should contain a user message with the text 'Explain how this python code works: \n\na = 1 + 2;'.
server.AddPromptMessage("user", $"Explain how this {language} code works:\n\n{code}");
};
GetToolParamValue Method (MCPServer Component)
Retrieves the value of an existing tool parameter.
Syntax
String __fastcall GetToolParamValue(String Name);
Remarks
This method is used to retrieve the value of an existing tool parameter. It may only be called from within the ToolRequest event.
Name contains a unique identifier for the tool parameter that is being retrieved. This must match the value passed into the RegisterToolParam method when the parameter was registered.
The value associated with the tool parameter is returned when calling this method. If the specified parameter does not exist or was not provided by the client, then an empty string is returned.
ProcessRequest Method (MCPServer Component)
Processes the request and sends the result.
Syntax
void __fastcall ProcessRequest();
Remarks
When the Transport property is set to ttHTTP and the ProcessingMode property is set to modeExternalServer or modeOffline, this method acts as the main entry point for the component and is used to process a specific request. This method should not be called when the component is running in the modeEmbeddedServer mode.
Note that when using the modeOffline mode, the component processes the request and its associated headers supplied via the Request and RequestHeaders properties, respectively, and therefore ignores the parameters of this method.
Note that authentication occurs fully outside the scope of the component, and the logic that verifies these credentials is separate from any interaction with the component. Only once the request has been authenticated through this external verification should the be passed to this method.
ProcessRequests Method (MCPServer Component)
Instructs the component to start processing incoming requests.
Syntax
void __fastcall ProcessRequests();
Remarks
This method instructs the component to process requests.
Notice that StartListening needs to be called before calling this method.
RegisterPrompt Method (MCPServer Component)
Registers a prompt that can be requested by the client.
Syntax
void __fastcall RegisterPrompt(String Name, String Description);
Remarks
This method is used to register a new prompt that can be requested by the client.
Name specifies the unique name identifier for the prompt.
Description is critical in helping the client to understand the purpose and functionality of the prompt and should be set to a brief, human-readable description of what the prompt does.
Any prompt arguments associated with the prompt to be registered must be registered via the RegisterPromptArg method before this method is called.
Once the prompt has been registered, it is added to the Prompts properties and may be requested by the client, causing the PromptRequest event to be fired. Additionally, the RegisteredPromptArgs properties is cleared, and all prompt arguments previously in the properties are applied to the prompt.
Example:
// Register two prompt argument schemas.
server.RegisterPromptArg("code", "Code to explain", true);
server.RegisterPromptArg("language", "Programming language", false);
// Register the prompt with the added arguments.
server.RegisterPrompt("explain-code", "Explain how code works");
Example:
// Define argument schema.
server.RegisterPromptArg("code", "Code to explain", true);
server.RegisterPromptArg("language", "Programming language", false);
// Register the prompt.
string name = "explain-code";
string description = "Explain how code works";
server.RegisterPrompt(name, description);
// Handling the prompt request.
server.OnPromptRequest += (s, e) =>
{
// Retrieve runtime values sent by client.
string code = server.GetPromptParamValue("code");
string language = server.GetPromptParamValue("language") ?? "Unknown";
// Build response messages.
// Assuming the client sent 'a = 1 + 2;' for the 'code' argument, and 'python' for the 'language' argument.
// The following response should contain a user message with the text 'Explain how this python code works: \n\na = 1 + 2;'.
server.AddPromptMessage("user", $"Explain how this {language} code works:\n\n{code}");
};
RegisterPromptArg Method (MCPServer Component)
Registers an argument for a prompt.
Syntax
void __fastcall RegisterPromptArg(String Name, String Description, bool Required);
Remarks
This method is used to register a new argument for a prompt that has not yet been registered via the RegisterPrompt method.
Name specifies the unique name identifier for the prompt argument.
Description identifies what information should be provided to this argument.
Required specifies whether the prompt argument must be supplied by the client when requesting the prompt.
Once the prompt argument has been registered, it is added to the RegisteredPromptArgs properties. All of the prompt arguments in this properties will be applied to the next prompt registered via RegisterPrompt, after which the properties is cleared.
Example:
// Register two prompt argument schemas.
server.RegisterPromptArg("code", "Code to explain", true);
server.RegisterPromptArg("language", "Programming language", false);
// Register the prompt with the added arguments.
server.RegisterPrompt("explain-code", "Explain how code works");
RegisterResource Method (MCPServer Component)
Registers a resource that can be requested by the client.
Syntax
void __fastcall RegisterResource(String Uri, String Name, String Description);
Remarks
This method is used to register a new resource that can be requested by the client.
Uri specifies the unique identifier for the resource, of which common formats include file:///filename.ext for files, standard HTTP/HTTPS URLs for web resources, or custom schemes like db://table_name.
Name indicates the display name of the resource shown to end users by the client.
Description should be set to a brief, human-readable description of the resource's purpose, its content type, and appropriate use cases.
Once the resource has been registered, it is added to the Resources properties and may be requested by the client, causing the ResourceRequest event to be fired.
Note that once registered, resources become available for discovery, but the actual content (including format details and MIME type) is not loaded until a specific resource has been requested.
Resource URIs
Resource URIs represent a unique identifier for a resource and must follow the format:[scheme]://[host]/[path]
Common schemes include:
file://: | For local or file-like resources, even if they do not map directly to a local file (e.g., file:///example.png). |
https://: | Refers to web-accessible resources. This should only be used if the clients can fetch and parse the content directly (e.g., https://www.nsoftware.com). |
git://: | Indicates resources that originate from a Git repository (e.g., git://github.com/nsoftware/repo.git). |
Custom URI Schemes
In addition to the previously listed schemes, applications may define their own custom URI schemes. These must be in accordance with RFC3986, especially with regards to reserved characters and general formatting recommendations. Characters such as :, /, and ? must be percent-encoded when used as data.
Client behavior may vary; therefore when registering resource URIs, servers must be prepared to handle every resource they register, regardless of client behavior. MCP-compatible clients may ignore scheme recommendations or fail to fetch resources as expected.
RegisterTool Method (MCPServer Component)
Registers a tool that can be requested by the client.
Syntax
void __fastcall RegisterTool(String Name, String Description);
Remarks
This method is used to register a new tool that can be requested by the client.
Name specifies the unique name identifier for the tool.
Description is critical in helping the client to understand when to invoke this tool should be set to a brief, human-readable description of what the tool does.
Any tool parameters associated with the tool to be registered must be registered via the RegisterToolParam method before this method is called.
Once the tool has been registered, it is added to the Tools properties and may be requested by the client, causing the ToolRequest event to be fired. Additionally, the RegisteredToolParams properties is cleared, and all tool parameters previously in the properties are applied to the tool.
RegisterToolParam Method (MCPServer Component)
Registers a parameter for a tool.
Syntax
void __fastcall RegisterToolParam(String Name, bool Required);
Remarks
This method is used to register a new parameter for a tool that has not yet been registered via the RegisterTool method.
Name specifies the unique name identifier for the tool parameter.
Required specifies whether the tool parameter must be supplied by the client when requesting the tool.
Once the tool parameter has been registered, it is added to the RegisteredToolParams properties. All of the tool parameters in this properties will be applied to the next tool registered via RegisterTool, after which the properties is cleared.
SendSamplingRequest Method (MCPServer Component)
Requests language model reasoning from the client.
Syntax
String __fastcall SendSamplingRequest();
Remarks
When the Transport property is set to ttStdio, this method is used to send a sampling request to the client, which is often used in order to utilize language model reasoning.
When called, the set of messages in the SamplingMessages properties will be passed over to the client in order for them to be used as a prompt for the client's language model. This method will then return the output of the prompt as text.
Example:
server.OnToolRequest += (s, e) =>
{
if (e.Name.Contains("summarize-text")) {
// Grab text to summarize from the corresponding tool parameter.
string text = GetText(); // Custom logic.
// Add a prompt asking the client's LLM to summarize the text we just received.
SamplingMessage message = new SamplingMessage();
message.Role = TRoles.rtUser;
message.Text = "Summarize the following text: " + text;
server.SamplingMessages.Add(message);
// Send the sampling messages over to the client and request a response.
string result = server.SendSamplingRequest();
// Return some text.
server.AddToolMessage((int)TToolMessageTypes.mtText, result);
}
};
System Prompts
When performing a sampling request, the server may specify a system prompt to influence the client's LLM behavior during sampling. A system prompt provides high-level guidance or context for how the language model should interpret and respond to the messages in SamplingMessages. It is especially useful for establishing tone, role, or task-specific instructions.
Example:
server.SystemPrompt = "You are an assistant meant to summarize text only using a formal tone.";
SamplingMessage message = new SamplingMessage();
message.Role = TRoles.rtUser;
message.Text = "Summarize the following text: " + text;
server.SamplingMessages.Add(message);
string result = server.SendSamplingRequest();
StartListening Method (MCPServer Component)
Instructs the component to start listening for incoming connections.
Syntax
void __fastcall StartListening();
Remarks
When the Transport property is set to ttStdio, or it is set to ttHTTP and the ProcessingMode property is set to modeEmbeddedServer, this method instructs the component to start listening for incoming connections on the port specified by .
To stop listening for new connections, please refer to the StopListening method.
StopListening Method (MCPServer Component)
Instructs the component to stop listening for new connections.
Syntax
void __fastcall StopListening();
Remarks
When the Transport property is set to ttStdio, or it is set to ttHTTP and the ProcessingMode property is set to modeEmbeddedServer, this method instructs the component to stop listening for new connections. After being called, any new connection attempts will be rejected. Calling this method does not disconnect existing connections.
UnregisterPrompt Method (MCPServer Component)
Unregisters an existing prompt.
Syntax
void __fastcall UnregisterPrompt(String Name);
Remarks
This method is used to unregister a prompt that had previously been registered via the RegisterPrompt method. Once called, the specified prompt will be removed from the Prompts properties and will not be able to be requested by the client until it is registered again with RegisterPrompt.
Name specifies the unique name identifier for the prompt that will be unregistered. This should match the value passed into RegisterPrompt when the prompt was registered.
Example:
// Register a prompt, making it available for clients to request.
server.RegisterPromptArg("code-to-review", "The source code to review", true);
server.RegisterPrompt("review-code", "Review the specified code");
// Handle client requests.
// Unregister the prompt and prevent clients from being able to request it.
server.UnregisterPrompt("review-code");
UnregisterResource Method (MCPServer Component)
Unregisters an existing resource.
Syntax
void __fastcall UnregisterResource(String Uri);
Remarks
This method is used to unregister a resource that had previously been registered via the RegisterResource method. Once called, the specified resource will be removed from the Resources properties and will not be able to be requested by the client until it is registered again with RegisterResource.
Uri specifies the unique identifier for the resource that will be unregistered. This should match the value passed into RegisterResource when the resource was registered.
Example:
// Register a resource, making it available for clients to request.
server.RegisterResource("file:///kb/test.txt", "Sample resource file", "A sample resource file with text content");
// Handle client requests.
// Unregister the resource and prevent clients from being able to request it.
server.UnregisterResource("file:///kb/test.txt");
Resource URIs
Resource URIs represent a unique identifier for a resource and must follow the format:[scheme]://[host]/[path]
Common schemes include:
file://: | For local or file-like resources, even if they do not map directly to a local file (e.g., file:///example.png). |
https://: | Refers to web-accessible resources. This should only be used if the clients can fetch and parse the content directly (e.g., https://www.nsoftware.com). |
git://: | Indicates resources that originate from a Git repository (e.g., git://github.com/nsoftware/repo.git). |
Custom URI Schemes
In addition to the previously listed schemes, applications may define their own custom URI schemes. These must be in accordance with RFC3986, especially with regards to reserved characters and general formatting recommendations. Characters such as :, /, and ? must be percent-encoded when used as data.
Client behavior may vary; therefore when registering resource URIs, servers must be prepared to handle every resource they register, regardless of client behavior. MCP-compatible clients may ignore scheme recommendations or fail to fetch resources as expected.
UnregisterTool Method (MCPServer Component)
Unregisters an existing tool.
Syntax
void __fastcall UnregisterTool(String Name);
Remarks
This method is used to unregister a tool that had previously been registered via the RegisterTool method. Once called, the specified tool will be removed from the Tools properties and will not be able to be invoked by the client until it is registered again with RegisterTool.
Name specifies the unique name identifier for the tool that will be unregistered. This should match the value passed into RegisterTool when the tool was registered.
Example:
// Register a tool, making it available for clients to invoke.
server.RegisterTool("random-num", "Generate a random number");
// Handle client requests.
// Unregister the tool and prevent clients from being able to invoke it.
server.UnregisterTool("random-num");
Error Event (MCPServer Component)
Fires when an error occurs during operation.
Syntax
typedef struct { int ConnectionId; int ErrorCode; String Description; } TsdmMCPServerErrorEventParams; typedef void __fastcall (__closure *TsdmMCPServerErrorEvent)(System::TObject* Sender, TsdmMCPServerErrorEventParams *e); __property TsdmMCPServerErrorEvent OnError = { read=FOnError, write=FOnError };
Remarks
This event is fired when an unhandled exception is caught by the component, providing information about the error.
ConnectionId identifies the connection associated with the error.
ErrorCode contains the numeric error code representing the specific error condition.
Description contains a textual description of the error that occurred.
Log Event (MCPServer Component)
Fires once for each log message.
Syntax
typedef struct { int LogLevel; String Message; String LogType; } TsdmMCPServerLogEventParams; typedef void __fastcall (__closure *TsdmMCPServerLogEvent)(System::TObject* Sender, TsdmMCPServerLogEventParams *e); __property TsdmMCPServerLogEvent OnLog = { read=FOnLog, write=FOnLog };
Remarks
This event is fired once for each log message generated by the component. The verbosity is controlled by the LogLevel configuration.
LogLevel indicates the detail level of the message. Possible values are:
0 (None) | No messages are logged. |
1 (Info - Default) | Informational events are logged. |
2 (Verbose) | Detailed data is logged. |
3 (Debug) | Debug data including all sent and received NFS operations are logged. |
Message is the log message.
LogType identifies the type of log entry. Possible values are as follows:
- NFS
PromptRequest Event (MCPServer Component)
Fires when a prompt is requested by the client.
Syntax
typedef struct { String Name; String Description; } TsdmMCPServerPromptRequestEventParams; typedef void __fastcall (__closure *TsdmMCPServerPromptRequestEvent)(System::TObject* Sender, TsdmMCPServerPromptRequestEventParams *e); __property TsdmMCPServerPromptRequestEvent OnPromptRequest = { read=FOnPromptRequest, write=FOnPromptRequest };
Remarks
This event is fired when a prompt has been requested by the client and allows the server to run custom logic. The text-based output to be returned to the client should be passed to the AddPromptMessage method while handling this event. This method may be called multiple times during the same prompt request to build a complete conversation history with alternating roles.
The GetPromptParamValue method may be called from within this event to retrieve the values for the prompt arguments associated with the requested prompt.
Name contains the unique name associated with the prompt.
Description holds the brief, human-readable description of what the prompt does.
Example:
// Define argument schema.
server.RegisterPromptArg("code", "Code to explain", true);
server.RegisterPromptArg("language", "Programming language", false);
// Register the prompt.
string name = "explain-code";
string description = "Explain how code works";
server.RegisterPrompt(name, description);
// Handling the prompt request.
server.OnPromptRequest += (s, e) =>
{
// Retrieve runtime values sent by client.
string code = server.GetPromptParamValue("code");
string language = server.GetPromptParamValue("language") ?? "Unknown";
// Build response messages.
// Assuming the client sent 'a = 1 + 2;' for the 'code' argument, and 'python' for the 'language' argument.
// The following response should contain a user message with the text 'Explain how this python code works: \n\na = 1 + 2;'.
server.AddPromptMessage("user", $"Explain how this {language} code works:\n\n{code}");
};
ResourceRequest Event (MCPServer Component)
Fires when a resource is requested by the client.
Syntax
typedef struct { String Uri; } TsdmMCPServerResourceRequestEventParams; typedef void __fastcall (__closure *TsdmMCPServerResourceRequestEvent)(System::TObject* Sender, TsdmMCPServerResourceRequestEventParams *e); __property TsdmMCPServerResourceRequestEvent OnResourceRequest = { read=FOnResourceRequest, write=FOnResourceRequest };
Remarks
This event is fired when a resource has been requested by the client and allows the server to run custom logic. The resource content to be returned to the client should be passed to the AddResourceContent method while handling this event. This method may be called multiple times during the same resource request to provide multiple related resources or different versions of the same content.
Uri specifies the unique resource identifier for the requested resource.
Example:
server.OnResourceRequest += (s, e) =>
{
string uri = e.Uri.ToString();
if (uri == "file:///logs/app.log")
{
string logData = File.ReadAllText("app.log");
server.AddResourceContent(uri, logData, "text/plain");
}
else
{
server.Response = "[Unknown resource]";
}
};
Resource URIs
Resource URIs represent a unique identifier for a resource and must follow the format:[scheme]://[host]/[path]
Common schemes include:
file://: | For local or file-like resources, even if they do not map directly to a local file (e.g., file:///example.png). |
https://: | Refers to web-accessible resources. This should only be used if the clients can fetch and parse the content directly (e.g., https://www.nsoftware.com). |
git://: | Indicates resources that originate from a Git repository (e.g., git://github.com/nsoftware/repo.git). |
Custom URI Schemes
In addition to the previously listed schemes, applications may define their own custom URI schemes. These must be in accordance with RFC3986, especially with regards to reserved characters and general formatting recommendations. Characters such as :, /, and ? must be percent-encoded when used as data.
Client behavior may vary; therefore when registering resource URIs, servers must be prepared to handle every resource they register, regardless of client behavior. MCP-compatible clients may ignore scheme recommendations or fail to fetch resources as expected.
SessionEnd Event (MCPServer Component)
Fires when the component ends a session.
Syntax
typedef struct { __int64 SessionId; } TsdmMCPServerSessionEndEventParams; typedef void __fastcall (__closure *TsdmMCPServerSessionEndEvent)(System::TObject* Sender, TsdmMCPServerSessionEndEventParams *e); __property TsdmMCPServerSessionEndEvent OnSessionEnd = { read=FOnSessionEnd, write=FOnSessionEnd };
Remarks
When the Transport property is set to ttHTTP, this event fires when the component ends a previously started session. The component doesn't expect any errors to occur or be reported by handlers of this event.
SessionId specifies the unique identifier for the current session and can be obtained from the initial SessionStart event when the session is first opened.
SessionStart Event (MCPServer Component)
Fires when the component starts a session.
Syntax
typedef struct { __int64 SessionId; int ResultCode; } TsdmMCPServerSessionStartEventParams; typedef void __fastcall (__closure *TsdmMCPServerSessionStartEvent)(System::TObject* Sender, TsdmMCPServerSessionStartEventParams *e); __property TsdmMCPServerSessionStartEvent OnSessionStart = { read=FOnSessionStart, write=FOnSessionStart };
Remarks
When the Transport property is set to ttHTTP, this event fires when a new session with a connected client begins. The lifetime of a session is a single HTTP request and response, meaning once the response has been sent, the session ends.
SessionId is the unique identifier of the session, assigned by the component. It is provided as a parameter in all other events so that the operations for a particular client session may be tracked.
ResultCode provides an opportunity to report the operation as failed. This parameter will always be 0 when the event is fired, indicating the operation was successful. If the event cannot be handled in a "successful" manner for some reason, this must be set to a non-zero value.
Reporting an error will abort the operation.
ToolRequest Event (MCPServer Component)
Fires when a tool is requested by the client.
Syntax
typedef struct { int ConnectionId; String Name; String Description; bool IsError; } TsdmMCPServerToolRequestEventParams; typedef void __fastcall (__closure *TsdmMCPServerToolRequestEvent)(System::TObject* Sender, TsdmMCPServerToolRequestEventParams *e); __property TsdmMCPServerToolRequestEvent OnToolRequest = { read=FOnToolRequest, write=FOnToolRequest };
Remarks
This event is fired when a tool has been requested by the client and allows the server to run custom logic. If applicable, the text-based output to be returned to the client should be passed to the AddToolMessage method while handling this event. This method may be called multiple times, once for each data type, if the tool needs to pass multiple types of data back to the client.
The GetToolParamValue method may be called from within this event to retrieve the values for the tool parameters associated with the requested tool.
Name identifies the unique name associated with the tool.
Description holds the brief, human-readable description of what the tool does, and while not necessary, is often used here for sampling.
IsError may be set to true to indicate when an error condition is met and the tool cannot be handled successfully.
Example:
server.OnToolRequest += (s, e) =>
{
if (e.Name.Contains("read-docs"))
{
// Execute custom logic.
string documentation = ReadDocumentation();
// Return some text.
server.AddToolMessage((int)TToolMessageTypes.mtText, documentation);
}
};
Config Settings (MCPServer Component)
The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.MCPServer Config Settings
0 (None) | No messages are logged. |
1 (Info - Default) | Informational events are logged. |
2 (Verbose) | Detailed data is logged. |
3 (Debug) | Debug data including all relevant sent and received NFS operations are logged. |
The receiving MCP client should also support pagination.
The receiving MCP client should also support pagination.
The receiving MCP client should also support pagination.
Base Config Settings
The following is a list of valid code page identifiers:
Identifier | Name |
037 | IBM EBCDIC - U.S./Canada |
437 | OEM - United States |
500 | IBM EBCDIC - International |
708 | Arabic - ASMO 708 |
709 | Arabic - ASMO 449+, BCON V4 |
710 | Arabic - Transparent Arabic |
720 | Arabic - Transparent ASMO |
737 | OEM - Greek (formerly 437G) |
775 | OEM - Baltic |
850 | OEM - Multilingual Latin I |
852 | OEM - Latin II |
855 | OEM - Cyrillic (primarily Russian) |
857 | OEM - Turkish |
858 | OEM - Multilingual Latin I + Euro symbol |
860 | OEM - Portuguese |
861 | OEM - Icelandic |
862 | OEM - Hebrew |
863 | OEM - Canadian-French |
864 | OEM - Arabic |
865 | OEM - Nordic |
866 | OEM - Russian |
869 | OEM - Modern Greek |
870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
875 | IBM EBCDIC - Modern Greek |
932 | ANSI/OEM - Japanese, Shift-JIS |
936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
949 | ANSI/OEM - Korean (Unified Hangul Code) |
950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
1026 | IBM EBCDIC - Turkish (Latin-5) |
1047 | IBM EBCDIC - Latin 1/Open System |
1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
1147 | IBM EBCDIC - France (20297 + Euro symbol) |
1148 | IBM EBCDIC - International (500 + Euro symbol) |
1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
1201 | Unicode UCS-2 Big-Endian |
1250 | ANSI - Central European |
1251 | ANSI - Cyrillic |
1252 | ANSI - Latin I |
1253 | ANSI - Greek |
1254 | ANSI - Turkish |
1255 | ANSI - Hebrew |
1256 | ANSI - Arabic |
1257 | ANSI - Baltic |
1258 | ANSI/OEM - Vietnamese |
1361 | Korean (Johab) |
10000 | MAC - Roman |
10001 | MAC - Japanese |
10002 | MAC - Traditional Chinese (Big5) |
10003 | MAC - Korean |
10004 | MAC - Arabic |
10005 | MAC - Hebrew |
10006 | MAC - Greek I |
10007 | MAC - Cyrillic |
10008 | MAC - Simplified Chinese (GB 2312) |
10010 | MAC - Romania |
10017 | MAC - Ukraine |
10021 | MAC - Thai |
10029 | MAC - Latin II |
10079 | MAC - Icelandic |
10081 | MAC - Turkish |
10082 | MAC - Croatia |
12000 | Unicode UCS-4 Little-Endian |
12001 | Unicode UCS-4 Big-Endian |
20000 | CNS - Taiwan |
20001 | TCA - Taiwan |
20002 | Eten - Taiwan |
20003 | IBM5550 - Taiwan |
20004 | TeleText - Taiwan |
20005 | Wang - Taiwan |
20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
20106 | IA5 German (7-bit) |
20107 | IA5 Swedish (7-bit) |
20108 | IA5 Norwegian (7-bit) |
20127 | US-ASCII (7-bit) |
20261 | T.61 |
20269 | ISO 6937 Non-Spacing Accent |
20273 | IBM EBCDIC - Germany |
20277 | IBM EBCDIC - Denmark/Norway |
20278 | IBM EBCDIC - Finland/Sweden |
20280 | IBM EBCDIC - Italy |
20284 | IBM EBCDIC - Latin America/Spain |
20285 | IBM EBCDIC - United Kingdom |
20290 | IBM EBCDIC - Japanese Katakana Extended |
20297 | IBM EBCDIC - France |
20420 | IBM EBCDIC - Arabic |
20423 | IBM EBCDIC - Greek |
20424 | IBM EBCDIC - Hebrew |
20833 | IBM EBCDIC - Korean Extended |
20838 | IBM EBCDIC - Thai |
20866 | Russian - KOI8-R |
20871 | IBM EBCDIC - Icelandic |
20880 | IBM EBCDIC - Cyrillic (Russian) |
20905 | IBM EBCDIC - Turkish |
20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
20932 | JIS X 0208-1990 & 0121-1990 |
20936 | Simplified Chinese (GB2312) |
21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
21027 | Extended Alpha Lowercase |
21866 | Ukrainian (KOI8-U) |
28591 | ISO 8859-1 Latin I |
28592 | ISO 8859-2 Central Europe |
28593 | ISO 8859-3 Latin 3 |
28594 | ISO 8859-4 Baltic |
28595 | ISO 8859-5 Cyrillic |
28596 | ISO 8859-6 Arabic |
28597 | ISO 8859-7 Greek |
28598 | ISO 8859-8 Hebrew |
28599 | ISO 8859-9 Latin 5 |
28605 | ISO 8859-15 Latin 9 |
29001 | Europa 3 |
38598 | ISO 8859-8 Hebrew |
50220 | ISO 2022 Japanese with no halfwidth Katakana |
50221 | ISO 2022 Japanese with halfwidth Katakana |
50222 | ISO 2022 Japanese JIS X 0201-1989 |
50225 | ISO 2022 Korean |
50227 | ISO 2022 Simplified Chinese |
50229 | ISO 2022 Traditional Chinese |
50930 | Japanese (Katakana) Extended |
50931 | US/Canada and Japanese |
50933 | Korean Extended and Korean |
50935 | Simplified Chinese Extended and Simplified Chinese |
50936 | Simplified Chinese |
50937 | US/Canada and Traditional Chinese |
50939 | Japanese (Latin) Extended and Japanese |
51932 | EUC - Japanese |
51936 | EUC - Simplified Chinese |
51949 | EUC - Korean |
51950 | EUC - Traditional Chinese |
52936 | HZ-GB2312 Simplified Chinese |
54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
57002 | ISCII Devanagari |
57003 | ISCII Bengali |
57004 | ISCII Tamil |
57005 | ISCII Telugu |
57006 | ISCII Assamese |
57007 | ISCII Oriya |
57008 | ISCII Kannada |
57009 | ISCII Malayalam |
57010 | ISCII Gujarati |
57011 | ISCII Punjabi |
65000 | Unicode UTF-7 |
65001 | Unicode UTF-8 |
Identifier | Name |
1 | ASCII |
2 | NEXTSTEP |
3 | JapaneseEUC |
4 | UTF8 |
5 | ISOLatin1 |
6 | Symbol |
7 | NonLossyASCII |
8 | ShiftJIS |
9 | ISOLatin2 |
10 | Unicode |
11 | WindowsCP1251 |
12 | WindowsCP1252 |
13 | WindowsCP1253 |
14 | WindowsCP1254 |
15 | WindowsCP1250 |
21 | ISO2022JP |
30 | MacOSRoman |
10 | UTF16String |
0x90000100 | UTF16BigEndian |
0x94000100 | UTF16LittleEndian |
0x8c000100 | UTF32String |
0x98000100 | UTF32BigEndian |
0x9c000100 | UTF32LittleEndian |
65536 | Proprietary |
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the component to use the internal implementation instead of using the system security libraries.
This setting is set to false by default on all platforms.
Trappable Errors (MCPServer Component)
MCPServer Errors
104 | The component is already listening. |