{"record":{"id":"92fbfba5a5c92670","repo":"ComposioHQ/composio","slug":"failed-to-parse-mcp-server-instance","errorCode":null,"errorMessage":"Failed to parse MCP server instance","messagePattern":"Failed to parse MCP server instance","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"python/composio/core/models/mcp.py","lineNumber":500,"sourceCode":"                raise ValidationError(\"No server URL generated\")\n\n            # Create structured server instance (matching TS MCPServerInstance)\n            server_instance: MCPServerInstance = {\n                \"id\": server_details.id,\n                \"name\": server_details.name,\n                \"type\": \"streamable_http\",\n                \"url\": server_url,\n                \"user_id\": user_id,\n                \"allowed_tools\": getattr(server_details, \"allowed_tools\", []),\n                \"auth_configs\": getattr(server_details, \"auth_config_ids\", []),\n            }\n\n            return server_instance\n\n        except Exception as e:\n            if isinstance(e, ValidationError):\n                raise\n            raise ValidationError(\"Failed to parse MCP server instance\") from e\n","sourceCodeStart":482,"sourceCodeEnd":501,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/core/models/mcp.py#L482-L501","documentation":"A catch-all wrapper around the whole MCP.generate() body: any exception that is not already a ValidationError (e.g. AttributeError while building the MCPServerInstance dict, KeyError on server_details fields, JSON issues) is re-raised as 'Failed to parse MCP server instance'. Pre-existing ValidationErrors pass through untouched.","triggerScenarios":"The generate flow succeeds at HTTP level but the response object is missing expected attributes (server_details.id, server_details.name) or the URL parsing step raises — usually generated-client/backend schema drift.","commonSituations":"Old composio version against a new backend, or vice versa; backend returning an error object where a server config was expected.","solutions":["Inspect e.__cause__ to see the exact AttributeError/KeyError and which field was missing","Upgrade (or pin) composio to the version whose generated client matches the backend","Retry once to rule out transient partial responses"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    inst = composio.mcp.create(...)\nexcept ValidationError as e:\n    logger.error('parse failed: %r', e.__cause__)\n    raise","preventionTips":["Pin composio version matched to backend","Report schema drift with e.__cause__ details"],"tags":["mcp","python","response-parsing","schema-drift"],"backgroundTag":"response-schema-mismatch","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}