MCP Client
从 Delphi 连接到 Model Context Protocol (MCP) 服务器。发现并调用工具、获取资源和使用提示词。
从 Delphi 连接到 Model Context Protocol (MCP) 服务器。发现并调用工具、获取资源和使用提示词。
Model Context Protocol 的客户端。通过 HTTP 或 HTTP Streamable 使用 JSON-RPC 与任意 MCP 服务器(Claude Desktop、Cursor、Anthropic MCP 服务器或自有服务器)通信。
TsgcWSAPIClient_MCP
Model Context Protocol JSON-RPC
Windows, macOS, Linux, iOS, Android
Enterprise(AI 附加模块)
配置 URL 和身份验证,调用 Initialize,然后列出目录并调用工具/提示词/资源。
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 个发布属性、12 个方法、12 个事件 — 来自组件参考。
Published properties: MCPOptions.
Published properties: Version.
Methods: Initialize, Ping.
Methods: ListTools, RequestTool.
Methods: ListPrompts, RequestPrompt.
Methods: ListResources, RequestResource, ListResourceTemplates.
本组件所实现协议的权威参考来源。