Skip to content

Commit 3175767

Browse files
authored
refactor: Make xtramcp backend host name configurable (#14)
1 parent 1173a30 commit 3175767

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

internal/libs/cfg/cfg.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ type Cfg struct {
1010
OpenAIAPIKey string
1111
JwtSigningKey string
1212

13-
MongoURI string
13+
MongoURI string
14+
XtraMCPURI string
1415
}
1516

1617
var cfg *Cfg
@@ -21,11 +22,20 @@ func GetCfg() *Cfg {
2122
OpenAIAPIKey: os.Getenv("OPENAI_API_KEY"),
2223
JwtSigningKey: os.Getenv("JWT_SIGNING_KEY"),
2324
MongoURI: mongoURI(),
25+
XtraMCPURI: xtraMCPURI(),
2426
}
2527

2628
return cfg
2729
}
2830

31+
func xtraMCPURI() string {
32+
val := os.Getenv("XTRAMCP_URI")
33+
if val != "" {
34+
return val
35+
}
36+
return "http://paperdebugger-xtra-mcp-server.com/mcp"
37+
}
38+
2939
func mongoURI() string {
3040
val := os.Getenv("PD_MONGO_URI")
3141
if val != "" {

internal/services/toolkit/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func NewAIClient(
5151
// toolRegistry.Register("greeting", tools.GreetingToolDescription, tools.GreetingTool)
5252

5353
// Load tools dynamically from backend
54-
xtraMCPLoader := xtramcp.NewXtraMCPLoader(db, projectService, "http://paperdebugger-xtra-mcp-server.com/mcp")
54+
xtraMCPLoader := xtramcp.NewXtraMCPLoader(db, projectService, cfg.XtraMCPURI)
5555

5656
// initialize MCP session first and log session ID
5757
sessionID, err := xtraMCPLoader.InitializeMCP()

0 commit comments

Comments
 (0)