Skip to content

thv inspector builds wrong URL for stdio servers proxied as streamable-http #4298

@danbarr

Description

@danbarr

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

  1. Run a server that uses stdio transport with streamable-http proxy mode (e.g., thv run github)
  2. Run thv inspector github
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions