Delphi MCP Client
Connect to Model Context Protocol (MCP) servers from Delphi. Discover and invoke tools, fetch resources, and use prompts.
Connect to Model Context Protocol (MCP) servers from Delphi. Discover and invoke tools, fetch resources, and use prompts.
Client side of the Model Context Protocol. Talks JSON-RPC over HTTP or HTTP Streamable to any MCP server (Claude Desktop, Cursor, Anthropic MCP servers, your own).
TsgcWSAPIClient_MCP
Model Context Protocol JSON-RPC, spec 2026-07-28 with 2025-11-25 fallback
Windows, macOS, Linux, iOS, Android
Enterprise / sgcAI
Configure URL + auth, Initialize, then list catalogues and call tools / prompts / resources.
uses
sgcAI_MCP_Client, sgcAI_MCP_Classes;
var
MCP: TsgcWSAPIClient_MCP;
begin
MCP := TsgcWSAPIClient_MCP.Create(nil);
MCP.MCPOptions.HttpOptions.URL := 'https://mcp.example.com/';
MCP.MCPOptions.ClientInfo.Name := 'sgc-mcp-client';
MCP.MCPOptions.ClientInfo.Title := 'sgc MCP demo';
MCP.MCPOptions.ClientInfo.Version := '1.0.0';
MCP.MCPOptions.AuthenticationOptions.ApiKey.Enabled := True;
MCP.MCPOptions.AuthenticationOptions.ApiKey.Value := 'sk-mcp-...';
MCP.OnMCPInitialize := MCPInit;
MCP.OnMCPListPrompts := MCPListPrompts;
MCP.OnMCPListTools := MCPListTools;
MCP.OnMCPResponseTool := MCPToolResponse;
MCP.Initialize;
MCP.ListPrompts;
MCP.ListResources;
MCP.ListTools;
MCP.RequestTool('GetTemperature', '{"city":"Madrid"}');
end;
2 published properties, 12 methods, 12 events — pulled from the component reference.
Published properties: MCPOptions.
Published properties: Version.
Methods: Initialize, Ping.
Methods: ListTools, RequestTool.
Methods: ListPrompts, RequestPrompt.
Methods: ListResources, RequestResource, ListResourceTemplates.
Property: MCPOptions.ProtocolEra (Auto, Modern, Legacy). Method: Discover. In Auto mode the client probes server/discover and falls back to 2025-11-25 initialize automatically.
Event: OnMCPInputRequired. Answer elicitation, sampling and roots requests and the client retries the call with the signed requestState. Legacy servers that send those requests directly, outside a tool call, are answered automatically by OnMCPListRoots, OnMCPSamplingCreateMessage and OnMCPElicitationCreate when assigned.
Methods: SubscriptionsListen, SubscriptionsCancel. Events: OnMCPListChanged, OnMCPResourcesUpdated.
Property: MCPOptions.Tasks.Enabled (AutoPoll polls the task automatically). Methods: TasksGet, TasksUpdate, TasksCancel. Events: OnMCPTaskCreated, OnMCPTaskStatus, OnMCPTaskCompleted.
Property: MCPOptions.Authorization. OAuth with protected resource metadata discovery, Client ID Metadata Documents, dynamic registration fallback, PKCE, resource indicators, RFC 9207 iss validation and per-issuer credentials.
Authoritative sources for the protocols this component implements.
Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.
| Demo Project — Demos\AI\MCP\Client Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below. | Open | |
| Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only. | Open | |
| User Manual (PDF) Comprehensive manual covering every component in the library. | Open |