Skip to content

Commit 6ca2d3c

Browse files
authored
Remove deprecated commands and flags (#1132)
1 parent b25ed57 commit 6ca2d3c

File tree

5 files changed

+7
-70
lines changed

5 files changed

+7
-70
lines changed

cmd/thv-operator/controllers/mcpserver_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ func (r *MCPServerReconciler) deploymentForMCPServer(m *mcpv1alpha1.MCPServer) *
387387

388388
// Prepare container args
389389
args := []string{"run", "--foreground=true"}
390-
args = append(args, fmt.Sprintf("--port=%d", m.Spec.Port))
390+
args = append(args, fmt.Sprintf("--proxy-port=%d", m.Spec.Port))
391391
args = append(args, fmt.Sprintf("--name=%s", m.Name))
392392
args = append(args, fmt.Sprintf("--transport=%s", m.Spec.Transport))
393393
args = append(args, fmt.Sprintf("--host=%s", getProxyHost()))
@@ -780,7 +780,7 @@ func deploymentNeedsUpdate(deployment *appsv1.Deployment, mcpServer *mcpv1alpha1
780780
}
781781

782782
// Check if the port has changed
783-
portArg := fmt.Sprintf("--port=%d", mcpServer.Spec.Port)
783+
portArg := fmt.Sprintf("--proxy-port=%d", mcpServer.Spec.Port)
784784
found = false
785785
for _, arg := range container.Args {
786786
if arg == portArg {

cmd/thv-proxyrunner/app/run.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var (
4646
runTransport string
4747
runName string
4848
runHost string
49-
runPort int
49+
runProxyPort int
5050
runTargetPort int
5151
runPermissionProfile string
5252
runEnv []string
@@ -79,11 +79,8 @@ var (
7979
func init() {
8080
runCmd.Flags().StringVar(&runTransport, "transport", "", "Transport mode (sse, streamable-http or stdio)")
8181
runCmd.Flags().StringVar(&runName, "name", "", "Name of the MCP server (auto-generated from image if not provided)")
82-
runCmd.Flags().IntVar(&runPort, "port", 0, "Port for the HTTP proxy to listen on (host port)")
82+
runCmd.Flags().IntVar(&runProxyPort, "proxy-port", 0, "Port for the HTTP proxy to listen on (host port)")
8383
runCmd.Flags().StringVar(&runHost, "host", transport.LocalhostIPv4, "Host for the HTTP proxy to listen on (IP or hostname)")
84-
if err := runCmd.Flags().MarkDeprecated("port", "use --proxy-port instead"); err != nil {
85-
logger.Warnf("Error marking port flag as deprecated: %v", err)
86-
}
8784
runCmd.Flags().IntVar(&runTargetPort, "target-port", 0,
8885
"Port for the container to expose (only applicable to SSE or Streamable HTTP transport)")
8986
runCmd.Flags().StringVar(
@@ -223,12 +220,6 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
223220

224221
var imageMetadata *registry.ImageMetadata
225222

226-
// Determine effective port value
227-
effectivePort := 0
228-
if runPort != 0 {
229-
effectivePort = runPort
230-
}
231-
232223
// Initialize a new RunConfig with values from command-line flags
233224
runConfig, err := runner.NewRunConfigBuilder().
234225
WithRuntime(rt).
@@ -246,7 +237,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
246237
WithNetworkIsolation(runIsolateNetwork).
247238
WithK8sPodPatch(runK8sPodPatch).
248239
WithProxyMode(types.ProxyMode("sse")).
249-
WithTransportAndPorts(runTransport, effectivePort, runTargetPort).
240+
WithTransportAndPorts(runTransport, runProxyPort, runTargetPort).
250241
WithAuditEnabled(runEnableAudit, runAuditConfig).
251242
WithOIDCConfig(oidcIssuer, oidcAudience, oidcJwksURL, oidcClientID, oidcAllowOpaqueTokens,
252243
runThvCABundle, runJWKSAuthTokenFile, runJWKSAllowPrivateIP).

cmd/thv/app/config.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ var configCmd = &cobra.Command{
1919
Long: "The config command provides subcommands to manage application configuration settings.",
2020
}
2121

22-
var listRegisteredClientsCmd = &cobra.Command{
23-
Use: "list-registered-clients",
24-
Short: "List all registered MCP clients",
25-
Long: "List all clients that are registered for MCP server configuration.",
26-
RunE: listRegisteredClientsCmdFunc,
27-
Deprecated: "please use 'thv client list-registered' instead. This command will be removed in 2 weeks.",
28-
}
29-
3022
var setCACertCmd = &cobra.Command{
3123
Use: "set-ca-cert <path>",
3224
Short: "Set the default CA certificate for container builds",
@@ -79,38 +71,6 @@ var unsetRegistryURLCmd = &cobra.Command{
7971
RunE: unsetRegistryURLCmdFunc,
8072
}
8173

82-
var registerClientCmd = &cobra.Command{
83-
Use: "register-client [client]",
84-
Short: "Register a client for MCP server configuration",
85-
Long: `Register a client for MCP server configuration.
86-
Valid clients are:
87-
- claude-code: Claude Code CLI
88-
- cline: Cline extension for VS Code
89-
- cursor: Cursor editor
90-
- roo-code: Roo Code extension for VS Code
91-
- vscode: Visual Studio Code
92-
- vscode-insider: Visual Studio Code Insiders edition`,
93-
Args: cobra.ExactArgs(1),
94-
RunE: clientRegisterCmdFunc, // delegate to client command
95-
Deprecated: "please use 'thv client register' instead. This command will be removed in 2 weeks.",
96-
}
97-
98-
var removeClientCmd = &cobra.Command{
99-
Use: "remove-client [client]",
100-
Short: "Remove a client from MCP server configuration",
101-
Long: `Remove a client from MCP server configuration.
102-
Valid clients are:
103-
- claude-code: Claude Code CLI
104-
- cline: Cline extension for VS Code
105-
- cursor: Cursor editor
106-
- roo-code: Roo Code extension for VS Code
107-
- vscode: Visual Studio Code
108-
- vscode-insider: Visual Studio Code Insiders edition`,
109-
Args: cobra.ExactArgs(1),
110-
RunE: clientRemoveCmdFunc, // delegate to client command
111-
Deprecated: "please use 'thv client remove' instead. This command will be removed in 2 weeks.",
112-
}
113-
11474
var (
11575
allowPrivateRegistryIp bool
11676
)
@@ -120,7 +80,6 @@ func init() {
12080
rootCmd.AddCommand(configCmd)
12181

12282
// Add subcommands to config command
123-
configCmd.AddCommand(listRegisteredClientsCmd)
12483
configCmd.AddCommand(setCACertCmd)
12584
configCmd.AddCommand(getCACertCmd)
12685
configCmd.AddCommand(unsetCACertCmd)
@@ -134,8 +93,6 @@ func init() {
13493
)
13594
configCmd.AddCommand(getRegistryURLCmd)
13695
configCmd.AddCommand(unsetRegistryURLCmd)
137-
configCmd.AddCommand(registerClientCmd)
138-
configCmd.AddCommand(removeClientCmd)
13996

14097
// Add OTEL parent command to config
14198
configCmd.AddCommand(OtelCmd)

cmd/thv/app/run.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ var (
6161
runProxyMode string
6262
runName string
6363
runHost string
64-
runPort int
6564
runProxyPort int
6665
runTargetPort int
6766
runTargetHost string
@@ -102,10 +101,6 @@ func init() {
102101
runCmd.Flags().StringVar(&runName, "name", "", "Name of the MCP server (auto-generated from image if not provided)")
103102
runCmd.Flags().StringVar(&runHost, "host", transport.LocalhostIPv4, "Host for the HTTP proxy to listen on (IP or hostname)")
104103
runCmd.Flags().IntVar(&runProxyPort, "proxy-port", 0, "Port for the HTTP proxy to listen on (host port)")
105-
runCmd.Flags().IntVar(&runPort, "port", 0, "Port for the HTTP proxy to listen on (host port)")
106-
if err := runCmd.Flags().MarkDeprecated("port", "use --proxy-port instead"); err != nil {
107-
logger.Warnf("Error marking port flag as deprecated: %v", err)
108-
}
109104
runCmd.Flags().IntVar(&runTargetPort, "target-port", 0,
110105
"Port for the container to expose (only applicable to SSE or Streamable HTTP transport)")
111106
runCmd.Flags().StringVar(
@@ -347,12 +342,6 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
347342
}
348343
}
349344

350-
// Determine effective port value - prefer --proxy-port over --port for backwards compatibility
351-
effectivePort := runProxyPort
352-
if effectivePort == 0 && runPort != 0 {
353-
effectivePort = runPort
354-
}
355-
356345
// Initialize a new RunConfig with values from command-line flags
357346
// TODO: As noted elsewhere, we should use the builder pattern here to make it more readable.
358347
runConfig, err := runner.NewRunConfigFromFlags(
@@ -372,7 +361,7 @@ func runCmdFunc(cmd *cobra.Command, args []string) error {
372361
runPermissionProfile,
373362
runTargetHost,
374363
runTransport,
375-
effectivePort,
364+
runProxyPort,
376365
runTargetPort,
377366
runEnv,
378367
runLabels,

pkg/workloads/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (d *defaultManager) RunWorkloadDetached(ctx context.Context, runConfig *run
320320
}
321321

322322
if runConfig.Port != 0 {
323-
detachedArgs = append(detachedArgs, "--port", strconv.Itoa(runConfig.Port))
323+
detachedArgs = append(detachedArgs, "--proxy-port", strconv.Itoa(runConfig.Port))
324324
}
325325

326326
if runConfig.TargetPort != 0 {

0 commit comments

Comments
 (0)