Skip to main content
Glama
HaithamOumerzoug

Keycloak MCP Server

delete-user

Remove a user from a specific realm in Keycloak using the MCP server. Specify the realm and user ID to ensure accurate deletion, streamlining user management tasks.

Instructions

Delete a user from a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYes
userIdYes

Implementation Reference

  • Implements the core logic for deleting a user: validates input with DeleteUserSchema, deletes via Keycloak admin client users.del, and returns success message.
    public async deleteUser(args: unknown): Promise<string> {
      const { realm, userId } = DeleteUserSchema.parse(args);
      await this.kcAdminClient.users.del({ id: userId, realm });
      return `User ${userId} deleted successfully from realm ${realm}`;
    }
  • Dispatches the delete-user tool invocation to KeycloakService.deleteUser in the CallToolRequest handler.
    case "delete-user":
      return {
        content: [
          { type: "text", text: await keycloakService.deleteUser(args) },
        ],
      };
  • JSON Schema definition for delete-user tool input parameters, referenced in tool registration.
    "delete-user": {
      type: "object",
      properties: {
        realm: { type: "string" },
        userId: { type: "string" },
      },
      required: ["realm", "userId"],
    },
  • Zod validation schema for delete-user input arguments, used in the service handler.
    export const DeleteUserSchema = z.object({
      realm: z.string(),
      userId: z.string(),
    });
  • src/server.ts:41-45 (registration)
    Registers the delete-user tool in the MCP server's ListTools response with name, description, and input schema.
    {
      name: "delete-user",
      description: "Delete a user from a specific realm",
      inputSchema: InputSchema["delete-user"],
    },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

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

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