Skip to content

Commit 7b384e9

Browse files
Add tool-name-prefix feature flag and Server.Prefix field (#192)
* Update feature command to support tool-name-prefix Added tool-name-prefix to the docker mcp feature command: - Added to available features list in 'feature enable' help text - Added validation in isKnownFeature() function - Added usage hints when enabling the feature - Added to 'feature ls' command output with description - Added description in feature list display Usage: docker mcp feature enable tool-name-prefix docker mcp feature disable tool-name-prefix docker mcp feature ls When enabled, the feature automatically prefixes all tool names with their server name (e.g., 'search' becomes 'github:search'), preventing name conflicts when multiple servers provide tools with the same name. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * update docs --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4776cdf commit 7b384e9

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

cmd/docker-mcp/commands/feature.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ func featureEnableCommand(dockerCli command.Cli) *cobra.Command {
3939
Available features:
4040
oauth-interceptor Enable GitHub OAuth flow interception for automatic authentication
4141
mcp-oauth-dcr Enable Dynamic Client Registration (DCR) for automatic OAuth client setup
42-
dynamic-tools Enable internal MCP management tools (mcp-find, mcp-add, mcp-remove)`,
42+
dynamic-tools Enable internal MCP management tools (mcp-find, mcp-add, mcp-remove)
43+
tool-name-prefix Prefix all tool names with server name to avoid conflicts`,
4344
Args: cobra.ExactArgs(1),
4445
RunE: func(_ *cobra.Command, args []string) error {
4546
featureName := args[0]
4647

4748
// Validate feature name
4849
if !isKnownFeature(featureName) {
49-
return fmt.Errorf("unknown feature: %s\n\nAvailable features:\n oauth-interceptor Enable GitHub OAuth flow interception\n mcp-oauth-dcr Enable Dynamic Client Registration for automatic OAuth setup\n dynamic-tools Enable internal MCP management tools", featureName)
50+
return fmt.Errorf("unknown feature: %s\n\nAvailable features:\n oauth-interceptor Enable GitHub OAuth flow interception\n mcp-oauth-dcr Enable Dynamic Client Registration for automatic OAuth setup\n dynamic-tools Enable internal MCP management tools\n tool-name-prefix Prefix all tool names with server name", featureName)
5051
}
5152

5253
// Enable the feature
@@ -83,6 +84,13 @@ Available features:
8384
fmt.Println(" - mcp-add: add MCP servers to the registry and reload configuration")
8485
fmt.Println(" - mcp-remove: remove MCP servers from the registry and reload configuration")
8586
fmt.Println("\nNo additional flags are needed - this applies to all gateway runs.")
87+
case "tool-name-prefix":
88+
fmt.Println("\nThis feature enables automatic prefixing of tool names with server names.")
89+
fmt.Println("When enabled, all tools are automatically prefixed with their server name:")
90+
fmt.Println(" - Example: 'search' becomes 'github:search'")
91+
fmt.Println(" - Prevents name conflicts when multiple servers provide tools with the same name")
92+
fmt.Println(" - Individual servers can override this with the 'prefix' field in their configuration")
93+
fmt.Println("\nNo additional flags are needed - this applies to all gateway runs.")
8694
}
8795

8896
return nil
@@ -137,7 +145,7 @@ func featureListCommand(dockerCli command.Cli) *cobra.Command {
137145
fmt.Println()
138146

139147
// Show all known features
140-
knownFeatures := []string{"oauth-interceptor", "mcp-oauth-dcr", "dynamic-tools"}
148+
knownFeatures := []string{"oauth-interceptor", "mcp-oauth-dcr", "dynamic-tools", "tool-name-prefix"}
141149
for _, feature := range knownFeatures {
142150
status := "disabled"
143151
if isFeatureEnabledFromCli(dockerCli, feature) {
@@ -154,6 +162,8 @@ func featureListCommand(dockerCli command.Cli) *cobra.Command {
154162
fmt.Printf(" %-20s %s\n", "", "Enable Dynamic Client Registration (DCR) for automatic OAuth client setup")
155163
case "dynamic-tools":
156164
fmt.Printf(" %-20s %s\n", "", "Enable internal MCP management tools (mcp-find, mcp-add, mcp-remove)")
165+
case "tool-name-prefix":
166+
fmt.Printf(" %-20s %s\n", "", "Prefix all tool names with server name to avoid conflicts")
157167
}
158168
fmt.Println()
159169
}
@@ -217,6 +227,7 @@ func isKnownFeature(feature string) bool {
217227
"oauth-interceptor",
218228
"mcp-oauth-dcr",
219229
"dynamic-tools",
230+
"tool-name-prefix",
220231
}
221232

222233
for _, known := range knownFeatures {

docs/generator/reference/docker_mcp_feature_enable.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ long: |-
77
oauth-interceptor Enable GitHub OAuth flow interception for automatic authentication
88
mcp-oauth-dcr Enable Dynamic Client Registration (DCR) for automatic OAuth client setup
99
dynamic-tools Enable internal MCP management tools (mcp-find, mcp-add, mcp-remove)
10+
tool-name-prefix Prefix all tool names with server name to avoid conflicts
1011
usage: docker mcp feature enable <feature-name>
1112
pname: docker mcp feature
1213
plink: docker_mcp_feature.yaml

docs/generator/reference/mcp_feature_enable.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Available features:
77
oauth-interceptor Enable GitHub OAuth flow interception for automatic authentication
88
mcp-oauth-dcr Enable Dynamic Client Registration (DCR) for automatic OAuth client setup
99
dynamic-tools Enable internal MCP management tools (mcp-find, mcp-add, mcp-remove)
10+
tool-name-prefix Prefix all tool names with server name to avoid conflicts
1011

1112

1213
<!---MARKER_GEN_END-->

0 commit comments

Comments
 (0)