Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pkg/secrets/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package secrets
import (
"context"
"fmt"
"os"
"sort"

"github.com/docker/cagent/pkg/config"
latest "github.com/docker/cagent/pkg/config/v2"
"github.com/docker/cagent/pkg/environment"
"github.com/docker/cagent/pkg/gateway"
"github.com/docker/cagent/pkg/model/provider"
"github.com/docker/cagent/pkg/tools/mcp"
)

// GatherMissingEnvVars finds out which environment variables are required by the models and tools.
Expand Down Expand Up @@ -80,10 +78,6 @@ func GatherEnvVarsForTools(ctx context.Context, cfg *latest.Config) ([]string, e

for _, ref := range gatherMCPServerReferences(cfg) {
mcpServerName := gateway.ParseServerRef(ref)
if mcpServerURL := os.Getenv(mcp.ENV_DOCKER_MCP_URL_PREFIX + mcpServerName); mcpServerURL != "" {
// This MCP server is configured at runtime to be remote. We don't need to know its secrets.
continue
}

secrets, err := gateway.RequiredEnvVars(ctx, mcpServerName, gateway.DockerCatalogURL)
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions pkg/teamloader/teamloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,7 @@ func getToolsForAgent(ctx context.Context, a *latest.AgentConfig, parentDir stri

case toolset.Type == "mcp" && toolset.Ref != "":
mcpServerName := gateway.ParseServerRef(toolset.Ref)
if mcpServerURL := os.Getenv(mcp.ENV_DOCKER_MCP_URL_PREFIX + mcpServerName); mcpServerURL != "" {
t = append(t, mcp.NewToolsetCommand("socat", []string{"STDIO", fmt.Sprintf("TCP:mcp-%s:4444", mcpServerName)}, nil, toolset.Tools))
} else {
t = append(t, mcp.NewGatewayToolset(mcpServerName, toolset.Config, toolset.Tools, envProvider))
}
t = append(t, mcp.NewGatewayToolset(mcpServerName, toolset.Config, toolset.Tools, envProvider))

case toolset.Type == "mcp" && toolset.Command != "":
t = append(t, mcp.NewToolsetCommand(toolset.Command, toolset.Args, env, toolset.Tools))
Expand Down
2 changes: 0 additions & 2 deletions pkg/tools/mcp/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
"github.com/docker/cagent/pkg/tools"
)

const ENV_DOCKER_MCP_URL_PREFIX = "DOCKER_MCP_URL_"

type GatewayToolset struct {
mcpServerName string
config any
Expand Down
Loading