{"record":{"id":"b06b16dc813a0040","repo":"huggingface/smolagents","slug":"unsupported-transport-transport-supported-tran-b06b16","errorCode":null,"errorMessage":"Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'.","messagePattern":"Unsupported transport: (.+?)\\. Supported transports are 'streamable-http' and 'sse'\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/tools.py","lineNumber":1049,"sourceCode":"                FutureWarning,\n                stacklevel=2,\n            )\n            structured_output = False\n\n        try:\n            from mcpadapt.core import MCPAdapt\n            from mcpadapt.smolagents_adapter import SmolAgentsAdapter\n        except ImportError:\n            raise ImportError(\n                \"\"\"Please install 'mcp' extra to use ToolCollection.from_mcp: `pip install 'smolagents[mcp]'`.\"\"\"\n            )\n        if isinstance(server_parameters, dict):\n            transport = server_parameters.get(\"transport\")\n            if transport is None:\n                transport = \"streamable-http\"\n                server_parameters[\"transport\"] = transport\n            if transport not in {\"sse\", \"streamable-http\"}:\n                raise ValueError(\n                    f\"Unsupported transport: {transport}. Supported transports are 'streamable-http' and 'sse'.\"\n                )\n        if not trust_remote_code:\n            raise ValueError(\n                \"Loading tools from MCP requires you to acknowledge you trust the MCP server, \"\n                \"as it will execute code on your local machine: pass `trust_remote_code=True`.\"\n            )\n        with MCPAdapt(server_parameters, SmolAgentsAdapter(structured_output=structured_output)) as tools:\n            yield cls(tools)\n\n\ndef tool(tool_function: Callable) -> Tool:\n    \"\"\"\n    Convert a function into an instance of a dynamically created Tool subclass.\n\n    Args:\n        tool_function (`Callable`): Function to convert into a Tool subclass.\n            Should have type hints for each input and a type hint for the output.","sourceCodeStart":1031,"sourceCodeEnd":1067,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/tools.py#L1031-L1067","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set transport to 'streamable-http' for HTTP MCP servers or 'sse' for server-sent-events servers (lowercase)","Omit the 'transport' key entirely to use the streamable-http default","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'"],"exampleFix":"# before\nToolCollection.from_mcp({\"transport\": \"stdio\", \"command\": \"uvx\", \"args\": [\"some-mcp-server\"]}, trust_remote_code=True)\n# after\nToolCollection.from_mcp({\"url\": \"http://localhost:8000/mcp\", \"transport\": \"streamable-http\"}, trust_remote_code=True)","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"sse\", \"streamable-http\"}\ntransport = server_parameters.get(\"transport\", \"streamable-http\")\nassert transport in SUPPORTED, f\"use one of {SUPPORTED}\"\nserver_parameters[\"transport\"] = transport\ntools = ToolCollection.from_mcp(server_parameters, trust_remote_code=True)","typeGuard":"def is_valid_transport(t: str) -> bool:\n    return isinstance(t, str) and t in {\"sse\", \"streamable-http\"}","tryCatchPattern":"try:\n    ToolCollection.from_mcp(params, trust_remote_code=True)\nexcept ValueError as e:\n    if \"Unsupported transport\" in str(e):\n        params[\"transport\"] = \"streamable-http\"  # fallback to default\n        ToolCollection.from_mcp(params, trust_remote_code=True)\n    else:\n        raise","preventionTips":["Normalize transport strings to lowercase before passing","Omit 'transport' to accept the streamable-http default","Don't reuse stdio configs from other MCP clients"],"tags":["mcp","transport","validation","valueerror"],"backgroundTag":"unsupported-transport","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}