Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

get_client_by_clientid

Retrieve a specific client configuration from Keycloak identity management using its unique client ID. Specify the realm to access client details for authentication and authorization setup.

Instructions

Get a specific client by client ID.

Args:
    client_id: The client's client_id
    realm: Target realm (uses default if not specified)

Returns:
    Client object

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
realmNo

Implementation Reference

  • The handler function implementing the get_client_by_clientid tool. It is decorated with @mcp.tool() which registers it. Queries Keycloak /clients endpoint filtered by clientId, iterates to find exact match, returns the client dict or raises Exception.
    @mcp.tool()
    async def get_client_by_clientid(
        client_id: str, realm: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Get a specific client by client ID.
    
        Args:
            client_id: The client's client_id
            realm: Target realm (uses default if not specified)
    
        Returns:
            Client object
        """
        clients = await client._make_request(
            "GET", "/clients", params={"clientId": client_id}, realm=realm
        )
        if clients and len(clients) > 0:
            # Find exact match
            for c in clients:
                if c.get("clientId") == client_id:
                    return c
        raise Exception(f"Client with client_id '{client_id}' not found")

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