Skip to content

Commands

Terminal window
oidcdoctor <command> [options]

Run via npx oidcdoctor <command> or install globally with npm i -g oidcdoctor (the installed binary is oidcdoctor).

CommandWhat it does
initWrite a starter oidcdoctor.json in the current directory.
scaffoldGenerate app-side login code for a framework.
analyzeReconcile oidcdoctor.json intent against the live Keycloak client.
verifyRun the real auth-code + PKCE handshake and assert a token is issued.
syncCreate or patch the Keycloak client to match the app intent.
mcpServe oidcdoctor’s tools over MCP (stdio). Wire this into your agent.
installWire oidcdoctor into your agents (Claude Code, Cursor) automatically.

Write a starter oidcdoctor.json in the current directory and print the next steps.

Terminal window
oidcdoctor init

Edit the generated file — at minimum set intent.issuer, intent.clientId, intent.redirectUri, and keycloak.auth — then run analyze or verify.

Generate app-side OIDC login code for a framework. The generated files are guaranteed consistent with the intent in oidcdoctor.json — same redirectUri, clientId, clientType, pkceMethod, and scopes.

OptionMeaning
--framework <name>next | fastapi | django (required if not set in config).
--out <dir>Write files into this directory. Omit to print to stdout.
--config <path>Path to oidcdoctor.json (file or directory; default ./oidcdoctor.json).
Terminal window
oidcdoctor scaffold --framework next --out .
oidcdoctor scaffold --framework fastapi # prints to stdout
oidcdoctor scaffold --framework django --out src/

Fetch the live Keycloak client via the Admin REST API and reconcile it against the app intent. Reports every mismatch with a precise two-sided fix.

OptionMeaning
--config <path>oidcdoctor.json to use (default: ./oidcdoctor.json).
Terminal window
oidcdoctor analyze

Requires keycloak.auth in oidcdoctor.json. Prints each finding code, the human message, the app-side fix, and the Keycloak-side fix. Exits 1 if any error-severity finding is found. See Failure classes.

Run the real authorization-code + PKCE handshake against Keycloak using fetch — no browser, no Playwright. Asserts a token is issued; exits 1 with a precise finding if it fails.

OptionMeaning
--config <path>oidcdoctor.json to use (default: ./oidcdoctor.json).
Terminal window
oidcdoctor verify

Requires testUser.username and testUser.password in oidcdoctor.json. The handshake: authorize URL → login form POST → code on the 302 → token exchange → assert token. On any failure it prints the step, the finding code, and the fix.

Create the Keycloak client if it doesn’t exist; otherwise apply the minimal patch to bring it into agreement with the app intent. Unions URI lists and origin lists rather than replacing them — existing entries are preserved.

OptionMeaning
--config <path>oidcdoctor.json to use (default: ./oidcdoctor.json).
Terminal window
oidcdoctor sync

Requires keycloak.auth in oidcdoctor.json. Re-run verify after sync to confirm the login works end to end.

Start oidcdoctor as an MCP server over stdio. Exposes four agent-facing tools: analyze, verify_login, sync_client, and scaffold. Reads oidcdoctor.json from the current directory (or --config).

Terminal window
oidcdoctor mcp
oidcdoctor mcp --config /path/to/oidcdoctor.json

This is the command you put in your MCP client config:

{ "command": "npx", "args": ["-y", "oidcdoctor", "mcp"] }

Non-destructively write an oidcdoctor MCP entry into your agents’ config files, then print the paths that were written.

OptionMeaning
--agent <name>Target claude | cursor | all (default all).
--globalWrite to your home directory instead of the project.
Terminal window
npx oidcdoctor install # Claude Code + Cursor, project-local
npx oidcdoctor install --agent claude # Claude Code only
npx oidcdoctor install --global # home-dir config

Codex uses a TOML format not supported by install. The command prints the ~/.codex/config.toml snippet after writing so you can add it manually.

OptionMeaning
--config <path>Path to oidcdoctor.json (commands that read config).
-h, --helpPrint help.
-v, --versionPrint version.