microsoft/autogen · error · ValueError
Unsupported server params type: {type(server_params)}
Error message
Unsupported server params type: {type(server_params)} What it means
The MCP tool factory builds adapters by isinstance-dispatch on the server params: StdioServerParams, SseServerParams, or StreamableHttpServerParams. Any other type — including duck-typed lookalikes, protocol re-exports from different package versions, or None — falls through to ValueError(f'Unsupported server params type: {type(server_params)}').
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/tools/mcp/_factory.py:214
"""
if session is None:
async with create_mcp_server_session(server_params) as temp_session:
await temp_session.initialize()
tools = await temp_session.list_tools()
else:
tools = await session.list_tools()
if isinstance(server_params, StdioServerParams):
return [StdioMcpToolAdapter(server_params=server_params, tool=tool, session=session) for tool in tools.tools]
elif isinstance(server_params, SseServerParams):
return [SseMcpToolAdapter(server_params=server_params, tool=tool, session=session) for tool in tools.tools]
elif isinstance(server_params, StreamableHttpServerParams):
return [
StreamableHttpMcpToolAdapter(server_params=server_params, tool=tool, session=session)
for tool in tools.tools
]
raise ValueError(f"Unsupported server params type: {type(server_params)}")
View on GitHub (pinned to 027ecf0a37)
Solutions
- Construct params using the classes autogen-ext itself re-exports (e.g. from autogen_ext.tools.mcp import StdioServerParams).
- Print type(server_params) and its module path; if it is not from the expected mcp package, fix the import to use the same distribution autogen-ext depends on.
- Resolve dependency conflicts: pip check / uv pip list, ensure a single mcp version, reinstall autogen-ext[mcp].
- Do not pass None or raw dicts — build one of the three supported param objects.
Example fix
# before from some_old_sdk import StdioServerParams # different class identity params = StdioServerParams(command="npx", args=["-y", "server"]) tools = await make_tools(params) # ValueError: Unsupported server params type # after from autogen_ext.tools.mcp import StdioServerParams params = StdioServerParams(command="npx", args=["-y", "@modelcontextprotocol/server"]) tools = await make_tools(params)
Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_ext.tools.mcp import StdioServerParams, SseServerParams, StreamableHttpServerParams
if not isinstance(server_params, (StdioServerParams, SseServerParams, StreamableHttpServerParams)):
raise TypeError(f"unsupported params {type(server_params)!r}; use autogen_ext.tools.mcp param classes") Type guard
from autogen_ext.tools.mcp import StdioServerParams, SseServerParams, StreamableHttpServerParams
from typing import Any, TypeGuard, Union
SupportedParams = Union[StdioServerParams, SseServerParams, StreamableHttpServerParams]
def is_supported_server_params(p: Any) -> TypeGuard[SupportedParams]:
return isinstance(p, (StdioServerParams, SseServerParams, StreamableHttpServerParams)) Try / catch
try:
tools = await make_tools(server_params)
except ValueError as e:
if "Unsupported server params type" in str(e):
raise TypeError("Import param classes from autogen_ext.tools.mcp") from e
raise Prevention
- Import server param classes only from autogen_ext.tools.mcp, never from a secondary mcp install.
- Run `pip check` / dedupe the mcp distribution in CI to prevent class-identity splits.
- Pin autogen-ext and mcp versions together in the lockfile.
When it happens
Trigger: Passing an object that is not one of the three supported param classes: a mcp-types class imported from a different (incompatible) mcp package version so isinstance fails; a custom dataclass mimicking the shape; forgetting to construct params and passing the class itself or None.
Common situations: Two copies of the mcp package installed (plugin vs app) so the class identities differ; upgrading mcp to a version whose StdioServerParams moved modules while autogen-ext pins the old one; passing SseParams from a vendored SDK.
Related errors
- Failed to list MCP tools
- Failed to call MCP tool
- MCP health check failed
- HTTP ${response.status}: ${errorText || "Failed to create We
- Invalid JSON response from server. Check if the MCP route is
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/e0300b33a59ae481.
Report an issue: GitHub.