MCPcopy Create free account
hub / github.com/astercloud/aster / NewMCPClient

Function NewMCPClient

pkg/sandbox/cloud/mcp.go:32–46  ·  view source on GitHub ↗

NewMCPClient 创建 MCP 客户端

(config *MCPClientConfig)

Source from the content-addressed store, hash-verified

30
31// NewMCPClient 创建 MCP 客户端
32func NewMCPClient(config *MCPClientConfig) *MCPClient {
33 if config.Timeout == 0 {
34 config.Timeout = 30 * time.Second
35 }
36
37 return &MCPClient{
38 endpoint: config.Endpoint,
39 accessKeyID: config.AccessKeyID,
40 accessKeySecret: config.AccessKeySecret,
41 securityToken: config.SecurityToken,
42 httpClient: &http.Client{
43 Timeout: config.Timeout,
44 },
45 }
46}
47
48// CallTool 调用 MCP 工具
49func (mc *MCPClient) CallTool(ctx context.Context, toolName string, params map[string]any) (json.RawMessage, error) {

Callers 6

NewMCPServerFunction · 0.92
TestToolFactoryFunction · 0.92
NewAliyunSandboxFunction · 0.85
NewVolcengineSandboxFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestToolFactoryFunction · 0.74