Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

list_clients

Retrieve and filter client applications from a Keycloak realm to manage access control and permissions.

Instructions

List clients in the realm.

Args:
    client_id: Filter by client ID (partial match)
    viewable_only: Only return viewable clients
    first: Pagination offset
    max: Maximum results size
    realm: Target realm (uses default if not specified)

Returns:
    List of client objects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idNo
viewable_onlyNo
firstNo
maxNo
realmNo

Implementation Reference

  • The handler function for the 'list_clients' MCP tool. It is decorated with @mcp.tool() for registration and implements the logic to list Keycloak clients with optional filtering, pagination, and realm specification using the KeycloakClient instance.
    @mcp.tool()
    async def list_clients(
        client_id: Optional[str] = None,
        viewable_only: bool = False,
        first: Optional[int] = None,
        max: Optional[int] = None,
        realm: Optional[str] = None,
    ) -> List[Dict[str, Any]]:
        """
        List clients in the realm.
    
        Args:
            client_id: Filter by client ID (partial match)
            viewable_only: Only return viewable clients
            first: Pagination offset
            max: Maximum results size
            realm: Target realm (uses default if not specified)
    
        Returns:
            List of client objects
        """
        params = {}
        if client_id:
            params["clientId"] = client_id
        if viewable_only:
            params["viewableOnly"] = "true"
        if first is not None:
            params["first"] = first
        if max is not None:
            params["max"] = max
    
        return await client._make_request("GET", "/clients", params=params, realm=realm)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/idoyudha/mcp-keycloak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server