TsgcWSAPIServer_MCP › Properties › MCPOptions

MCPOptions Property

Core MCP server settings: ServerInfo, SessionTimeout, authentication policies and the MCP 2026-07-28 options.

Syntax

property MCPOptions: TsgcAI_MCP_Server_Options read FMCPOptions write SetMCPOptions;

Default Value

—

Remarks

Aggregates the runtime configuration consumed by the underlying TsgcAI_MCP_Server engine. Use ServerInfo to set the name, version, title, website URL and icons advertised during the MCP handshake, SessionTimeout to control how long an idle session survives before it is deleted (and OnMCPSessionEnd fires), TasksSupported to advertise the tasks capability when your tools declare a TaskSupport hint, and AuthenticationOptions to enforce CustomHeader and/or ApiKey (Authorization: Bearer <value>) validation on every HTTP round-trip. Changes take effect on subsequent requests; existing sessions keep the previously negotiated capabilities.

ServerInfo.Icons expects a raw JSON array of MCP icon descriptors. Per the MCP icon schema, each icon's sizes must be a JSON array of strings (for example ["48x48"]), even for a single size; a bare string is rejected by MCP client SDKs.

When AuthenticationOptions.ApiKey is enabled, the MCP server automatically exposes an OAuth 2.1 authorization flow on the same HTTP server, including /.well-known/oauth-authorization-server (RFC 8414), /.well-known/oauth-protected-resource (RFC 9728), /oauth/register (RFC 7591 dynamic client registration), /oauth/authorize (renders an HTML consent form) and /oauth/token (PKCE S256, authorization-code and refresh-token grants). The value configured in ApiKey.Value is reused as the password the user must enter on the consent form to approve a connector. Once approved, the bearer token issued by /oauth/token is accepted on subsequent /mcp calls in addition to the static ApiKey.Value. OAuth clients, codes and tokens are stored in memory and are lost when the server restarts. See the component overview page for the full list of built-in HTTP endpoints.

The following sub-properties configure the features of the MCP protocol version 2026-07-28:

NameDefaultDescription
Cache.ScopeaimcpcsPrivateCache scope (cacheScope) sent with cacheable modern results such as server/discover.
Cache.TTLMs60000Cache time to live in milliseconds (ttlMs).
InstructionsemptyFree text sent in the server/discover result to explain how to use the server.
ExtensionsemptyRaw JSON object with the extensions advertised in server/discover.
Subscriptions.EnabledTrueEnables the subscriptions/listen method.
Subscriptions.KeepAliveInterval15000Milliseconds between keep-alive comments on an idle subscription stream; 0 disables them.
MRTR.SecretrandomKey used to sign the requestState of multi round-trip requests with HMAC-SHA256. If empty, a random key is created per server instance.
MRTR.StateTTL600Validity in seconds of a requestState.
Tasks.EnabledFalseEnables the tasks extension (io.modelcontextprotocol/tasks).
Tasks.TTL3600000Task time to live in milliseconds; 0 means unlimited.
Tasks.PollInterval1000Suggested polling interval in milliseconds sent to the client.
Tasks.MaxTasks1000Maximum number of live tasks.

See Protocol Versions, Subscriptions, Multi Round-Trip Requests and Tasks.

Example

MCPServer.MCPOptions.ServerInfo.Name := 'sgc-mcp-server';
MCPServer.MCPOptions.ServerInfo.Version := '1.0.0';
MCPServer.MCPOptions.ServerInfo.Title := 'My MCP Server';
MCPServer.MCPOptions.ServerInfo.WebsiteUrl := 'https://example.com';
MCPServer.MCPOptions.TasksSupported := True;
MCPServer.MCPOptions.SessionTimeout := 60000;
MCPServer.MCPOptions.AuthenticationOptions.ApiKey.Enabled := True;
MCPServer.MCPOptions.AuthenticationOptions.ApiKey.Value := 'super-secret-token';
// MCP 2026-07-28
MCPServer.MCPOptions.Instructions := 'Use the weather tools to answer forecast questions.';
MCPServer.MCPOptions.Cache.TTLMs := 300000;
MCPServer.MCPOptions.MRTR.Secret := 'shared-secret-for-all-nodes';
MCPServer.MCPOptions.Tasks.Enabled := True;

Back to Properties