{"record":{"id":"4397631742db01c9","repo":"ComposioHQ/composio","slug":"failed-to-list-mcp-servers","errorCode":null,"errorMessage":"Failed to list MCP servers","messagePattern":"Failed to list MCP servers","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"python/composio/core/models/mcp.py","lineNumber":290,"sourceCode":"                toolkits=none_to_omit(toolkits),\n                auth_config_ids=none_to_omit(auth_config_ids),\n                name=none_to_omit(name),\n                order_by=none_to_omit(order_by),\n                order_direction=none_to_omit(order_direction),\n            )\n\n            items = (\n                response.items if hasattr(response, \"items\") and response.items else []\n            )\n\n            return MCPListResponse(\n                items=items,\n                current_page=getattr(response, \"current_page\", page_no or 1),\n                total_pages=getattr(response, \"total_pages\", 1),\n            )\n\n        except Exception as e:\n            raise ValidationError(\"Failed to list MCP servers\") from e\n\n    def get(self, server_id: str):\n        \"\"\"\n        Retrieve detailed information about a specific MCP server/config.\n\n        :param server_id: The unique identifier of the MCP server/config\n        :return: Complete MCP server information\n\n        Example:\n            >>> server = composio.experimental.mcp.get('mcp_12345')\n            >>>\n            >>> print(server['name'])  # \"My Personal MCP Server\"\n            >>> print(server['allowed_tools'])  # [\"GITHUB_CREATE_ISSUE\", \"SLACK_SEND_MESSAGE\"]\n            >>> print(server['toolkits'])  # [\"github\", \"slack\"]\n            >>> print(server['server_instance_count'])  # 3\n        \"\"\"\n        try:\n            response = self._client.mcp.retrieve(server_id)","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/python/composio/core/models/mcp.py#L272-L308","documentation":"Thrown when the Composio backend call to list MCP server configurations fails for any reason (network, auth, API error) while executing MCP.list(). The original exception is chained via `raise ... from e`, so the underlying cause is preserved. It surfaces as a ValidationError even though the root cause is usually not validation-related.","triggerScenarios":"Calling composio.mcp.list() (optionally with page/page_no/limit/toolkits filters) when the API request raises — e.g. invalid API key, network outage, 5xx from backend, or an unexpected response shape that breaks pagination parsing.","commonSituations":"Expired or missing COMPOSIO_API_KEY, stale SDK version against a changed backend response schema, running in an environment without network access to api.composio.dev.","solutions":["Check the chained exception (`except ValidationError as e: print(e.__cause__)`) to see the real API/network error","Verify your API key is set and valid (Composio(api_key=...))","Upgrade the composio package to the latest version in case the response schema changed","Retry with no filters to confirm the base endpoint works"],"exampleFix":"// before\nservers = composio.mcp.list()\n\n# after\ntry:\n    servers = composio.mcp.list()\nexcept ValidationError as e:\n    logger.error(\"list failed: %s\", e.__cause__)\n    raise","handlingStrategy":"try-catch","validationCode":"# none possible client-side beyond auth check\nfrom composio.exceptions import ComposioClientError\nassert composio.api_key, 'API key required'","typeGuard":null,"tryCatchPattern":"try:\n    servers = composio.mcp.list()\nexcept ValidationError as e:\n    logger.error('mcp.list failed: %s', e.__cause__)\n    raise","preventionTips":["Log e.__cause__, not just the message","Keep SDK version current","Verify API key before batch jobs"],"tags":["mcp","python","api-error","list"],"backgroundTag":"api-request-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}