MCP Client

Connect to Model Context Protocol (MCP) servers from Delphi. Discover and invoke tools, fetch resources, and use prompts.

TsgcWSAPIClient_MCP

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).

Component class

TsgcWSAPIClient_MCP

Protocol

Model Context Protocol JSON-RPC

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise (AI add-on)

Drop the component, set a few properties, go

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;

What's inside

2 published properties, 12 methods, 12 events — pulled from the component reference.

Configuration

Published properties: MCPOptions.

Diagnostics

Published properties: Version.

Session

Methods: Initialize, Ping.

Tools

Methods: ListTools, RequestTool.

Prompts

Methods: ListPrompts, RequestPrompt.

Resources

Methods: ListResources, RequestResource, ListResourceTemplates.

Specifications & references

Authoritative sources for the protocols this component implements.

Documentation & Demos

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.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Connect to MCP Servers?

Download the free trial and start building in minutes.