Skip to content
MCP server
Registry

GoCloak MCP Server

Security-first, read-only Keycloak MCP server built in Go with GoCloak v15.

GoCloak MCP scores 66 (Good), licensed Apache-2.0 and written in Go. It installs as a local process. It declares 1 tool. Filed under Uncategorized. GitHub shows 0 stars. Install configs are generated for 10 clients. Being listed in the registry is not the same as being vendor-official.

by nerzalApache-2.0Go0 stars
Trust score
66Good
Trust score 66 of 100, Good

Good trust

66 of 100 from six public signals. Nobody can buy a point.

  • Listed in the official MCP registry.
  • OSI-style license: apache-2.0.
How we score trust
Scorecard

License, quality and maintenance

How grades work
Trust breakdown

Where the 66 comes from

22 + 20 + 0 + 10 + 4 + 10 = 66. Each factor is capped, so no single signal can carry a listing.

Registry22 / 30

Active in the official MCP registry, plus a known vendor namespace.

Registry: 22 of 30 points.
Maintenance20 / 20

How recently the repository saw a commit or release.

Maintenance: 20 of 20 points.
Popularity0 / 20

GitHub stars and weekly downloads, on a log scale.

Popularity: 0 of 20 points.
License10 / 10

A clear, OSI-style open-source license.

License: 10 of 10 points.
Security4 / 10

Not archived, a secure install path, a pinned version.

Security: 4 of 10 points.
Docs10 / 10

A real summary, a README with depth, listed tools.

Docs: 10 of 10 points.

Install

Pick your client, copy the config, paste it in.

Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.

~/Library/Application Support/Claude/claude_desktop_config.json
{  "mcpServers": {    "nerzal-gocloak-mcp": {      "command": "docker",      "args": [        "run",        "-i",        "--rm",        "ghcr.io/nerzal/gocloak-mcp:0.3.0"      ],      "env": {        "KEYCLOAK_URL": "",        "KEYCLOAK_REALM": "",        "KEYCLOAK_CLIENT_ID": "",        "KEYCLOAK_CLIENT_SECRET": "YOUR_KEYCLOAK_CLIENT_SECRET",        "KEYCLOAK_ALLOWED_REALMS": ""      }    }  }}

Environment variables

NameRequiredNotes
KEYCLOAK_URLRequiredHTTPS Keycloak base URL (loopback HTTP allowed for local development)
KEYCLOAK_REALMRequiredDefault target realm and token-issuing realm
KEYCLOAK_CLIENT_IDRequiredConfidential service-account client ID
KEYCLOAK_CLIENT_SECRETSecretRequiredService-account client secret
KEYCLOAK_ALLOWED_REALMSOptionalOptional comma-separated allowlist of queryable realms

Tools1Tool docs quality grade F

All capabilities
  • v0.3.0tool

    Performance Benchmarks ( )

About

gocloak-mcp

CI Release Go GHCR License

A security-first, read-only Keycloak MCP server built in Go with the official MCP Go SDK and GoCloak v15. Supports Stdio (default) and Streamable HTTP transports, multi-realm allowlisting, and full read-only parity across Users, Clients, Client Scopes, Roles, Groups, Realms, Events, Authentication Flows, Required Actions, Identity Providers, and Keycloak 26+ Organizations.

In Stdio mode, standard output is strictly reserved for JSON-RPC frames and all structured JSON logs are written to standard error with automatic redaction.

Performance Benchmarks (v0.3.0)

gocloak-mcp v0.3.0 Head-to-Head Benchmarks

Measured head-to-head on ubuntu-latest (4 vCPU x86_64) against an identical local mock Keycloak Admin API (50 users/call). See Security & Benchmarks for the full OWASP MCP Top 10 control matrix, pprof optimization progression, and reproducible harness (benchmarks/run_benchmarks.py):

ServerTransportBinary / ImageCold StartRSS (Load)Throughput
gocloak-mcp (v0.3.0, Go 1.27 + gocloak v15.1)Stdio / HTTP10.2 MB / 21.1 MB9.9 ms / 22.7 ms16.2 MB / 17.4 MB1,227 / 1,140 req/s
MnemoShare/mnemoshare-keycloak-mcp (Go)Stdio / HTTP10.4 MB20.0 ms / 21.7 ms17.4 MB / 18.5 MB1,161 / 1,120 req/s
HaithamOumerzoug/keycloak-mcp (TS/Node 22)StdioNode runtime114.1 ms97.6 MB480 req/s
idoyudha/mcp-keycloak (Python 3.12 / FastMCP)StdioPython venv591.4 ms64.1 MB145 req/s
sshaaf/keycloak-mcp-server (Quarkus Native)HTTP74.1 MB63.5 ms151.4 MB205 req/s
sshaaf/keycloak-mcp-server (Quarkus JVM)HTTP23.4 MB JAR / 626 MB2,024.1 ms310.8 MB158 req/s

Requirements

  • Go 1.27.4 or newer
  • A Keycloak confidential client with service accounts enabled
  • A client secret supplied through the environment

Configuration

The server validates configuration before it starts and exits without printing secrets when validation fails.

Environment variableRequiredDefaultDescription
KEYCLOAK_URLYes—HTTPS Keycloak base URL (a /auth prefix is allowed); loopback HTTP is allowed for local development
KEYCLOAK_REALMYes—Default target realm and token-issuing realm
KEYCLOAK_ALLOWED_REALMSNoKEYCLOAK_REALMComma-separated allowlist of realms tools may query (KEYCLOAK_REALM is always included)
KEYCLOAK_CLIENT_IDYes—Service-account client ID
KEYCLOAK_CLIENT_SECRETYes—Service-account client secret
KEYCLOAK_REQUEST_TIMEOUTNo15sPer-request timeout; valid range is > 0 and <= 2m
MCP_TRANSPORTNostdioTransport mode: stdio or http (Streamable HTTP)
MCP_HTTP_ADDRNo127.0.0.1:8080Listen address when MCP_TRANSPORT=http
MCP_HTTP_BEARER_TOKENConditional—Optional on loopback; required (min 32 chars) when MCP_HTTP_ADDR binds to a non-loopback address
MCP_HTTP_ALLOWED_ORIGINSNoLoopback onlyComma-separated additional Origin allowlist for browser clients on Streamable HTTP (DNS rebinding protection)

Use your deployment platform's secret manager to provide secrets. Do not put credentials in command-line arguments, configuration files, or logs.

Minimal Keycloak permissions

Create a dedicated confidential client with service accounts enabled and assign only the read-only realm-management roles required for the tools you use:

  • query-users, view-users — user, session, and group-membership tools
  • query-clients, view-clients — client, client-role, and client-scope tools
  • query-groups — group tools
  • view-realm — realm, role, auth-flow, required-action, and IdP tools
  • view-events — login and admin event tools

Do not use the master realm or grant realm-admin unless explicitly required.

Installation

Homebrew (macOS & Linux)

brew install --cask nerzal/tap/gocloak-mcp

Prebuilt binaries (GitHub Releases)

Download the archive for your platform (darwin, linux, windows for amd64 and arm64) from the GitHub Releases page, verify the SHA-256 checksum against checksums.txt, and place gocloak-mcp on your PATH.

Docker / GHCR (multi-arch: linux/amd64, linux/arm64)

docker pull ghcr.io/nerzal/gocloak-mcp:latest

The image contains a static binary on gcr.io/distroless/static-debian12:nonroot.

Go install (from source)

go install github.com/Nerzal/gocloak-mcp/cmd/gocloak-mcp@latest

MCP client configuration

Native binary (Stdio)

Works with Claude Desktop, Cursor, VS Code, Claude Code, and other Stdio MCP clients:

{
  "mcpServers": {
    "keycloak": {
      "command": "gocloak-mcp",
      "env": {
        "KEYCLOAK_URL": "https://keycloak.example.com",
        "KEYCLOAK_REALM": "example",
        "KEYCLOAK_CLIENT_ID": "gocloak-mcp",
        "KEYCLOAK_CLIENT_SECRET": "<injected by your secret manager>"
      }
    }
  }
}

Docker container (Stdio)

Run isolated without installing a local binary:

{
  "mcpServers": {
    "keycloak": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "KEYCLOAK_URL",
        "-e", "KEYCLOAK_REALM",
        "-e", "KEYCLOAK_CLIENT_ID",
        "-e", "KEYCLOAK_CLIENT_SECRET",
        "ghcr.io/nerzal/gocloak-mcp:latest"
      ],
      "env": {
        "KEYCLOAK_URL": "https://keycloak.example.com",
        "KEYCLOAK_REALM": "example",
        "KEYCLOAK_CLIENT_ID": "gocloak-mcp",
        "KEYCLOAK_CLIENT_SECRET": "<injected by your secret manager>"
      }
    }
  }
}

Run directly

Stdio mode (default)

export KEYCLOAK_URL=https://keycloak.example.com
export KEYCLOAK_REALM=example
export KEYCLOAK_CLIENT_ID=gocloak-mcp
export KEYCLOAK_CLIENT_SECRET='<injected by your secret manager>'
go run ./cmd/gocloak-mcp

Streamable HTTP mode

export MCP_TRANSPORT=http
export MCP_HTTP_ADDR=127.0.0.1:8080
export MCP_HTTP_BEARER_TOKEN='<at least 32 random chars for non-loopback>'
go run ./cmd/gocloak-mcp

Or via Docker:

docker run --rm -p 127.0.0.1:8080:8080 \
  -e MCP_TRANSPORT=http \
  -e MCP_HTTP_ADDR=0.0.0.0:8080 \
  -e MCP_HTTP_BEARER_TOKEN='<at least 32 random chars>' \
  -e KEYCLOAK_URL=https://keycloak.example.com \
  -e KEYCLOAK_REALM=example \
  -e KEYCLOAK_CLIENT_ID=gocloak-mcp \
  -e KEYCLOAK_CLIENT_SECRET='<injected by your secret manager>' \
  ghcr.io/nerzal/gocloak-mcp:latest

Exposes /mcp (Streamable HTTP MCP endpoint) and /healthz (liveness probe).

Read-Only Tools (32)

All tools declare readOnlyHint: true, idempotentHint: true, and destructiveHint: false, accept an optional realm parameter checked against KEYCLOAK_ALLOWED_REALMS, cap pagination at max <= 100 (default 50), and return safe allowlist DTOs (never exposing credentials, client secrets, IdP config secrets, or raw admin-event payloads).

  • Users: list_users, get_user, count_users, get_user_sessions, get_user_groups, get_user_roles
  • Clients & Scopes: list_clients, get_client, get_client_service_account, list_client_roles, list_client_scopes, get_client_scope
  • Roles: list_realm_roles, get_realm_role, get_users_in_role, get_users_in_client_role
  • Groups: list_groups, count_groups, get_group, get_group_members, get_group_roles
  • Realms & Events: list_realms, get_realm_info, list_events, list_admin_events
  • Auth Flows & Required Actions: list_authentication_flows, get_flow_executions, list_required_actions
  • Identity Providers: list_identity_providers, get_identity_provider
  • Organizations (Keycloak 26+): list_organizations, get_organization_members

Build and verification

make check

Building the container locally

docker build -t gocloak-mcp .

Frequently asked questions

What is GoCloak MCP Server?

Security-first, read-only Keycloak MCP server built in Go with GoCloak v15.

How do I install GoCloak MCP Server in Claude Desktop, Cursor, or VS Code?

Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. GoCloak MCP Server runs locally from the Docker image ghcr.io/nerzal/gocloak-mcp:0.3.0 with the command docker run -i --rm ghcr.io/nerzal/gocloak-mcp:0.3.0.

Is GoCloak MCP Server free and open source?

Yes. GoCloak MCP Server is released under the Apache-2.0 license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.

Does GoCloak MCP Server support remote (HTTP) connections?

No remote endpoint is listed for GoCloak MCP Server. It runs locally on your machine over stdio, started by your MCP client.

What tools does GoCloak MCP Server provide?

GoCloak MCP Server provides 1 tool: v0.3.0. See the full tool list for descriptions and parameters.

How is GoCloak MCP Server's trust score calculated?

GoCloak MCP Server scores 66 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.

Reviews

No reviews yet

—Be the first to review

5 star0 reviews at 5 stars
4 star0 reviews at 4 stars
3 star0 reviews at 3 stars
2 star0 reviews at 2 stars
1 star0 reviews at 1 stars

No published reviews yet. Used it? Tell the next person how it went.

Add badge to your README

Paste either snippet into the repository README. The image links to this listing.

Listed on MCPpedia

Top 5 MCP servers

Daily or weekly. Confirm by email, unsubscribe any time.

How often

Manage this listing

Claim this server