Skip to main content
Glama
Octodet

Advanced Keycloak MCP server

by Octodet

reset-user-password

Reset or set a new password for a user in a specific realm on the Advanced Keycloak MCP server. Specify the realm, user ID, new password, and optional temporary flag.

Instructions

Reset or set a new password for a user in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
passwordYesNew password
realmYesRealm name
temporaryNoWhether the password is temporary
userIdYesUser ID

Implementation Reference

  • MCP tool handler that validates arguments using Zod schema, invokes the Keycloak service method, and formats a success response.
    case "reset-user-password": { const params = ResetUserPasswordSchema.parse(args); await keycloakService.resetUserPassword(params); return { content: [ { type: "text", text: `Password ${params.temporary ? "temporarily " : ""}reset successfully for user ${params.userId} in realm ${params.realm}${ params.temporary ? ". User will be required to change password on next login." : "." }`, }, ], }; }
  • Core helper method in KeycloakService that handles authentication and executes the Keycloak admin client API call to reset the user's password.
    async resetUserPassword(params: { realm: string; userId: string; password: string; temporary?: boolean; }) { await this.authenticate(); this.client.setConfig({ realmName: params.realm }); await this.client.users.resetPassword({ id: params.userId, realm: params.realm, credential: { type: "password", value: params.password, temporary: params.temporary || false, }, }); } }
  • Zod schema used for runtime validation of input parameters in the tool handler.
    const ResetUserPasswordSchema = z.object({ realm: z.string(), userId: z.string(), password: z.string(), temporary: z.boolean().default(false), });
  • src/index.ts:424-437 (registration)
    Tool registration in the listTools response, defining name, description, and JSON schema for inputs.
    { name: "reset-user-password", description: "Reset or set a new password for a user in a specific realm", inputSchema: { type: "object", properties: { realm: { type: "string", description: "Realm name" }, userId: { type: "string", description: "User ID" }, password: { type: "string", description: "New password" }, temporary: { type: "boolean", description: "Whether the password is temporary", default: false }, }, required: ["realm", "userId", "password"], }, },

Other Tools

Related 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/Octodet/keycloak-mcp'

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