Skip to content

Commit 4572d18

Browse files
authored
Merge pull request #154 from dgageot/incontainer
in container checks
2 parents ab6f7b2 + 3d7570c commit 4572d18

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

pkg/environment/incontainer.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package environment
2+
3+
import "os"
4+
5+
func IsInContainer() bool {
6+
if _, err := os.Stat("/.dockerenv"); err == nil {
7+
return true
8+
}
9+
return false
10+
}

pkg/teamloader/teamloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func checkRequiredEnvVars(ctx context.Context, cfg *latest.Config, env environme
110110
}
111111

112112
// Tools
113-
if runtimeConfig.ToolsGateway == "" {
113+
if runtimeConfig.ToolsGateway == "" && !environment.IsInContainer() {
114114
for _, agent := range cfg.Agents {
115115
for i := range agent.Toolsets {
116116
toolSet := agent.Toolsets[i]

pkg/tools/mcp/gateway.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ func (t *GatewayToolset) Instructions() string {
4848
}
4949

5050
func (t *GatewayToolset) configureOnce(ctx context.Context) error {
51+
if environment.IsInContainer() {
52+
var err error
53+
// TODO(dga): This is very temporary. Make the URL configurable.
54+
t.cmdToolset, err = NewToolsetRemote("http://gateway:8811", "streaming", nil, t.toolFilter)
55+
if err != nil {
56+
return fmt.Errorf("creating remote MCP toolset: %w", err)
57+
}
58+
59+
return nil
60+
}
61+
5162
mcpServerName := gateway.ParseServerRef(t.ref)
5263

5364
// Check which secrets (env vars) are required by the MCP server.

0 commit comments

Comments
 (0)