Skip to main content
Glama
HaithamOumerzoug

Keycloak MCP Server

list-clients

Retrieve a list of clients in a specified Keycloak realm using the MCP server, enabling streamlined management of client configurations and permissions.

Instructions

List clients in a specific realm

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
realmYes

Implementation Reference

  • The core handler function that executes the 'list-clients' tool logic: validates input, queries Keycloak for clients in the specified realm, and formats the results as a string.
    public async listClients(args: unknown): Promise<string> {
      const { realm } = ListClientsSchema.parse(args);
      const clients: ClientRepresentation[] =
        await this.kcAdminClient.clients.find({ realm });
      return `Clients in realm ${realm}:\n${clients
        .map((c) => `- ${c.clientId} (${c.id})`)
        .join("\n")}`;
    }
  • Input schema (JSON Schema format) for the 'list-clients' tool, defining the required 'realm' parameter.
    "list-clients": {
      type: "object",
      properties: {
        realm: { type: "string" },
      },
      required: ["realm"],
    },
  • src/server.ts:67-70 (registration)
    Tool registration in the MCP server's ListTools handler, exposing name, description, and schema.
      name: "list-clients",
      description: "List clients in a specific realm",
      inputSchema: InputSchema["list-clients"],
    },
  • Dispatch handler in the CallToolRequest that invokes the KeycloakService.listClients method.
    case "list-clients":
      return {
        content: [
          { type: "text", text: await keycloakService.listClients(args) },
        ],
      };
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