TsgcWSAPIClient_MCP component.
TsgcWSAPIClient_MCP implements a Model Context Protocol (MCP) consumer on top of sgcWebSockets networking components. It takes care of session negotiation, JSON-RPC request/response marshalling and convenience events so Delphi & Cbuilder applications can discover prompts, resources and tools exposed by any MCP-compliant server.
Configuration
- Drop the component: place TsgcWSAPIClient_MCP on a form/data-module.
- Point to an MCP endpoint: set MCPOptions.HttpOptions.URL to the server HTTP URL that exposes the protocol (for example
https://localhost:5001/mcp). Configure TLS and logging through the nested TLSOptions and LogOptions objects if needed.
- Describe the client: populate MCPOptions.ClientInfo with the product Name, human-readable Title and semantic Version. These values are forwarded during the initialize handshake.
- Secure the session: configure MCPOptions.AuthenticationOptions when the server expects an API key or a custom HTTP header. The credentials are attached to every HTTP request, including streaming upgrades.
- Tune keep-alive: use MCPOptions.HeartBeat to enable the automatic
ping cycle and define the preferred interval (seconds). The component internally calls Ping when the internal keep-alive timer fires.
- Handle events: subscribe to the events described later in order to log responses, accept/reject sessions or post-process payloads returned by the server.