Skip to content

Commit 565c7d0

Browse files
committed
Make the MCP Gateway work out of the box with Docker CE
Signed-off-by: David Gageot <[email protected]>
1 parent 7982268 commit 565c7d0

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

cmd/docker-mcp/command.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ func rootCommand(ctx context.Context, cwd string, dockerCli command.Cli) *cobra.
5858
return err
5959
}
6060

61-
// TODO(dga): We should also disable this check when running in Docker CE.
6261
if os.Getenv("DOCKER_MCP_IN_CONTAINER") != "1" {
63-
return desktop.CheckFeatureIsEnabled(ctx, "enableDockerMCPToolkit", "Docker MCP Toolkit")
62+
runningInDockerCE, err := docker.RunningInDockerCE(ctx, dockerCli)
63+
if err != nil {
64+
return err
65+
}
66+
67+
if !runningInDockerCE {
68+
return desktop.CheckFeatureIsEnabled(ctx, "enableDockerMCPToolkit", "Docker MCP Toolkit")
69+
}
6470
}
6571

6672
return nil

cmd/docker-mcp/internal/docker/client.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package docker
22

33
import (
44
"context"
5+
"fmt"
56
"io"
7+
"runtime"
68
"sync"
79

810
"github.com/docker/cli/cli/command"
@@ -51,3 +53,16 @@ func NewClient(cli command.Cli) Client {
5153
}),
5254
}
5355
}
56+
57+
func RunningInDockerCE(ctx context.Context, dockerCli command.Cli) (bool, error) {
58+
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {
59+
return false, nil
60+
}
61+
62+
info, err := dockerCli.Client().Info(ctx)
63+
if err != nil {
64+
return false, fmt.Errorf("failed to ping Docker daemon: %w", err)
65+
}
66+
67+
return info.OperatingSystem != "Docker Desktop", nil
68+
}

0 commit comments

Comments
 (0)