MCP Server Component — sgcWebSockets | eSeGeCe

MCP Server

Build Model Context Protocol (MCP) servers in Delphi. Expose tools, resources, and prompts to AI applications.

TsgcWSAPIServer_MCP

Expose your own tools, prompts and resources to any MCP-aware LLM client. Hosts a JSON-RPC endpoint with HTTP and HTTP Streamable transports on top of a sgcWebSockets HTTP server.

Component class

TsgcWSAPIServer_MCP

Protocol

Model Context Protocol server

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Enterprise / sgcAI

Drop the component, set a few properties, go

Attach to an HTTP server, populate ServerInfo, hook the OnMCPRequest* handlers, set Active := True.

uses
  sgcAI_MCP_Server, sgcAI_MCP_Classes;

var
  MCP: TsgcWSAPIServer_MCP;
begin
  MCP := TsgcWSAPIServer_MCP.Create(nil);
  MCP.MCPOptions.HttpOptions.Port   := 8080;
  MCP.MCPOptions.ServerInfo.Name    := 'sgc-mcp-server';
  MCP.MCPOptions.ServerInfo.Title   := 'Weather MCP';
  MCP.MCPOptions.ServerInfo.Version := '1.0.0';

  // Lifecycle + incoming request handlers
  MCP.OnMCPInitialize     := SrvInitialize;
  MCP.OnMCPSessionNew     := SrvSessionNew;
  MCP.OnMCPRequestTool    := SrvCallTool;
  MCP.OnMCPRequestPrompt  := SrvGetPrompt;
  MCP.OnMCPRequestResource := SrvReadResource;

  MCP.Active := True;

  // Push a notification to every connected session
  MCP.SendNotificationToolsListChanged;
end;

What's inside

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

Lifecycle

Methods: KeepAlive.

HTTP

Events: OnMCPHTTPRequest, OnMCPHTTPResponse.

Configuration

Published properties: MCPOptions, EndpointOptions, TransportOptions.

Diagnostics

Published properties: Version.

Server

Properties: Server.

Server-initiated requests

Methods: RequestRootsList, RequestSamplingCreateMessage, RequestElicitationCreate.

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\Server 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.

Frequently Asked Questions

Drop a TsgcWSAPIServer_MCP component, set MCPOptions.HttpOptions.Port and MCPOptions.ServerInfo, hook the OnMCPRequest* handlers, then set Active := True. It hosts a JSON-RPC endpoint on top of a sgcWebSockets HTTP server.
The component ships with sgcWebSockets, which supports Delphi 7 through Delphi 13 Florence and the matching C++ Builder versions. It runs on Windows, macOS, Linux, iOS and Android.
It hosts a JSON-RPC endpoint with HTTP and HTTP Streamable transports, on top of a sgcWebSockets HTTP server. Transport behaviour is configured through the TransportOptions and EndpointOptions published properties.
Handle the incoming request events: OnMCPRequestTool for tool calls, OnMCPRequestPrompt for prompts and OnMCPRequestResource for resources. You can also push updates to every connected session, for example with SendNotificationToolsListChanged.
Yes. The component supports server-initiated requests through RequestRootsList, RequestSamplingCreateMessage and RequestElicitationCreate, so the server can ask the connected MCP client for roots, sampling completions or user input.
Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Ready to Build an MCP Server?

Download the free trial and start building in minutes.