@mcp-z/client
    Preparing search index...

    Class DcrAuthenticator

    DcrAuthenticator manages authentication for MCP HTTP servers Handles DCR registration, OAuth flows, and token management

    Index
    • Deletes both stored token families for a server, across every issuer they were bound to.

      Takes the same mcpServerUrl that DcrAuthenticator.ensureAuthenticated was given - keys are built from the configured URL, never from the discovered RFC 8707 resource, precisely so this can find them without doing discovery.

      Parameters

      • mcpServerUrl: string

      Returns Promise<void>

      CredentialBindingError if the configured store cannot enumerate keys.

    • Ensure server is authenticated, performing DCR and OAuth if needed Proactively refreshes tokens if they're within 5 minutes of expiry

      Parameters

      • mcpServerUrl: string

        The MCP server's canonical URL, exactly as configured, with its path intact (https://example.com/mcp). Not a deployment root: the path is what identifies the resource an issued token is bound to.

      • capabilities: AuthCapabilities

        Auth capabilities from .well-known endpoint

      • Optionalsignal: AbortSignal

      Returns Promise<TokenSet>

      Valid token set ready to use

      Error if authentication fails

      const authenticator = new DcrAuthenticator({ redirectUri: 'http://localhost:3000/callback' });
      const tokens = await authenticator.ensureAuthenticated(
      'https://example.com/mcp',
      capabilities
      );