ComposioHQ/composio · error · ValidationError

Failed to retrieve MCP server {server_id}

Error message

Failed to retrieve MCP server {server_id}

What it means

Raised when retrieving a single MCP server/config by ID via MCP.get(server_id) fails — the client.mcp.retrieve call threw (bad ID, auth, network, or 4xx/5xx from the backend). The server_id is included in the message to identify which lookup failed; the original exception is chained.

Source

Thrown at python/composio/core/models/mcp.py:313

        :param server_id: The unique identifier of the MCP server/config
        :return: Complete MCP server information

        Example:
            >>> server = composio.experimental.mcp.get('mcp_12345')
            >>>
            >>> print(server['name'])  # "My Personal MCP Server"
            >>> print(server['allowed_tools'])  # ["GITHUB_CREATE_ISSUE", "SLACK_SEND_MESSAGE"]
            >>> print(server['toolkits'])  # ["github", "slack"]
            >>> print(server['server_instance_count'])  # 3
        """
        try:
            response = self._client.mcp.retrieve(server_id)

            return response

        except Exception as e:
            raise ValidationError(f"Failed to retrieve MCP server {server_id}") from e

    def update(
        self,
        server_id: str,
        name: t.Optional[str] = None,
        toolkits: t.Optional[t.List[t.Union[ConfigToolkit, str]]] = None,
        manually_manage_connections: t.Optional[bool] = None,
        allowed_tools: t.Optional[t.List[str]] = None,
    ):
        """
        Update an existing MCP server configuration.

        :param server_id: The unique identifier of the MCP server to update
        :param name: Optional new name for the MCP server
        :param toolkits: Optional list of toolkit configurations (strings or objects)
        :param manually_manage_connections: Optional flag for connection management
        :param allowed_tools: Optional list of specific tools to enable across all toolkits
        :return: Updated MCP server information

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Verify server_id exists by listing: [s.id for s in composio.mcp.list()]
  2. Inspect e.__cause__ for the underlying HTTP status (404 vs 401 vs network)
  3. Confirm the API key belongs to the same workspace where the server was created
Defensive patterns

Strategy: try-catch

Validate before calling

ids = {s.id for s in composio.mcp.list()}
if server_id not in ids:
    raise ValueError(f'unknown MCP server {server_id}')

Try / catch

try:
    cfg = composio.mcp.get(server_id)
except ValidationError as e:
    if getattr(e.__cause__, 'status_code', None) == 404:
        return None
    raise

Prevention

When it happens

Trigger: Calling composio.mcp.get(server_id) with a nonexistent, deleted, or malformed server_id; or when the request itself fails due to auth/network issues.

Common situations: Using a server_id copied from another workspace/environment, using an ID after the config was deleted, expired API key.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/bb5cf976bc98bcb0. Report an issue: GitHub.