-
Notifications
You must be signed in to change notification settings - Fork 198
thv inspector builds wrong URL for stdio servers proxied as streamable-http #4298
Description
Bug
thv inspector generates an incorrect MCP Inspector URL for servers that use stdio transport but are proxied as streamable-http. The URL uses transport=sse with a /sse path instead of transport=streamable-http with /mcp.
Steps to reproduce
- Run a server that uses stdio transport with streamable-http proxy mode (e.g.,
thv run github) - Run
thv inspector github - Observe the generated URL
Expected
http://localhost:6274?transport=streamable-http&serverUrl=http://host.docker.internal:56677/mcp&MCP_PROXY_AUTH_TOKEN=...
Actual
http://localhost:6274?transport=sse&serverUrl=http://host.docker.internal:56677/sse&MCP_PROXY_AUTH_TOKEN=...
Opening the inspector requires manually changing the protocol from SSE to HTTP and fixing the URL path from /sse to /mcp.
Root cause
getServerPortAndTransport in cmd/thv/app/inspector.go reads c.TransportType (the server's native transport, e.g. stdio) instead of c.ProxyMode (how the proxy actually exposes the server, e.g. streamable-http).
Then the URL-building logic at line 176 treats stdio the same as sse:
if transportType == types.TransportTypeSSE || transportType == types.TransportTypeStdio {
suffix = sseSuffix // "sse"
transportTypeStr = sseSuffix // "sse"
}The fix should use ProxyMode (or the effective proxy mode) to determine the inspector URL transport and path, similar to how pkg/workloads/manager.go:204-209 already uses ProxyMode instead of TransportType for client-facing transport decisions.