World Monitor
Real-time global intelligence on conflict, markets, energy, trade, shipping and cyber. 100 tools.
Unofficial: one tool per Keycloak admin operation on a realm, read-only unless writes are enabled
Lists are ordered by a usage score (out of 100) built from these parts
| Popularity | 28/80 | GitHub stars or weekly downloads: the larger counts 60, the smaller 20 |
|---|---|---|
| Freshness | 12/12 | Full marks for a release or code change within 30 days |
| Still answering | 0/8 | The cloud endpoint answered at the last check |
| Usage score | 40/100 |
Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: 108 (Used only on the Trending tab)
Pick the AI app you use, then copy the settings.
Let your AI install it with one sentence
Please install Keycloak Admin API. Follow https://mcp.popnx.com/i/sferarc-keycloak-api-mcp.md, show me the commands and wait for my OK before running them.Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads
Passed 3/3 checks · Runs on your computer · ✓ Commands checked Nov 17, 2026
First: which AI do you use?
Pick your app and the steps appear below.
Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Keycloak Admin API for Claude on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "keycloak-api": { "command": "npx", "args": [ "-y", "keycloak-api" ], "env": { "KEYCLOAK_URL": "your-value", "KEYCLOAK_REALM": "your-value", "KEYCLOAK_TOKEN": "your-value", "KEYCLOAK_CLIENT_SECRET": "your-value", "KEYCLOAK_TOKEN_REALM": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Keycloak Admin API tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KEYCLOAK_URL Base URL of the server, such as https://keycloak.example.comKEYCLOAK_REALM Realm the tools act onDescriptions are as written by the maker.
SettingsDeveloperEdit Config
{
"mcpServers": {
"keycloak-api": {
"command": "npx",
"args": [
"-y",
"keycloak-api"
],
"env": {
"KEYCLOAK_URL": "your-value",
"KEYCLOAK_REALM": "your-value",
"KEYCLOAK_TOKEN": "your-value",
"KEYCLOAK_CLIENT_SECRET": "your-value",
"KEYCLOAK_TOKEN_REALM": "your-value"
}
}
}
}Paste the key only into the app’s field, never into a chat or to anyone
Use Keycloak Admin API and tell me what you can do for me, then show me one thing✓ If Claude says it is using Keycloak Admin API or shows a Keycloak Admin API tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
KEYCLOAK_CLIENT_ID A confidential client with a service account, for the client credentials grantKEYCLOAK_MCP_ALLOW_WRITES 1 to list the tools that change dataKEYCLOAK_MCP_RESOURCES Comma separated resources to list tools for, such as users,groups,rolesDescriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
ChatGPT cannot connect Keycloak Admin API yet
Keycloak Admin API runs on your computer, but ChatGPT can only connect servers that run on the web
A · Use an app that can connect Keycloak Admin API
B · Others in Other that work with ChatGPT
Picked from the most used in the same category, only ones that connect by address with no key
Works with Claude Code, with some setup first
You need a Keycloak Admin API key (create it on the maker’s site) · 2 setting(s) to fill in (KEYCLOAK_URL, KEYCLOAK_REALM) · Install Node.js on your computer first (one time)
Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Keycloak Admin API for Claude Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user keycloak-api --env KEYCLOAK_URL=your-value --env KEYCLOAK_REALM=your-value --env KEYCLOAK_TOKEN=your-value --env KEYCLOAK_CLIENT_SECRET=your-value --env KEYCLOAK_TOKEN_REALM=your-value -- npx -y keycloak-api 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Keycloak Admin API tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KEYCLOAK_URL Base URL of the server, such as https://keycloak.example.comKEYCLOAK_REALM Realm the tools act onDescriptions are as written by the maker.
Mac: press Command+Space and type Terminal · Windows: open PowerShell
claude mcp add --scope user keycloak-api --env KEYCLOAK_URL=your-value --env KEYCLOAK_REALM=your-value --env KEYCLOAK_TOKEN=your-value --env KEYCLOAK_CLIENT_SECRET=your-value --env KEYCLOAK_TOKEN_REALM=your-value -- npx -y keycloak-apiReplace “your-value” with your key before pressing Enter
Paste the key only into the app’s field, never into a chat or to anyone
You should see Keycloak Admin API listed as connected
Use Keycloak Admin API and tell me what you can do for me, then show me one thing✓ If Claude Code says it is using Keycloak Admin API or shows a Keycloak Admin API tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
KEYCLOAK_CLIENT_ID A confidential client with a service account, for the client credentials grantKEYCLOAK_MCP_ALLOW_WRITES 1 to list the tools that change dataKEYCLOAK_MCP_RESOURCES Comma separated resources to list tools for, such as users,groups,rolesDescriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with Cursor, with some setup first
You need a Keycloak Admin API key (create it on the maker’s site) · 2 setting(s) to fill in (KEYCLOAK_URL, KEYCLOAK_REALM) · Install Node.js on your computer first (one time)
Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Keycloak Admin API for Cursor on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "keycloak-api": { "command": "npx", "args": [ "-y", "keycloak-api" ], "env": { "KEYCLOAK_URL": "your-value", "KEYCLOAK_REALM": "your-value", "KEYCLOAK_TOKEN": "your-value", "KEYCLOAK_CLIENT_SECRET": "your-value", "KEYCLOAK_TOKEN_REALM": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Keycloak Admin API tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KEYCLOAK_URL Base URL of the server, such as https://keycloak.example.comKEYCLOAK_REALM Realm the tools act onDescriptions are as written by the maker.
In the Keycloak Admin API settings, KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Use Keycloak Admin API and tell me what you can do for me, then show me one thing✓ If Cursor says it is using Keycloak Admin API or shows a Keycloak Admin API tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
KEYCLOAK_CLIENT_ID A confidential client with a service account, for the client credentials grantKEYCLOAK_MCP_ALLOW_WRITES 1 to list the tools that change dataKEYCLOAK_MCP_RESOURCES Comma separated resources to list tools for, such as users,groups,rolesDescriptions are as written by the maker.
Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with VS Code, with some setup first
You need a Keycloak Admin API key (create it on the maker’s site) · 2 setting(s) to fill in (KEYCLOAK_URL, KEYCLOAK_REALM) · Install Node.js on your computer first (one time)
Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Keycloak Admin API for VS Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "keycloak-api": { "type": "stdio", "command": "npx", "args": [ "-y", "keycloak-api" ], "env": { "KEYCLOAK_URL": "your-value", "KEYCLOAK_REALM": "your-value", "KEYCLOAK_TOKEN": "your-value", "KEYCLOAK_CLIENT_SECRET": "your-value", "KEYCLOAK_TOKEN_REALM": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Keycloak Admin API tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
These are program settings, not keys. No sign-up needed; fill them in as the maker describes.
KEYCLOAK_URL Base URL of the server, such as https://keycloak.example.comKEYCLOAK_REALM Realm the tools act onDescriptions are as written by the maker.
In the Keycloak Admin API settings, KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM, KEYCLOAK_URL, KEYCLOAK_REALM is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Use Keycloak Admin API and tell me what you can do for me, then show me one thing✓ If VS Code says it is using Keycloak Admin API or shows a Keycloak Admin API tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
KEYCLOAK_CLIENT_ID A confidential client with a service account, for the client credentials grantKEYCLOAK_MCP_ALLOW_WRITES 1 to list the tools that change dataKEYCLOAK_MCP_RESOURCES Comma separated resources to list tools for, such as users,groups,rolesDescriptions are as written by the maker.
Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Claude Code
claude mcp add --scope user keycloak-api --env KEYCLOAK_URL=your-value --env KEYCLOAK_REALM=your-value --env KEYCLOAK_TOKEN=your-value --env KEYCLOAK_CLIENT_SECRET=your-value --env KEYCLOAK_TOKEN_REALM=your-value -- npx -y keycloak-apiClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"keycloak-api": {
"command": "npx",
"args": [
"-y",
"keycloak-api"
],
"env": {
"KEYCLOAK_URL": "your-value",
"KEYCLOAK_REALM": "your-value",
"KEYCLOAK_TOKEN": "your-value",
"KEYCLOAK_CLIENT_SECRET": "your-value",
"KEYCLOAK_TOKEN_REALM": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"keycloak-api": {
"command": "npx",
"args": [
"-y",
"keycloak-api"
],
"env": {
"KEYCLOAK_URL": "your-value",
"KEYCLOAK_REALM": "your-value",
"KEYCLOAK_TOKEN": "your-value",
"KEYCLOAK_CLIENT_SECRET": "your-value",
"KEYCLOAK_TOKEN_REALM": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"keycloak-api": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"keycloak-api"
],
"env": {
"KEYCLOAK_URL": "your-value",
"KEYCLOAK_REALM": "your-value",
"KEYCLOAK_TOKEN": "your-value",
"KEYCLOAK_CLIENT_SECRET": "your-value",
"KEYCLOAK_TOKEN_REALM": "your-value"
}
}
}
}KEYCLOAK_URL required envKEYCLOAK_REALM required envKEYCLOAK_TOKEN secret required envKEYCLOAK_CLIENT_ID envKEYCLOAK_CLIENT_SECRET secret required envKEYCLOAK_TOKEN_REALM secret required envKEYCLOAK_MCP_ALLOW_WRITES envKEYCLOAK_MCP_RESOURCES envDescriptions are as written by the maker.
These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.
npm: keycloak-apiBased on how this server connects and on each app’s own docs, checked Nov 10, 2026.
Run on your computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Runs on your computer; the tool list appears in your AI app after you install it.
We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 19, 2026
The registry name was verified with the GitHub account sferarc, which owns the repo
Code last changed today
Uses ISC
This one runs on your computer; there is no internet endpoint
Runs on your computer and uses local settings instead
Runs on your computer; we can only read tool lists from internet endpoints
Not checked yet
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/servers/sferarc-keycloak-api-mcp)Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
No reviews yet
Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.
It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.
You need to fill in: KEYCLOAK_TOKEN, KEYCLOAK_CLIENT_SECRET, KEYCLOAK_TOKEN_REALM
It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).
The GitHub repo last changed today, and the latest version (3.8.1) reached the registry 2 days ago.
Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Node.js on your computer.
In the same category: World Monitor, openstatus, Oh My Posh Validator, Strata, Jitsu
Same category, other makers, commands already checked. Official ones first, then by stars.
Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi
Real-time global intelligence on conflict, markets, energy, trade, shipping and cyber. 100 tools.
Manage monitors, status pages, incidents and maintenances in your openstatus workspace.
Validate oh-my-posh configurations and segment snippets against the official schema.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Manage Jitsu data pipelines: destinations, streams, connections, functions, live events.
| This one Keycloak Admin API | World Monitor | openstatus | Oh My Posh Validator | Strata | Jitsu | |
|---|---|---|---|---|---|---|
| Runs where | Installs on your computer | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install |
| Needs a key | Yes | No | No | No | No | No |
| Add with + in Claude | No | No | No | No | No | No |
| Basic checks | 3/3 | 4/4 | 4/4 | 4/4 | 1/4 | 4/4 |
| License | ISC | AGPL-3.0 | AGPL-3.0 | MIT | Apache-2.0 | MIT |
| Price | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry |
Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.
Unofficial. Not made or endorsed by Keycloak.
Auto-generated, fully typed client for the Keycloak Admin and Account REST APIs.
Generated from the admin OpenAPI spec at https://www.keycloak.org/docs-api/latest/rest-api/openapi.json and the account spec kept in this repository at https://raw.githubusercontent.com/sferarc/openapi/main/packages/keycloak-api/specs/account.yaml; before generating, kubb.config.ts renames operation IDs, camel-cases path parameters, sends raw string bodies unquoted and types the workflow resource path parameter as its enum.
fetch, or bring your own implementationkeycloak-api/effectnpm install keycloak-api
Keycloak is self-hosted, so both clients require the baseUrl of your server. Endpoints are addressed as " ".
src/admin/generated/OPERATIONS.md and src/account/generated/OPERATIONS.md list every admin and account operation with its " " request and the spec's summary, one table per tag. They ship in the package, so grep in node_modules/keycloak-api finds an operation without reading the types.
import { KeycloakAdminApi } from "keycloak-api";
const admin = new KeycloakAdminApi({ baseUrl: "https://keycloak.example.com", token: process.env.KEYCLOAK_TOKEN ?? null, });
const realms = await admin.request("GET /admin/realms"); const realm = await admin.request("GET /admin/realms/{realm}", { pathParams: { realm: "master" }, });
The Account API is scoped to a single realm, passed at construction time.
import { KeycloakAccountApi } from "keycloak-api";
const account = new KeycloakAccountApi({ baseUrl: "https://keycloak.example.com", realm: "master", token: process.env.KEYCLOAK_TOKEN ?? null, });
const me = await account.request("GET /account/");
Keycloak access tokens expire after a few minutes. Pass a function as token, sync or async, and both clients call it before every request, so each call sends the token it returns:
const admin = new KeycloakAdminApi({
baseUrl: "https://keycloak.example.com", token: () => tokenStore.getAccessToken(), });
A call rejects with what the function threw, before any request is sent. A call's own config.token still wins.
const admin = new KeycloakAdminApi({
baseUrl: "https://keycloak.example.com", token: process.env.KEYCLOAK_TOKEN ?? null, fetch: myFetchImplementation, });
A call resolves to the parsed body only. To read a response header, pass onResponse in config; it gets the status and headers of the response before the body is read, an error response included. Keycloak answers a create call, such as a new user or client, with 201, an empty body and the new resource's URL, which ends in its id, in Location:
let userId: string | undefined;
await admin.request("POST /admin/realms/{realm}/users", { pathParams: { realm: "master" }, body: { username: "ada", enabled: true }, config: { onResponse: ({ headers }) => (userId = headers.get("Location")?.split("/").pop()) }, });
An error thrown inside onResponse rejects the call with an Error whose message starts with onResponse threw on and whose cause is what was thrown.
A call that gets an HTTP error response rejects with an ApiResponseError, exported from the package, which extends Error: status is the HTTP status code, payload is the parsed JSON error body, or the raw body text, up to 1000 characters, when it is not JSON, and method and path name the request, without its query string. Its message reads returned : , where the detail is the API's own error message or else the first 200 characters of the body. A request that gets no response at all, for example because the network failed, rejects with an Error whose message names the method, the path and the reason, and whose cause is the original exception. A request cancelled through signal rejects with what the signal was aborted with, as is: the AbortError, or the TimeoutError of AbortSignal.timeout().
The effect entrypoint exposes every Admin API operation as an Effect, by tag in AdminApiService and by " " in adminEffectByPath, and every Account API operation in AccountApiService and accountEffectByPath. It requires effect 4 as a peer dependency. As with the client class, the layer needs the baseUrl of your server, and token can be a function that returns a fresh token before every call.
import { Effect } from "effect";
import { adminEffectByPath, makeApiLayer } from "keycloak-api/effect";
const program = adminEffectByPath["GET /admin/realms/{realm}"]({ pathParams: { realm: "master" } });
await Effect.runPromise( program.pipe( Effect.provide( makeApiLayer({ baseUrl: "https://keycloak.example.com", token: () => tokenStore.getAccessToken(), }) ) ) );
Errors are typed as ApiError, NetworkError and ValidationError. An HTTP error response fails with ApiError, which carries the HTTP status; a request that never gets a response, or a token function that throws, fails with NetworkError.
A call can pass its own config, which layers over the layer's: its headers join the layer's, and its other fields, such as onResponse, replace them. An onResponse that throws makes the effect die with the onResponse threw on error as a defect rather than fail with NetworkError.
Account API paths sit under a realm, so an account effect also needs makeAccountLayer(realm), which rebases the server layer's baseUrl onto /realms/ and encodes the realm as KeycloakAccountApi does. One makeApiLayer then serves admin and account effects in the same program:
import { Effect } from "effect";
import { AccountApiService, AdminApiService, makeAccountLayer, makeApiLayer } from "keycloak-api/effect";
const program = Effect.gen(function* () { const realms = yield* AdminApiService.realmsAdmin.gETAdminRealms(); const account = yield* AccountApiService.account .getAccount() .pipe(Effect.provide(makeAccountLayer("my realm"))); return { realms, account }; });
await Effect.runPromise( program.pipe( Effect.provide( makeApiLayer({ baseUrl: "https://keycloak.example.com", token: () => tokenStore.getAccessToken(), }) ) ) );
An account effect run without makeAccountLayer goes to /account/, which is not a Keycloak endpoint.
The package ships keycloak-api-mcp, a stdio MCP server with one tool per admin operation on a realm, so an agent can answer questions such as which users of a realm hold a role. It lists only the read (GET) tools; set KEYCLOAK_MCP_ALLOW_WRITES=1 to add the others, which carry destructiveHint on DELETE. Every tool acts on KEYCLOAK_REALM, which is not a tool argument: the two operations that list and import realms are left out, and a call whose URL resolves outside that realm, such as a group path with .. segments, is refused as a tool error. An HTTP error comes back as a tool error with the status and Keycloak's message.
| Variable | |
|---|---|
KEYCLOAK_URL | Base URL of the server, such as https://keycloak.example.com |
KEYCLOAK_REALM | Realm the tools act on |
KEYCLOAK_TOKEN | A fixed access token, or else: |
KEYCLOAK_CLIENT_ID, KEYCLOAK_CLIENT_SECRET | A confidential client with a service account; the server gets a token with the client credentials grant and renews it before it expires |
KEYCLOAK_TOKEN_REALM | Realm of that client, if not KEYCLOAK_REALM (for example master) |
KEYCLOAK_MCP_ALLOW_WRITES | 1 to list the tools that change data |
KEYCLOAK_MCP_RESOURCES | Comma separated resources to list tools for, such as users,groups,roles: the first path segment after the realm, or realm for the realm itself. Unset lists every resource |
The service account needs the realm-management roles for what the tools should read, such as view-users.
Without KEYCLOAK_MCP_RESOURCES the server lists about 200 read tools, over the 128 a VS Code chat request can enable, so pick the resources there. An unknown name stops the server with the list of valid ones.
Claude Code, in .mcp.json:
{
"mcpServers": { "keycloak": { "command": "npx", "args": ["-y", "-p", "keycloak-api", "keycloak-api-mcp"], "env": { "KEYCLOAK_URL": "https://keycloak.example.com", "KEYCLOAK_REALM": "acme", "KEYCLOAK_CLIENT_ID": "mcp", "KEYCLOAK_CLIENT_SECRET": "${KEYCLOAK_CLIENT_SECRET}" } } } }
VS Code, in .vscode/mcp.json:
{
"inputs": [ { "type": "promptString", "id": "keycloak-secret", "description": "Keycloak client secret", "password": true } ], "servers": { "keycloak": { "type": "stdio", "command": "npx", "args": ["-y", "-p", "keycloak-api", "keycloak-api-mcp"], "env": { "KEYCLOAK_URL": "https://keycloak.example.com", "KEYCLOAK_REALM": "acme", "KEYCLOAK_CLIENT_ID": "mcp", "KEYCLOAK_CLIENT_SECRET": "${input:keycloak-secret}", "KEYCLOAK_MCP_RESOURCES": "users,groups,roles" } } } }
| Import | Contents |
|---|---|
keycloak-api | both client classes, plus admin/account operations, schemas and types |
keycloak-api/admin/components | admin operations grouped by tag and by path |
keycloak-api/admin/schemas | Zod schemas for admin operations |
keycloak-api/admin/types | TypeScript types for admin operations |
keycloak-api/account/components | account operations grouped by tag and by path |
keycloak-api/account/schemas | Zod schemas for account operations |
keycloak-api/account/types | TypeScript types for account operations |
keycloak-api/effect | Effect bindings for admin operations |
ISC