Skip to main content
Glama
Octodet

Advanced Keycloak MCP server

by Octodet

delete-user

Remove a user from a specified realm in the Keycloak MCP server by providing the realm name and user ID for precise deletion.

Instructions

Delete a user from a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYesRealm name
userIdYesUser ID to delete

Implementation Reference

  • MCP tool handler for 'delete-user': parses arguments with Zod schema, calls KeycloakService.deleteUser, and 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}`, }, ], }; }
  • Core logic in KeycloakService to delete a user by ID from a realm using 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, }); }
  • Zod schema for validating delete-user tool input parameters.
    const DeleteUserSchema = z.object({ realm: z.string(), userId: z.string(), });
  • src/index.ts:366-376 (registration)
    Tool registration in listTools response, including name, description, and JSON 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"], }, },

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