Skip to main content
Glama
Octodet

Advanced Keycloak MCP server

by Octodet

list-users

Retrieve and display user details within a specified Keycloak realm using the Advanced Keycloak MCP server. Input the realm name to generate a comprehensive user list.

Instructions

List users in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYesRealm name

Implementation Reference

  • MCP tool handler for 'list-users': validates input with ListUsersSchema, calls KeycloakService.listUsers(realm), formats and returns list of users.
    case "list-users": { const { realm } = ListUsersSchema.parse(args); const users = await keycloakService.listUsers(realm); return { content: [ { type: "text", text: `Users in realm ${realm}:\n${users .map((u) => `- ${u.username} (${u.id})`) .join("\n")}`, }, ], }; }
  • Zod schema used to validate input parameters for the 'list-users' tool.
    const ListUsersSchema = z.object({ realm: z.string(), });
  • src/index.ts:386-396 (registration)
    Tool registration in listTools response, including name, description, and inputSchema.
    { name: "list-users", description: "List users in a specific realm", inputSchema: { type: "object", properties: { realm: { type: "string", description: "Realm name" }, }, required: ["realm"], }, },
  • KeycloakService.listUsers: authenticates, sets realm, and retrieves users via Keycloak admin client API.
    async listUsers(realm: string) { await this.authenticate(); this.client.setConfig({ realmName: realm }); return await this.client.users.find(); }

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