tirth8205/code-review-graph · error · ValueError
unsupported transport: {transport!r}
Error message
unsupported transport: {transport!r} What it means
Raised by main() when the requested MCP transport string is neither 'stdio' nor 'streamable-http'. The f-string echoes the offending value so typos and unsupported transports are immediately visible.
Source
Thrown at code_review_graph/main.py:1256
mcp.run(transport="stdio", show_banner=False)
elif transport == "streamable-http":
if host is None or port is None:
raise ValueError("streamable-http transport requires host and port")
# Validate Host/Origin on the loopback HTTP endpoint. Without it a web
# page the user visits can point a hostname it controls at 127.0.0.1
# (DNS rebinding) and drive the tools, which read the user's code.
# Non-browser MCP clients send no Origin and are unaffected; see
# code_review_graph.http_origin_guard.
from .http_origin_guard import build_http_middleware
mcp.run(
transport="streamable-http",
host=host,
port=port,
middleware=build_http_middleware(host, port),
)
else:
raise ValueError(f"unsupported transport: {transport!r}")
finally:
if watch_store is not None:
watch_store.close()
_incremental._MCP_STDIO_ACTIVE = previous_stdio_state
if __name__ == "__main__":
main()
View on GitHub (pinned to b58668751a)
Solutions
- Use 'stdio' for local clients or exactly 'streamable-http' for HTTP (note the hyphen, not 'streamable_http' or 'sse').
- Check for trailing whitespace/case differences in the transport value.
- If you need SSE/WebSockets, front the streamable-http endpoint with your own proxy instead.
Example fix
# before mcp --transport sse # after mcp --transport streamable-http --host 127.0.0.1 --port 8080
Defensive patterns
Strategy: validation
Validate before calling
VALID_TRANSPORTS = {"stdio", "streamable-http"}
if transport not in VALID_TRANSPORTS:
raise SystemExit(f"transport must be one of {sorted(VALID_TRANSPORTS)}, got {transport!r}") Type guard
def is_supported_transport(value: str) -> bool:
return value in {"stdio", "streamable-http"} Try / catch
try:
main()
except ValueError as exc:
if str(exc).startswith("unsupported transport"):
print(exc); sys.exit(2) Prevention
- Validate the transport string against a constant set before invoking main.
- Normalize casing/whitespace on config-derived values.
- Keep config templates using only documented transport names.
When it happens
Trigger: Passing a transport like 'sse', 'websocket', 'HTTP', or any misspelling to the MCP entrypoint — only exact 'stdio' and 'streamable-http' are accepted.
Common situations: Users coming from FastMCP docs that list 'sse' as a transport; case mismatches like 'Stdio'; config files with an old/renamed transport name after a version change.
Related errors
AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28).
Data as JSON: /api/errors/861d2a36d3b816fb.
Report an issue: GitHub.