MCP Server
Delphi로 Model Context Protocol (MCP) 서버를 구축해 보세요. AI 애플리케이션에 도구, 리소스, 프롬프트를 노출시킬 수 있어요.
Delphi로 Model Context Protocol (MCP) 서버를 구축해 보세요. AI 애플리케이션에 도구, 리소스, 프롬프트를 노출시킬 수 있어요.
MCP를 지원하는 어떤 LLM 클라이언트에도 자체 도구, 프롬프트, 리소스를 노출시킬 수 있어요. sgcWebSockets HTTP 서버 위에서 HTTP 및 HTTP Streamable 전송으로 JSON-RPC 엔드포인트를 호스팅해요.
TsgcWSAPIServer_MCP
Windows, macOS, Linux, iOS, Android
Enterprise (AI 애드온)
HTTP 서버에 연결하고, ServerInfo를 채우고, OnMCPRequest* 핸들러를 연결한 다음, 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개의 게시된 속성, 9개의 메서드, 12개의 이벤트 — 컴포넌트 참조 문서에서 가져왔어요.
메서드: KeepAlive.
이벤트: OnMCPHTTPRequest, OnMCPHTTPResponse.
게시된 속성: MCPOptions, EndpointOptions, TransportOptions.
게시된 속성: Version.
속성: Server.
메서드: RequestRootsList, RequestSamplingCreateMessage, RequestElicitationCreate.
이 컴포넌트가 구현하는 프로토콜의 공식 출처입니다.
TsgcWSAPIServer_MCP 컴포넌트를 놓고, MCPOptions.HttpOptions.Port와 MCPOptions.ServerInfo를 설정하고, OnMCPRequest* 핸들러를 연결한 다음, Active := True를 설정하세요. sgcWebSockets HTTP 서버 위에서 JSON-RPC 엔드포인트를 호스팅해요.
TransportOptions 및 EndpointOptions 게시된 속성을 통해 설정돼요.
OnMCPRequestTool, 프롬프트에는 OnMCPRequestPrompt, 리소스에는 OnMCPRequestResource를 사용해요. 예를 들어 SendNotificationToolsListChanged로 연결된 모든 세션에 업데이트를 푸시할 수도 있어요.
RequestRootsList, RequestSamplingCreateMessage, RequestElicitationCreate를 통해 서버 시작 요청을 지원하므로, 서버가 연결된 MCP 클라이언트에 roots, sampling 완성 또는 사용자 입력을 요청할 수 있어요.