Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

create_client

Create a new client in Keycloak identity management by configuring authentication protocols, access flows, and security settings for applications.

Instructions

Create a new client.

Args:
    client_id: Client ID (unique identifier)
    name: Display name
    description: Client description
    enabled: Whether the client is enabled
    always_display_in_console: Always display in account console
    root_url: Root URL for relative URLs
    redirect_uris: Valid redirect URIs
    web_origins: Allowed CORS origins
    protocol: Protocol (openid-connect or saml)
    public_client: Public client (no secret)
    bearer_only: Bearer-only client
    service_accounts_enabled: Enable service accounts
    authorization_services_enabled: Enable authorization services
    direct_access_grants_enabled: Enable direct access grants (password flow)
    implicit_flow_enabled: Enable implicit flow
    standard_flow_enabled: Enable standard flow (authorization code)
    realm: Target realm (uses default if not specified)

Returns:
    Status message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idYes
nameNo
descriptionNo
enabledNo
always_display_in_consoleNo
root_urlNo
redirect_urisNo
web_originsNo
protocolNoopenid-connect
public_clientNo
bearer_onlyNo
service_accounts_enabledNo
authorization_services_enabledNo
direct_access_grants_enabledNo
implicit_flow_enabledNo
standard_flow_enabledNo
realmNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'create_client' tool handler: an async function decorated with @mcp.tool() that creates a new Keycloak client using the KeycloakClient helper. The function parameters and docstring define the input schema. It constructs client data from arguments and posts it to the Keycloak API.
    @mcp.tool()
    async def create_client(
        client_id: str,
        name: Optional[str] = None,
        description: Optional[str] = None,
        enabled: bool = True,
        always_display_in_console: bool = False,
        root_url: Optional[str] = None,
        redirect_uris: Optional[List[str]] = None,
        web_origins: Optional[List[str]] = None,
        protocol: str = "openid-connect",
        public_client: bool = False,
        bearer_only: bool = False,
        service_accounts_enabled: bool = False,
        authorization_services_enabled: bool = False,
        direct_access_grants_enabled: bool = False,
        implicit_flow_enabled: bool = False,
        standard_flow_enabled: bool = True,
        realm: Optional[str] = None,
    ) -> Dict[str, str]:
        """
        Create a new client.
    
        Args:
            client_id: Client ID (unique identifier)
            name: Display name
            description: Client description
            enabled: Whether the client is enabled
            always_display_in_console: Always display in account console
            root_url: Root URL for relative URLs
            redirect_uris: Valid redirect URIs
            web_origins: Allowed CORS origins
            protocol: Protocol (openid-connect or saml)
            public_client: Public client (no secret)
            bearer_only: Bearer-only client
            service_accounts_enabled: Enable service accounts
            authorization_services_enabled: Enable authorization services
            direct_access_grants_enabled: Enable direct access grants (password flow)
            implicit_flow_enabled: Enable implicit flow
            standard_flow_enabled: Enable standard flow (authorization code)
            realm: Target realm (uses default if not specified)
    
        Returns:
            Status message
        """
        client_data = {
            "clientId": client_id,
            "enabled": enabled,
            "alwaysDisplayInConsole": always_display_in_console,
            "protocol": protocol,
            "publicClient": public_client,
            "bearerOnly": bearer_only,
            "serviceAccountsEnabled": service_accounts_enabled,
            "authorizationServicesEnabled": authorization_services_enabled,
            "directAccessGrantsEnabled": direct_access_grants_enabled,
            "implicitFlowEnabled": implicit_flow_enabled,
            "standardFlowEnabled": standard_flow_enabled,
        }
    
        if name:
            client_data["name"] = name
        if description:
            client_data["description"] = description
        if root_url:
            client_data["rootUrl"] = root_url
        if redirect_uris:
            client_data["redirectUris"] = redirect_uris
        if web_origins:
            client_data["webOrigins"] = web_origins
    
        await client._make_request("POST", "/clients", data=client_data, realm=realm)
        return {"status": "created", "message": f"Client {client_id} created successfully"}
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Create' implies a write/mutation operation, the description doesn't disclose important behavioral aspects: whether this requires admin permissions, what happens if a client with the same ID exists, whether the operation is idempotent, or any rate limits. The mention of 'Returns: Status message' is minimal behavioral information.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately structured with clear sections (Args, Returns) but is quite lengthy due to documenting all 17 parameters. While each parameter explanation is concise, the overall description could be more front-loaded with critical usage information before the parameter list. The structure is functional but not optimally organized for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex mutation tool with 17 parameters and no annotations, the description provides excellent parameter documentation but lacks important contextual information. There's no output schema provided (only 'Status message' mentioned), no guidance on error conditions, no information about required permissions or system constraints, and no differentiation from sibling tools. The parameter coverage is strong, but other critical aspects are missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description provides extensive parameter documentation with clear explanations for all 17 parameters, far exceeding what the input schema provides (which has 0% description coverage). Each parameter gets a concise explanation that adds meaningful context beyond just the parameter names, such as explaining what 'bearer_only' means or what the protocol options are.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Create') and resource ('a new client'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'update_client' or explain what distinguishes client creation from other entity creations in the system.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'update_client' or 'get_client'. There's no mention of prerequisites, required permissions, or typical use cases for client creation versus other operations in the sibling tool list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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