Skip to main content
Glama

create_user

Add a new user to Keycloak with specified details like username, email, first and last names, and temporary password. Configure user status, email verification, attributes, and target realm.

Instructions

Create a new user. Args: username: Username for the new user email: Email address first_name: First name last_name: Last name enabled: Whether the user is enabled email_verified: Whether the email is verified temporary_password: Initial password (user will be required to change it) attributes: Additional user attributes realm: Target realm (uses default if not specified) Returns: Dict with status and location of created user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
attributesNo
emailNo
email_verifiedNo
enabledNo
first_nameNo
last_nameNo
realmNo
temporary_passwordNo
usernameYes

Implementation Reference

  • The handler function for the 'create_user' MCP tool. Decorated with @mcp.tool() for automatic registration and schema inference from type hints and docstring. Creates a new Keycloak user via POST to /users endpoint.
    @mcp.tool() async def create_user( username: str, email: Optional[str] = None, first_name: Optional[str] = None, last_name: Optional[str] = None, enabled: bool = True, email_verified: bool = False, temporary_password: Optional[str] = None, attributes: Optional[Dict[str, List[str]]] = None, realm: Optional[str] = None, ) -> Dict[str, str]: """ Create a new user. Args: username: Username for the new user email: Email address first_name: First name last_name: Last name enabled: Whether the user is enabled email_verified: Whether the email is verified temporary_password: Initial password (user will be required to change it) attributes: Additional user attributes realm: Target realm (uses default if not specified) Returns: Dict with status and location of created user """ user_data = { "username": username, "enabled": enabled, "emailVerified": email_verified, } if email: user_data["email"] = email if first_name: user_data["firstName"] = first_name if last_name: user_data["lastName"] = last_name if attributes: user_data["attributes"] = attributes if temporary_password: user_data["credentials"] = [ {"type": "password", "value": temporary_password, "temporary": True} ] # Create user returns no content, but includes Location header await client._make_request("POST", "/users", data=user_data, realm=realm) return {"status": "created", "message": f"User {username} created successfully"}

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