{"record":{"id":"af70488240b880e6","repo":"iflytek/astron-agent","slug":"no-mcp-transport-candidates-were-available","errorCode":null,"errorMessage":"No MCP transport candidates were available","messagePattern":"No MCP transport candidates were available","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"core/plugin/link/service/community/tools/mcp/mcp_transport.py","lineNumber":161,"sourceCode":"                yield session, candidate\n                return\n        except Exception as error:\n            if initialized:\n                raise\n            if transport is not MCPTransport.AUTO:\n                raise MCPTransportError(phase, candidate, error) from error\n\n            reason = _fallback_reason(error, response_status)\n            if candidate is not MCPTransport.STREAMABLE_HTTP or reason is None:\n                raise MCPTransportError(phase, candidate, error) from error\n\n            logger.warning(\n                \"MCP Streamable HTTP initialization failed; falling back to legacy \"\n                \"SSE (reason={})\",\n                reason,\n            )\n\n    raise RuntimeError(\"No MCP transport candidates were available\")\n","sourceCodeStart":143,"sourceCodeEnd":162,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/link/service/community/tools/mcp/mcp_transport.py#L143-L162","documentation":"RuntimeError raised by initialized_mcp_session after every MCP transport candidate fails. The code first tries Streamable HTTP, falls back to legacy SSE, and if both initialization attempts raise (connection refused, timeout, HTTP errors, protocol errors), it gives up with this error.","triggerScenarios":"_connect_and_get_tools or _call_mcp_tool call initialized_mcp_session for an MCP server whose endpoint is unreachable, returns non-2xx, is not actually an MCP server, or rejects the initialize handshake over both Streamable HTTP and SSE.","commonSituations":"MCP server not running or wrong port/URL configured; server deployed behind a proxy stripping SSE headers; server only supports stdio transport while the client tries HTTP; network policy/firewall blocking the endpoint; server version too old for either transport.","solutions":["Verify the MCP server URL is correct and the server is running: curl the endpoint to confirm it responds.","Confirm the server supports Streamable HTTP or SSE transport (not stdio-only); switch transport type in tool config if needed.","Check logs just above the error — the 'reason' in the fallback warning names the underlying failure (connection refused/timeout/HTTP status).","Check network/firewall/proxy settings between the plugin and the MCP server; retry after the server is reachable."],"exampleFix":"// before\nmcp_url = \"http://localhost:9999\"  # server not started\nsession = await initialized_mcp_session(mcp_url)\n// after\n# start the MCP server first and verify:\n#   curl -i http://localhost:9999/mcp\nmcp_url = \"http://localhost:9999/mcp\"\nsession = await initialized_mcp_session(mcp_url)","handlingStrategy":"retry","validationCode":"import httpx\ndef mcp_endpoint_reachable(url: str) -> bool:\n    try:\n        return httpx.get(url, timeout=5).status_code < 500\n    except httpx.HTTPError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    session = await initialized_mcp_session(url)\nexcept RuntimeError as e:\n    logger.error(\"MCP session failed for %s: %s\", url, e)\n    return ToolResult(error=\"MCP server unreachable; check URL/transport\")","preventionTips":["Health-check the MCP server endpoint before connecting","Confirm server supports Streamable HTTP or SSE (not stdio-only)","Keep MCP server and client SDK versions compatible","Check proxy/firewall rules for SSE/streaming endpoints"],"tags":["mcp","transport","network","connection"],"backgroundTag":"connection-refused","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}