Skip to main content
The OAuth Conformance SDK classes let you run the same flows the CLI oauth conformance command runs, but programmatically — for custom reporters, test frameworks, recording/replay via custom fetchFn, or Playwright-driven consent via openUrl.
For CLI usage (one-liners, CI recipes, troubleshooting), see CLI: OAuth Conformance. This page covers the TypeScript SDK only.

Import


Single flow

OAuthConformanceConfig

OAuthConformanceAuthConfig

  • interactive.openUrl — override how the consent URL is opened. Default launches the system browser. Use for Playwright, custom launchers, or logging the URL.

OAuthConformanceClientConfig

OAuthVerificationConfig


SDK-only features

These are available in the SDK but not exposed as CLI flags.

Custom fetch (fetchFn)

Swap in a recording, mocking, or proxying fetch implementation:

DCR metadata overrides (dynamicRegistration)

Customize the client metadata sent during Dynamic Client Registration:

Negative conformance checks (oauthConformanceChecks)

When enabled, six extra checks run after a successful flow:
  1. DCR redirect URI policy — attempts dynamic client registration with a non-loopback http:// redirect URI; expects rejection under the MCP authorization profile.
  2. Invalid client — sends a token request with an unknown client_id; expects rejection.
  3. Invalid redirect at the authorization endpoint — sends an authorization request with a mismatched redirect_uri and looks for rejection before the server redirects back to it. This step may be skipped if the server defers validation behind user interaction.
  4. Invalid token — sends an authenticated MCP initialize request with an obviously invalid bearer token; expects HTTP 401 from the MCP server.
  5. Invalid redirect at the token endpoint — sends a token request with a mismatched redirect_uri to look for redirect exact-match enforcement. This step may be skipped if the request is rejected for another reason before redirect validation is demonstrated.
  6. Token format — validates the token response includes access_token, token_type, and expiration metadata.
oauthConformanceChecks is also available via the CLI’s --conformance-checks flag.

Suite


Result types

ConformanceResult

StepResult

VerificationResult

OAuthConformanceSuiteResult