Skip to content

Commit 08735de

Browse files
authored
Deprecate SSE proxy mode for stdio transport (#3008)
Add deprecation notices for the SSE proxy mode which will be removed in a future release. Users should migrate to streamable-http (now the default). Changes: - Add runtime warning when --proxy-mode sse is explicitly used - Update help text to indicate SSE is deprecated - Add Deprecated comment to ProxyModeSSE constant - Update CLI, CRD, and API documentation - Extract sseSuffix constant in inspector.go to satisfy linter Signed-off-by: carlos <[email protected]>
1 parent 0e53214 commit 08735de

File tree

9 files changed

+24
-7
lines changed

9 files changed

+24
-7
lines changed

cmd/thv/app/inspector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222
"github.com/stacklok/toolhive/pkg/workloads"
2323
)
2424

25+
const sseSuffix = "sse"
26+
2527
var (
2628
inspectorUIPort int
2729
inspectorMCPProxyPort int
@@ -163,8 +165,8 @@ func inspectorCmdFunc(cmd *cobra.Command, args []string) error {
163165
var suffix string
164166
var transportTypeStr string
165167
if transportType == types.TransportTypeSSE || transportType == types.TransportTypeStdio {
166-
suffix = "sse"
167-
transportTypeStr = "sse"
168+
suffix = sseSuffix
169+
transportTypeStr = sseSuffix
168170
} else {
169171
suffix = "mcp"
170172
transportTypeStr = "streamable-http"

cmd/thv/app/run.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,5 +496,12 @@ func validateRunFlags(cmd *cobra.Command, args []string) error {
496496
}
497497
}
498498

499+
// Show deprecation warning if --proxy-mode is explicitly set to SSE
500+
proxyModeFlag := cmd.Flags().Lookup("proxy-mode")
501+
if proxyModeFlag != nil && proxyModeFlag.Changed && proxyModeFlag.Value.String() == "sse" {
502+
logger.Warn("The 'sse' proxy mode is deprecated and will be removed in a future release. " +
503+
"Please migrate to 'streamable-http' (the new default).")
504+
}
505+
499506
return nil
500507
}

cmd/thv/app/run_flags.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ type RunFlags struct {
123123
// AddRunFlags adds all the run flags to a command
124124
func AddRunFlags(cmd *cobra.Command, config *RunFlags) {
125125
cmd.Flags().StringVar(&config.Transport, "transport", "", "Transport mode (sse, streamable-http or stdio)")
126-
cmd.Flags().StringVar(&config.ProxyMode, "proxy-mode", "streamable-http", "Proxy mode for stdio (streamable-http or sse)")
126+
cmd.Flags().StringVar(&config.ProxyMode,
127+
"proxy-mode",
128+
"streamable-http",
129+
"Proxy mode for stdio (streamable-http or sse (deprecated, will be removed))")
127130
cmd.Flags().StringVar(&config.Name, "name", "", "Name of the MCP server (auto-generated from image if not provided)")
128131
cmd.Flags().StringVar(&config.Group, "group", "default",
129132
"Name of the group this workload belongs to (defaults to 'default' if not specified)")

docs/cli/thv_run.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/server/docs.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/server/swagger.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/server/swagger.yaml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/runner/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ type RunConfig struct {
140140
TrustProxyHeaders bool `json:"trust_proxy_headers,omitempty" yaml:"trust_proxy_headers,omitempty"`
141141

142142
// ProxyMode is the proxy mode for stdio transport ("sse" or "streamable-http")
143+
// Note: "sse" is deprecated; use "streamable-http" instead.
143144
ProxyMode types.ProxyMode `json:"proxy_mode,omitempty" yaml:"proxy_mode,omitempty"`
144145

145146
// ThvCABundle is the path to the CA certificate bundle for ToolHive HTTP operations

pkg/transport/types/transport.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ type ProxyMode string
211211

212212
const (
213213
// ProxyModeSSE is the proxy mode for SSE.
214+
// Deprecated: SSE proxy mode is deprecated and will be removed in a future release.
215+
// Use ProxyModeStreamableHTTP instead.
214216
ProxyModeSSE ProxyMode = "sse"
215217
// ProxyModeStreamableHTTP is the proxy mode for streamable HTTP.
216218
ProxyModeStreamableHTTP ProxyMode = "streamable-http"

0 commit comments

Comments
 (0)