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

Method ConnectAll

pkg/tools/mcp/manager.go:72–88  ·  view source on GitHub ↗

ConnectAll 连接所有已添加的 MCP Server

(ctx context.Context)

Source from the content-addressed store, hash-verified

70
71// ConnectAll 连接所有已添加的 MCP Server
72func (m *MCPManager) ConnectAll(ctx context.Context) error {
73 m.mu.RLock()
74 serverIDs := make([]string, 0, len(m.servers))
75 for id := range m.servers {
76 serverIDs = append(serverIDs, id)
77 }
78 m.mu.RUnlock()
79
80 // 连接所有 Server
81 for _, serverID := range serverIDs {
82 if err := m.ConnectServer(ctx, serverID); err != nil {
83 return fmt.Errorf("connect server %s: %w", serverID, err)
84 }
85 }
86
87 return nil
88}
89
90// GetServer 获取指定的 MCP Server
91func (m *MCPManager) GetServer(serverID string) (*MCPServer, bool) {

Callers 1

Calls 1

ConnectServerMethod · 0.95

Tested by 1