Skip to main content
Glama
idoyudha

mcp-keycloak

by idoyudha

create_group

Create a new group in Keycloak with specified name, path, attributes, and target realm for identity and access management.

Instructions

Create a new group.

Args:
    name: Group name
    path: Group path
    attributes: Group attributes
    realm: Target realm (uses default if not specified)

Returns:
    Status message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathNo
attributesNo
realmNo

Implementation Reference

  • Implementation of the create_group tool handler. Decorated with @mcp.tool() which registers it as an MCP tool. Handles creating a new group in Keycloak by posting group data via KeycloakClient.
    @mcp.tool()
    async def create_group(
        name: str,
        path: Optional[str] = None,
        attributes: Optional[Dict[str, List[str]]] = None,
        realm: Optional[str] = None,
    ) -> Dict[str, str]:
        """
        Create a new group.
    
        Args:
            name: Group name
            path: Group path
            attributes: Group attributes
            realm: Target realm (uses default if not specified)
    
        Returns:
            Status message
        """
        group_data = {"name": name}
    
        if path:
            group_data["path"] = path
        if attributes:
            group_data["attributes"] = attributes
    
        await client._make_request("POST", "/groups", data=group_data, realm=realm)
        return {"status": "created", "message": f"Group {name} created successfully"}
  • The @mcp.tool() decorator registers the create_group function as an MCP tool.
    @mcp.tool()

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