Skip to main content
Glama
Octodet

Advanced Keycloak MCP server

by Octodet

delete-user

Remove a user from a Keycloak realm by specifying the realm name and user ID to manage access control.

Instructions

Delete a user from a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYesRealm name
userIdYesUser ID to delete

Implementation Reference

  • Handler for 'delete-user' tool: parses arguments, calls KeycloakService.deleteUser, returns success message.
    case "delete-user": { const { realm, userId } = DeleteUserSchema.parse(args); await keycloakService.deleteUser(realm, userId); return { content: [ { type: "text", text: `User ${userId} deleted successfully from realm ${realm}`, }, ], }; }
  • Zod schema for validating input arguments of 'delete-user' tool.
    const DeleteUserSchema = z.object({ realm: z.string(), userId: z.string(), });
  • src/index.ts:366-376 (registration)
    Tool registration in listTools response, defining name, description, and input schema.
    name: "delete-user", description: "Delete a user from a specific realm", inputSchema: { type: "object", properties: { realm: { type: "string", description: "Realm name" }, userId: { type: "string", description: "User ID to delete" }, }, required: ["realm", "userId"], }, },
  • KeycloakService method implementing the actual user deletion logic via Keycloak Admin Client.
    async deleteUser(realm: string, userId: string) { await this.authenticate(); this.client.setConfig({ realmName: realm }); await this.client.users.del({ id: userId, realm, }); }

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