Skip to content

Commit d236011

Browse files
authored
Make mcp-oauth-dcr feature default true (#188)
1 parent e17d32a commit d236011

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

cmd/docker-mcp/commands/feature.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,12 @@ func isFeatureEnabledFromCli(dockerCli command.Cli, feature string) bool {
190190
// isFeatureEnabledFromConfig checks if a feature is enabled from a config file
191191
func isFeatureEnabledFromConfig(configFile *configfile.ConfigFile, feature string) bool {
192192
if configFile.Features == nil {
193-
return false
193+
return feature == "mcp-oauth-dcr" // mcp-oauth-dcr is enabled by default
194194
}
195195

196196
value, exists := configFile.Features[feature]
197197
if !exists {
198-
return false
198+
return feature == "mcp-oauth-dcr" // mcp-oauth-dcr is enabled by default
199199
}
200200

201201
// Handle both boolean string values and "enabled"/"disabled" strings

cmd/docker-mcp/commands/feature_test.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,48 @@ func TestIsFeatureEnabledDynamicTools(t *testing.T) {
6767
})
6868
}
6969

70+
func TestIsFeatureEnabledMcpOAuthDcr(t *testing.T) {
71+
t.Run("enabled", func(t *testing.T) {
72+
configFile := &configfile.ConfigFile{
73+
Features: map[string]string{
74+
"mcp-oauth-dcr": "enabled",
75+
},
76+
}
77+
enabled := isFeatureEnabledFromConfig(configFile, "mcp-oauth-dcr")
78+
assert.True(t, enabled)
79+
})
80+
81+
t.Run("disabled", func(t *testing.T) {
82+
configFile := &configfile.ConfigFile{
83+
Features: map[string]string{
84+
"mcp-oauth-dcr": "disabled",
85+
},
86+
}
87+
enabled := isFeatureEnabledFromConfig(configFile, "mcp-oauth-dcr")
88+
assert.False(t, enabled)
89+
})
90+
91+
t.Run("missing", func(t *testing.T) {
92+
configFile := &configfile.ConfigFile{
93+
Features: make(map[string]string),
94+
}
95+
enabled := isFeatureEnabledFromConfig(configFile, "mcp-oauth-dcr")
96+
assert.True(t, enabled, "mcp-oauth-dcr should default to enabled when missing")
97+
})
98+
99+
t.Run("nil features map", func(t *testing.T) {
100+
configFile := &configfile.ConfigFile{
101+
Features: nil,
102+
}
103+
enabled := isFeatureEnabledFromConfig(configFile, "mcp-oauth-dcr")
104+
assert.True(t, enabled, "mcp-oauth-dcr should default to enabled when Features is nil")
105+
})
106+
}
107+
70108
func TestIsKnownFeature(t *testing.T) {
71109
// Test valid features
72110
assert.True(t, isKnownFeature("oauth-interceptor"))
111+
assert.True(t, isKnownFeature("mcp-oauth-dcr"))
73112
assert.True(t, isKnownFeature("dynamic-tools"))
74113

75114
// Test invalid features

cmd/docker-mcp/commands/gateway.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ func isOAuthInterceptorFeatureEnabled(dockerCli command.Cli) bool {
278278
func isMcpOAuthDcrFeatureEnabled(dockerCli command.Cli) bool {
279279
configFile := dockerCli.ConfigFile()
280280
if configFile == nil || configFile.Features == nil {
281-
return false
281+
return true // Default enabled when no config exists
282282
}
283283

284284
value, exists := configFile.Features["mcp-oauth-dcr"]
285285
if !exists {
286-
return false
286+
return true // Default enabled when not in config
287287
}
288288

289289
return value == "enabled"

0 commit comments

Comments
 (0)