Skip to main content

Introduction

CIMD (Client ID Metadata Documents) enables MCP clients to use HTTPS URLs as client identifiers. Instead of pre-registering clients with the authorization server, clients can host their metadata at a URL, and that URL becomes their client_id. This implements the draft-ietf-oauth-client-id-metadata-document-00 specification. This approach enables self-service client registration where clients can publish their own metadata without coordinating with the authorization server, verifiable client identity where the server can fetch and validate metadata from the URL, and decentralized trust where metadata is hosted by the client rather than stored centrally.

How It Works

Flow:
  1. Client sends OAuth request with client_id set to an HTTPS URL (e.g., https://example.com/oauth/client-metadata.json)
  2. Authorization server detects this is a CIMD URL and fetches the document
  3. Client’s server returns a JSON metadata document
  4. Authorization server validates the document (schema, client_id match, redirect_uri)
  5. OAuth flow continues with the verified client metadata
Key Insight: CIMD identifies the client application, not the user. The user’s identity still comes from the OAuth token. The access token is bound to both: issued for a specific user via a specific client.

Real-World Example: AI Agent Authorization

This example shows the complete flow when an AI Agent wants to use protected MCP tools.

The Scenario

  • AI Agent: Claude wants to create a GitHub issue
  • MCP Client: “Claude MCP Client” publishes metadata at https://mcpclient.ai/oauth/metadata.json
  • User: John (john@example.com) must approve the access
  • Protected Tool: create_issue in the github-app

Complete Authorization Flow

Three-Layer Identity Model

FrontMCP uses a three-layer identity model to separate concerns:

CIMD vs Standard OAuth

CIMD changes how clients are registered, not the OAuth flow itself. You still get an access token with user identity.

What Stays the Same

The core OAuth flow is identical:
  1. User authenticates
  2. User consents to permissions
  3. Token is issued with user identity and scopes
  4. Token is used to call protected tools

What Changes

Only the client identification step:
  • Standard: Server looks up client_id in its database
  • CIMD: Server fetches metadata from the client_id URL

Configuration

CIMD is configured through the auth.cimd option when creating a FrontMCP server. The CIMD service is automatically created and registered by the framework when orchestrated mode is enabled.

Basic Configuration

Full Configuration Options

CIMD is enabled by default when using orchestrated auth mode. The framework automatically creates and registers the CimdService internally, so you don’t need to instantiate it yourself.

Security Settings

Cache Settings

Network Settings

Client Metadata Document Format

The metadata document is a JSON file hosted at the client’s URL:

Required Fields

Optional Fields

Security Features

SSRF Protection

When security.blockPrivateIPs is enabled (default), the following addresses are blocked: IPv4 Blocked Ranges: IPv6 Blocked Ranges: Hostname Blocking:
  • localhost
  • localhost.localdomain
  • *.localhost

Domain Allow/Block Lists

Domain matching supports:
  • Exact match: example.com matches only example.com
  • Subdomain match: example.com also matches sub.example.com
  • Wildcard: *.example.com matches sub.example.com and example.com
Production Security: Always enable blockPrivateIPs in production. Consider using allowedDomains to restrict CIMD sources to known trusted domains for maximum security.

HTTP Caching

The CIMD service respects HTTP caching headers to minimize network requests.

Cache-Control Support

The Age header is subtracted from max-age if present.

Conditional Requests

When a cached entry has an ETag or Last-Modified header, the service sends conditional requests:
A 304 Not Modified response refreshes the cache TTL without re-downloading the document.

TTL Bounds

The computed TTL is always clamped to the configured bounds:

Error Handling

Error Classes

Understanding Error Responses

When CIMD validation fails during the OAuth flow, the authorization endpoint returns an error response. Here’s how to interpret and handle these errors on the client side:
For server-side error handling in custom flows or hooks, you can catch CIMD-specific error classes:

Troubleshooting

Symptoms: Authorization fails with “Invalid client_id URL” error.Common causes:
  • Using HTTP instead of HTTPS (CIMD requires HTTPS)
  • URL missing a path component
  • URL blocked by security policy (private IP, blocked domain)
Solutions:
  1. Ensure your client_id URL uses HTTPS
  2. Verify the URL has a path (e.g., /oauth/client.json)
  3. Check if your domain is blocked or not in the allow list
  4. Verify the URL is publicly accessible
Symptoms: Server cannot retrieve the client metadata document.Common causes:
  • Network timeout (document host too slow)
  • HTTP error (404, 500, etc.)
  • Response too large (exceeds 64KB default)
  • SSL/TLS certificate issues
Solutions:
  1. Verify the metadata URL is accessible via curl
  2. Check that the document is valid JSON
  3. Ensure the document is under 64KB
  4. Verify SSL certificate is valid and trusted
Symptoms: Authorization fails with “redirect_uri not registered” error.Common causes:
  • The redirect_uri parameter doesn’t exactly match any URI in the metadata document
  • Trailing slash differences
  • Port number differences
Solutions:
  1. Ensure the exact redirect_uri is listed in the redirect_uris array
  2. Check for trailing slash consistency
  3. Include both development (localhost) and production URIs in the document
Development Tip: Include http://localhost:8080/callback (or your local port) in redirect_uris during development. The warnOnLocalhostRedirects option will log a warning if only localhost URIs are configured, reminding you to add production URIs before deployment.

Next Steps

Local OAuth

Learn about local OAuth authentication for standalone MCP servers

Remote OAuth

Configure remote OAuth providers for enterprise authentication

Progressive Authorization

Enable incremental authorization for tool-by-tool access control

Production Checklist

Security best practices for deploying CIMD in production