Skip to content

Commit 98b4efb

Browse files
Saranya-jenaHarness
authored andcommitted
chore: [ML-1243]: Added Default Module in interface structure with the set of default tools (#68)
* chore: [ML-1243]: Updated branch Signed-off-by: Saranya-jena <[email protected]> * Merge branch 'master' of https://git0.harness.io/l7B_kbSEQD2wjrM7PShm5w/PROD/Harness_Commons/mcp-server into ML-1243 * chore: [ML-1243]: Updated branch Signed-off-by: Saranya-jena <[email protected]> * chore: [ML-1243]: Added Default Module in interface structure with the set of default tools Signed-off-by: Saranya-jena <[email protected]>
1 parent b72b344 commit 98b4efb

38 files changed

+1027
-910
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ func registerGenai(config *config.Config, tsg *toolsets.ToolsetGroup) error {
466466
secret := <GENAI_SECRET>
467467
468468
// Create base client for genai with the default timeout
469-
c, err := createClient(baseURL, config, secret, defaultGenaiTimeout)
469+
c, err := CreateClient(baseURL, config, secret, defaultGenaiTimeout)
470470
if err != nil {
471471
return err
472472
}

cmd/harness-mcp-server/config/config.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package config
22

33
type Config struct {
44
// Common fields for both modes
5-
Version string
6-
ReadOnly bool
7-
Toolsets []string
8-
LogFilePath string
9-
Debug bool
5+
Version string
6+
ReadOnly bool
7+
Toolsets []string
8+
EnabledModules []string
9+
LogFilePath string
10+
Debug bool
1011

1112
Internal bool
1213

cmd/harness-mcp-server/main.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"context"
55
"fmt"
6+
"github.com/harness/harness-mcp/pkg/harness/tools"
67
"io"
78
"log"
89
"log/slog"
@@ -78,6 +79,7 @@ var (
7879
Toolsets: toolsets,
7980
LogFilePath: viper.GetString("log_file"),
8081
Debug: viper.GetBool("debug"),
82+
EnabledModules: harness.EnabledModules,
8183
}
8284

8385
if err := runStdioServer(ctx, cfg); err != nil {
@@ -124,13 +126,14 @@ var (
124126

125127
cfg := config.Config{
126128
// Common fields
127-
Version: version,
128-
ReadOnly: true, // we keep it read-only for now
129-
Toolsets: toolsets,
130-
LogFilePath: viper.GetString("log_file"),
131-
Debug: viper.GetBool("debug"),
132-
Internal: true,
133-
AccountID: session.Principal.AccountID,
129+
Version: version,
130+
ReadOnly: true, // we keep it read-only for now
131+
Toolsets: toolsets,
132+
EnabledModules: harness.EnabledModules,
133+
LogFilePath: viper.GetString("log_file"),
134+
Debug: viper.GetBool("debug"),
135+
Internal: true,
136+
AccountID: session.Principal.AccountID,
134137
// Internal mode specific fields
135138
BearerToken: viper.GetString("bearer_token"),
136139
PipelineSvcBaseURL: viper.GetString("pipeline_svc_base_url"),
@@ -342,7 +345,7 @@ func runStdioServer(ctx context.Context, config config.Config) error {
342345

343346
// Create server
344347
// WithRecovery makes sure panics are logged and don't crash the server
345-
harnessServer := harness.NewServer(version, server.WithHooks(hooks), server.WithRecovery())
348+
harnessServer := tools.NewServer(version, server.WithHooks(hooks), server.WithRecovery())
346349

347350
// Initialize toolsets
348351
toolsets, err := harness.InitToolsets(&config)
@@ -354,7 +357,7 @@ func runStdioServer(ctx context.Context, config config.Config) error {
354357
toolsets.RegisterTools(harnessServer)
355358

356359
// Set the guidelines prompts
357-
harness.RegisterPrompts(harnessServer)
360+
tools.RegisterPrompts(harnessServer)
358361

359362
// Create stdio server
360363
stdioServer := server.NewStdioServer(harnessServer)

0 commit comments

Comments
 (0)