MCP Server
Build Model Context Protocol (MCP) servers in Delphi. Expose tools, resources, and prompts to AI applications.
Build Model Context Protocol (MCP) servers in Delphi. Expose tools, resources, and prompts to AI applications.
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.
TsgcWSAPIServer_MCP
Model Context Protocol server
Windows, macOS, Linux, iOS, Android
Enterprise (AI add-on)
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;
5 published properties, 9 methods, 12 events — pulled from the component reference.
Methods: KeepAlive.
Events: OnMCPHTTPRequest, OnMCPHTTPResponse.
Published properties: MCPOptions, EndpointOptions, TransportOptions.
Published properties: Version.
Properties: Server.
Methods: RequestRootsList, RequestSamplingCreateMessage, RequestElicitationCreate.
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\Server 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 |