@@ -14,22 +14,10 @@ import (
14
14
"github.com/mark3labs/mcp-go/server"
15
15
)
16
16
17
- // Base URL for Harness API
18
- const baseURL = "https://app.harness.io/ng/api"
19
-
20
- // Default account, org, and project identifiers
21
- // In a real implementation, these would be configurable
22
- // TODO: remove these
23
- const (
24
- defaultAccountID = "wFHXHD0RRQWoO8tIZT5YVw"
25
- defaultOrgID = "default"
26
- defaultProjectID = "nitisha"
27
- )
28
-
29
17
// ConnectorClient provides methods to interact with Harness API for connectors
30
18
type ConnectorClient struct {
31
19
httpClient * http.Client
32
- baseURL string
20
+ config * Config
33
21
}
34
22
35
23
// NewConnectorClient creates a new connector client
@@ -38,7 +26,7 @@ func NewConnectorClient() *ConnectorClient {
38
26
httpClient : & http.Client {
39
27
Timeout : 30 * time .Second ,
40
28
},
41
- baseURL : baseURL ,
29
+ config : NewConfig () ,
42
30
}
43
31
}
44
32
@@ -61,9 +49,9 @@ func (c *ConnectorClient) ListConnectors(ctx context.Context, connectorNames []s
61
49
62
50
// Construct the query parameters
63
51
params := url.Values {}
64
- params .Add ("accountIdentifier" , defaultAccountID )
65
- params .Add ("orgIdentifier" , defaultOrgID )
66
- params .Add ("projectIdentifier" , defaultProjectID )
52
+ params .Add ("accountIdentifier" , c . config . AccountID )
53
+ params .Add ("orgIdentifier" , c . config . OrgID )
54
+ params .Add ("projectIdentifier" , c . config . ProjectID )
67
55
params .Add ("getDefaultFromOtherRepo" , "true" )
68
56
params .Add ("getDistinctFromBranches" , "true" )
69
57
params .Add ("onlyFavorites" , "false" )
@@ -87,7 +75,7 @@ func (c *ConnectorClient) ListConnectors(ctx context.Context, connectorNames []s
87
75
}
88
76
89
77
// Create a new HTTP request
90
- url := fmt .Sprintf ("%s/connectors/listV2?%s" , c .baseURL , params .Encode ())
78
+ url := fmt .Sprintf ("%s/connectors/listV2?%s" , c .config . BaseURL , params .Encode ())
91
79
req , err := http .NewRequestWithContext (ctx , http .MethodPost , url , bytes .NewBuffer (reqBodyBytes ))
92
80
if err != nil {
93
81
return nil , fmt .Errorf ("failed to create HTTP request: %w" , err )
0 commit comments