huggingface/smolagents · error · ValueError

Unsupported transport: {transport}. Supported transports are

Error message

Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'.

What it means

ToolCollection.from_mcp only supports the 'streamable-http' and 'sse' MCP transports. When server_parameters is a dict, its 'transport' key is validated against that set; anything else (e.g. 'stdio', 'ws', or a typo like 'SSE') raises this ValueError.

Source

Thrown at src/smolagents/tools.py:1049

                FutureWarning,
                stacklevel=2,
            )
            structured_output = False

        try:
            from mcpadapt.core import MCPAdapt
            from mcpadapt.smolagents_adapter import SmolAgentsAdapter
        except ImportError:
            raise ImportError(
                """Please install 'mcp' extra to use ToolCollection.from_mcp: `pip install 'smolagents[mcp]'`."""
            )
        if isinstance(server_parameters, dict):
            transport = server_parameters.get("transport")
            if transport is None:
                transport = "streamable-http"
                server_parameters["transport"] = transport
            if transport not in {"sse", "streamable-http"}:
                raise ValueError(
                    f"Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'."
                )
        if not trust_remote_code:
            raise ValueError(
                "Loading tools from MCP requires you to acknowledge you trust the MCP server, "
                "as it will execute code on your local machine: pass `trust_remote_code=True`."
            )
        with MCPAdapt(server_parameters, SmolAgentsAdapter(structured_output=structured_output)) as tools:
            yield cls(tools)


def tool(tool_function: Callable) -> Tool:
    """
    Convert a function into an instance of a dynamically created Tool subclass.

    Args:
        tool_function (`Callable`): Function to convert into a Tool subclass.
            Should have type hints for each input and a type hint for the output.

View on GitHub (pinned to 30bb116109)

Solutions

  1. Set transport to 'streamable-http' for HTTP MCP servers or 'sse' for server-sent-events servers (lowercase)
  2. Omit the 'transport' key entirely to use the streamable-http default
  3. For stdio servers, either use the modern streamable-http endpoint or pass parameters in the format mcpadapt expects for stdio rather than a dict with transport='stdio'

Example fix

# before
ToolCollection.from_mcp({"transport": "stdio", "command": "uvx", "args": ["some-mcp-server"]}, trust_remote_code=True)
# after
ToolCollection.from_mcp({"url": "http://localhost:8000/mcp", "transport": "streamable-http"}, trust_remote_code=True)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"sse", "streamable-http"}
transport = server_parameters.get("transport", "streamable-http")
assert transport in SUPPORTED, f"use one of {SUPPORTED}"
server_parameters["transport"] = transport
tools = ToolCollection.from_mcp(server_parameters, trust_remote_code=True)

Type guard

def is_valid_transport(t: str) -> bool:
    return isinstance(t, str) and t in {"sse", "streamable-http"}

Try / catch

try:
    ToolCollection.from_mcp(params, trust_remote_code=True)
except ValueError as e:
    if "Unsupported transport" in str(e):
        params["transport"] = "streamable-http"  # fallback to default
        ToolCollection.from_mcp(params, trust_remote_code=True)
    else:
        raise

Prevention

When it happens

Trigger: Passing a dict with `transport` set to an unsupported value, e.g. `{"transport": "stdio", "command": "npx"}` or a capitalized/mistyped transport string. Note: defaults to 'streamable-http' when omitted.

Common situations: Migrating stdio-based MCP examples to smolagents (stdio isn't supported here); typos or case sensitivity ('SSE' vs 'sse'); copying server config from another client that accepts more transports.

Related errors


AI-assisted analysis of huggingface/smolagents@30bb116109 (2026-08-28). Data as JSON: /api/errors/b06b16dc813a0040. Report an issue: GitHub.