# Registering an MCP client with CIMD in Auth0: a lab in five checks

> Hands-on lab: register an MCP client in Auth0 with a Client ID Metadata Document, and map each failure to the check that causes it, from 302 to 403 to 400.

- URL: https://iamops.dev/cimd-mcp-client-registration-auth0/
- Language: en
- Author: Argo
- Published: 2026-11-25
- Category: Labs
- Depth: Practitioner
- Audience: Engineers and operators
- Time: 30 min
- Topics: CIMD, MCP, Auth0, OAuth, Client registration, Lab

## TL;DR

- A client identifier (ID) metadata document (CIMD) is the whole registration: the [metadata document](https://iamops.dev/cimd-mcp-client-registration-auth0/#step-2-host-the-metadata-document) at its own web address (URL), with no registration call.
- Auth0 gives a [302 to login](https://iamops.dev/cimd-mcp-client-registration-auth0/#step-3-send-the-authorize-request) for a valid request, [403](https://iamops.dev/cimd-mcp-client-registration-auth0/#failure-cases) for a redirect address missing from the document, and [400](https://iamops.dev/cimd-mcp-client-registration-auth0/#failure-cases) for a missing or mismatched document.
- The full login and token exchange are still [open](https://iamops.dev/cimd-mcp-client-registration-auth0/#limits), so this lab proves the checks, not the whole sign-in.
- The server side of the same sign-in is in [the no-passthrough lab](https://iamops.dev/mcp-server-no-token-passthrough/), where the server refuses token passthrough.

**Audience: practitioner.** For identity engineers registering AI tool clients in Auth0 who need to map each failure to its cause.

A client <abbr title="identifier">ID</abbr> metadata document, called <abbr title="Client ID Metadata Documents">CIMD</abbr>, is a <abbr title="JavaScript Object Notation">JSON</abbr> file that an <abbr title="Open Authorization">OAuth</abbr> client publishes at its own <abbr title="web address">URL</abbr>. The URL becomes the client ID, so a Model Context Protocol (MCP) client needs no registration call before the first sign-in. Auth0 supports this in early access. I used a lab client hosted on GitHub Pages and probed the authorize endpoint on a development tenant.

What I wanted to know: does a wrong redirect address, a missing file and a wrong client ID each fail with a different status code, and can I tie each code to one rule in the document?

## Prerequisites

- An Auth0 tenant where you can change tenant settings. I used a development tenant.
- A host you control that serves JSON over Hypertext Transfer Protocol Secure (HTTPS). The lab document is public at `https://iamops-dev.github.io/lab-files/cimd/client/metadata.json`, served from the iamops.dev lab files repository. To use your own, host it anywhere that serves JSON over HTTPS and replace the address everywhere below.
- A token for the Management <abbr title="application programming interface">API</abbr>, with rights to change tenant settings, exported as `MGMT_TOKEN`.
- `curl` and `openssl` on the machine where you run the probes.
- No active Rules in the tenant. Auth0 fails CIMD login flows when Rules are active, so move them to Actions first.

Set the tenant domain once and keep it in your shell:

```
export AUTH0_DOMAIN=your-tenant.us.auth0.com
export CIMD_URL=https://iamops-dev.github.io/lab-files/cimd/client/metadata.json
```

## Step 1: Check the tenant

Ask the tenant whether it advertises CIMD support. The authorization server metadata is public, so no token is needed:

```
curl -s https://$AUTH0_DOMAIN/.well-known/openid-configuration | grep -o '"client_id_metadata_document_supported"[^,]*'
```

Expected result: `"client_id_metadata_document_supported":true`. On this tenant, the value is `true`.

![Terminal output: the discovery document of the Auth0 test tenant returns client_id_metadata_document_supported true.](https://iamops.dev/media/cimd-mcp-client-registration-auth0/01-discovery.webp)

*Step 1. The tenant advertises CIMD support. The tenant name is replaced by a placeholder.*

To turn the feature on, change the tenant settings. Dynamic registration needs the first flag, and the first flag cannot go off while the second is on:

```
curl -s -X PATCH https://$AUTH0_DOMAIN/api/v2/tenants/settings \
  -H "Authorization: Bearer $MGMT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"client_id_metadata_document_supported": true, "client_id_metadata_document_dynamic_registration_supported": true}'
```

The PATCH call is covered under [Limits](#limits). The discovery check above is the only result from this step.

## Step 2: Host the metadata document

The document must sit at the exact URL that is also its `client_id`. This is the lab document, as served by the lab files repository:

```
{
  "client_id": "https://iamops-dev.github.io/lab-files/cimd/client/metadata.json",
  "client_name": "iamops.dev CIMD lab client",
  "redirect_uris": ["http://localhost:8765/callback"],
  "grant_types": ["authorization_code"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none"
}
```

Three things here are the checks Auth0 applies. The `client_id` equals the address it came from. The `redirect_uris` list is the only set of callbacks Auth0 accepts. `token_endpoint_auth_method` is `none`, because a public client has no secret and relies on <abbr title="Proof Key for Code Exchange">PKCE</abbr> (Proof Key for Code Exchange) instead.

Confirm that the file is served as JSON with a 200 status:

```
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' "$CIMD_URL"
```

Expected result: `200 application/json; charset=utf-8`. The result matches.

![Terminal output: the lab metadata document answers 200 with the content type application/json.](https://iamops.dev/media/cimd-mcp-client-registration-auth0/02-document.webp)

*Step 2. The document comes back as JSON with status 200.*

## Step 3: Send the authorize request

Create a PKCE verifier and its S256 challenge:

```
VERIFIER=$(openssl rand -base64 64 | tr -d '=+/' | cut -c1-64)
CHALLENGE=$(printf '%s' "$VERIFIER" | openssl dgst -sha256 -binary | openssl base64 | tr '+/' '-_' | tr -d '=')
```

Send the authorize request with the metadata URL as `client_id`, URL-encoded, and without following the redirect:

```
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  "https://$AUTH0_DOMAIN/authorize?response_type=code&client_id=https%3A%2F%2Fiamops-dev.github.io%2Flab-files%2Fcimd%2Fclient%2Fmetadata.json&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Fcallback&code_challenge=$CHALLENGE&code_challenge_method=S256&state=lab1"
```

Expected result: `302` with a `Location` that points back at Auth0, to `/authorize/resume` with a `state` value. The result matches. The valid request passed every check: fetch, `client_id` match, redirect address match, and the PKCE fields.

What I saw: `302` to `/authorize/resume`. The tenant log (below) shows what Auth0 did with it: it created a dynamic client from the document and then stopped the login with `no connections enabled for the client`. So a `302` here means the document passed the checks, not that a user can sign in yet.

![Terminal output: the authorize request with the metadata document address as client ID returns 302 to the Auth0 resume endpoint.](https://iamops.dev/media/cimd-mcp-client-registration-auth0/03-authorize-valid.webp)

*Step 3. A valid request is accepted and sent on to /authorize/resume.*

![Sequence diagram: an MCP client authorizes with its metadata URL as client ID. Auth0 fetches the document, answers 403 when the redirect address is not listed, and answers 302 to login for a valid request.](https://iamops.dev/img/cimd-mcp-client-registration-auth0-flow.svg)

*One address, three checks. A valid request reaches login, a bad callback gets 403, and a bad document gets 400.*

![Sequence diagram: the MCP client calls Auth0 authorize with its metadata URL as client ID, Auth0 fetches the document from GitHub Pages and checks the client ID and redirect URI, then answers 302 to login, 403 or 400.](https://iamops.dev/img/cimd-mcp-client-registration-auth0-authorize-checks.svg)

*Three outcomes, one fetch. Auth0 downloads the document, compares it with the request, and answers with login, 403 or 400.*

## Step 4: Preview the document through the Management API

The preview call validates a document without creating a client. The request shape is:

```
curl -s -X POST https://$AUTH0_DOMAIN/api/v2/clients/cimd/preview \
  -H "Authorization: Bearer $MGMT_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"external_client_id\": \"$CIMD_URL\"}"
```

The response body is not saved, so it is listed under [Limits](#limits). Check the response for warnings before you go on, because Auth0 reports unsupported properties as warnings rather than errors.

## Failure cases

Each failure below changes one thing in the Step 3 request, so you can see which check fired.

![Terminal output: the valid request returns 302, a wrong redirect address returns 403 and a missing document returns 400.](https://iamops.dev/media/cimd-mcp-client-registration-auth0/04-failures.webp)

*Failure cases. One change per request, three different answers.*

1. **Redirect address not in the document.** Change `redirect_uri` to `http://localhost:9999/callback`. What you see: 403. Auth0 fetched the document, but the callback is not in `redirect_uris`, so it refuses the request. Auth0 checks this on every authorization request, not only at first registration.
2. **Document missing.** Point `client_id` at a path that does not exist, for example `.../client/missing.json`. What you see: 400. Auth0 could not fetch a valid document at the address, so there is nothing to trust.
3. **Client ID mismatch.** Serve a document whose `client_id` differs from its own address, or send a `client_id` for a different path. What you see: 400. The rule is that the document must name the address it was fetched from, so one client cannot borrow another client's metadata.

The Auth0 dashboard writes each probe to the tenant log, so the same three failures are visible there with their own wording:

![Auth0 dashboard, Monitoring, Logs: two Failed Login entries for an unknown client, two for a callback URL mismatch, two with no connections enabled for the client, and an API Operation entry that creates a dynamic CIMD client.](https://iamops.dev/media/cimd-mcp-client-registration-auth0/05-auth0-logs.webp)

*The tenant log. Cropped to the log table: the bad document paths and the bad callback fail with their own descriptions, and the valid request created a dynamic CIMD client.*

The three codes map to three different owners. A 403 is a policy answer about the callback. A 400 is a document problem, either missing or identity-mismatched. The fix for 403 is in the redirect list, and the fix for 400 is in hosting.

## Cleanup

The cleanup steps are listed under [Limits](#limits). When a manual or dynamic client exists, remove it through the Management API. To switch the feature off, turn the dynamic flag off first, then the support flag, because Auth0 rejects the reverse order:

```
curl -s -X PATCH https://$AUTH0_DOMAIN/api/v2/tenants/settings \
  -H "Authorization: Bearer $MGMT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"client_id_metadata_document_dynamic_registration_supported": false}'
```

Then send the second PATCH with `client_id_metadata_document_supported` set to `false`.

## Limits

- The settings PATCH in Step 1 is not run. The discovery check is the only result from that step.
- No connection is enabled for the dynamic client. The log shows `no connections enabled for the client`, so the login stops there.
- No full login or token exchange. The authorize request stops at the login redirect, and a sign-in needs a user in a browser. Without it, no code is issued and nothing is exchanged at `/oauth/token`.
- No preview response body. The call shape is valid, but the output was not saved, so any warnings are unknown.
- No Management API lookup of the resulting client by external client ID. The tenant log is the only record of it.
- No cleanup or tenant reset is run.

The next step is to run the login in a browser, complete the token exchange with the verifier, and then decode the access token to check the `client_id` claim. That is when the real registration appears in the tenant.

## Read next

The walkthrough for the same sign-in checks on the <abbr title="Model Context Protocol">MCP</abbr> server side is in [the no-passthrough lab](https://iamops.dev/mcp-server-no-token-passthrough/). The token rules for when a client calls a downstream API are in [the token exchange article](https://iamops.dev/oauth-token-exchange-delegation-impersonation/).

## Repeat this lab

You need an Auth0 tenant, a Management API token and curl. You probe the CIMD (client ID metadata document) checks with a lab client you host yourself and watch one change per request move the status code. About 30 minutes. Steps that I have not run yet are marked in the article.

Every value in angle brackets is a placeholder for your own test environment. Nothing on this page is a real identifier or secret.

**Set your variables once** `env.sh` (bash)

```bash
export AUTH0_DOMAIN='<TENANT>.us.auth0.com'   # your tenant domain
export MGMT_TOKEN='<MANAGEMENT_API_TOKEN>'   # token that may change tenant settings
export CIMD_URL='https://iamops-dev.github.io/lab-files/cimd/client/metadata.json'
```

### Step 1: Check that the tenant supports CIMD

**Goal.** Read the public discovery document and turn on the two CIMD tenant flags if the tenant does not advertise support yet.

**Prerequisites**

- An Auth0 tenant without active Rules
- curl

`discovery.sh` (bash)

```bash
curl -s https://$AUTH0_DOMAIN/.well-known/openid-configuration | grep -o '"client_id_metadata_document_supported"[^,]*'
```

`enable.sh` (bash)

```bash
curl -s -X PATCH https://$AUTH0_DOMAIN/api/v2/tenants/settings \
  -H "Authorization: Bearer $MGMT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"client_id_metadata_document_supported": true, "client_id_metadata_document_dynamic_registration_supported": true}'
```

**Expected output**

```text
"client_id_metadata_document_supported":true
```

### Step 2: Host and check the metadata document

**Goal.** Serve the client metadata document at the exact address that is also its client_id, and confirm it comes back as JSON with status 200.

**Prerequisites**

- A host you control that serves JSON over HTTPS, GitHub Pages works

`metadata.json` (json)

```json
{
  "client_id": "https://iamops-dev.github.io/lab-files/cimd/client/metadata.json",
  "client_name": "iamops.dev CIMD lab client",
  "redirect_uris": ["http://localhost:8765/callback"],
  "grant_types": ["authorization_code"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none"
}
```

`check-doc.sh` (bash)

```bash
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' "$CIMD_URL"
```

**Expected output**

```text
200 application/json; charset=utf-8
```

### Step 3: Send a valid authorize request

**Goal.** Create a PKCE verifier and challenge, then call /authorize with the metadata URL as client_id and read the status without following the redirect.

**Prerequisites**

- curl and openssl
- The three variables from the first step

`pkce.sh` (bash)

```bash
VERIFIER=$(openssl rand -base64 64 | tr -d '=+/' | cut -c1-64)
CHALLENGE=$(printf '%s' "$VERIFIER" | openssl dgst -sha256 -binary | openssl base64 | tr '+/' '-_' | tr -d '=')
REDIRECT='http%3A%2F%2Flocalhost%3A8765%2Fcallback'
```

`authorize.sh` (bash)

```bash
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  "https://$AUTH0_DOMAIN/authorize?response_type=code&client_id=https%3A%2F%2Fiamops-dev.github.io%2Flab-files%2Fcimd%2Fclient%2Fmetadata.json&redirect_uri=$REDIRECT&code_challenge=$CHALLENGE&code_challenge_method=S256&state=lab1"
```

**Expected output**

```text
302 https://<TENANT>.us.auth0.com/authorize/resume?state=<STATE>
```

### Step 4: Break one check at a time

**Goal.** Change one thing in the authorize request: a callback that is not in the document, a document path that does not exist, and a client_id for a different path. Compare the status codes.

**Prerequisites**

- The valid request from the previous step working

`bad-redirect.sh` (bash)

```bash
REDIRECT='http%3A%2F%2Flocalhost%3A9999%2Fcallback'
curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' \
  "https://$AUTH0_DOMAIN/authorize?response_type=code&client_id=https%3A%2F%2Fiamops-dev.github.io%2Flab-files%2Fcimd%2Fclient%2Fmetadata.json&redirect_uri=$REDIRECT&code_challenge=$CHALLENGE&code_challenge_method=S256&state=lab1"
```

`missing-document.sh` (bash)

```bash
curl -s -o /dev/null -w '%{http_code}\n' \
  "https://$AUTH0_DOMAIN/authorize?response_type=code&client_id=https%3A%2F%2Fyour-org.github.io%2Flab-cimd-client%2Fclient%2Fmissing.json&redirect_uri=http%3A%2F%2Flocalhost%3A8765%2Fcallback&code_challenge=$CHALLENGE&code_challenge_method=S256&state=lab1"
```

**Expected output**

```text
bad redirect address: 403
missing document: 400
client_id mismatch: 400
```

### Step 5: Clean up

**Goal.** Turn the CIMD tenant flags off again in the order Auth0 accepts: the dynamic registration flag first, then the support flag.

**Prerequisites**

- Only if you turned the flags on in this lab

`flags-off.sh` (bash)

```bash
curl -s -X PATCH https://$AUTH0_DOMAIN/api/v2/tenants/settings \
  -H "Authorization: Bearer $MGMT_TOKEN" -H "Content-Type: application/json" \
  -d '{"client_id_metadata_document_dynamic_registration_supported": false}'
curl -s -X PATCH https://$AUTH0_DOMAIN/api/v2/tenants/settings \
  -H "Authorization: Bearer $MGMT_TOKEN" -H "Content-Type: application/json" \
  -d '{"client_id_metadata_document_supported": false}'
```

**Expected output**

```text
Both PATCH calls answer 200 and the discovery check no longer shows true.
```


## Sources

- [Auth0 Blog, Registering MCP Clients with CIMD in Auth0 (23 Nov 2026)](https://auth0.com/blog/registering-mcp-clients-with-cimd-in-auth0/)
- [Internet Engineering Task Force (IETF), OAuth Client ID Metadata Document draft-03](https://datatracker.ietf.org/doc/html/draft-ietf-oauth-client-id-metadata-document-03)
- [Model Context Protocol, Authorization specification, client registration (2026-07-28)](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration)
- [Auth0 docs, CIMD validation rules](https://auth0.com/docs/get-started/auth0-overview/create-applications/cimd-validation-rules)

Discuss: [X](https://x.com/iamopsdev) | [LinkedIn](https://www.linkedin.com/company/iamops-dev/)
