Class McpWellKnownRouting

java.lang.Object
org.apache.juneau.rest.server.mcp.v20260728.McpWellKnownRouting

public final class McpWellKnownRouting extends Object
Pure, side-effect-free construction of the RFC 9728 / SEP-2351 well-known Protected Resource Metadata (PRM) URIs for a given canonical resource identifier.

Per RFC 9728 §3.1 and SEP-2351, the well-known segment /.well-known/oauth-protected-resource is inserted between the host and the resource's path component:

  • Resource https://host/mcp → PRM at https://host/.well-known/oauth-protected-resource/mcp (path-insertion).
  • Resource https://host (no path) → PRM at https://host/.well-known/oauth-protected-resource (root form).

candidates(URI) returns the ordered client lookup sequence — the path-inserted URI first, then the root fallback — matching the ordered fallback SEP-2351 specifies. The server hosts the path-inserted form (and, for a rooted resource, that is the root form).

Since:
10.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The RFC 9728 well-known path segment.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<URI>
    candidates(URI resource)
    Returns the ordered PRM lookup candidates — the path-inserted URI first, then the root fallback (SEP-2351).
    static URI
    metadataUri(URI resource)
    Returns the path-inserted PRM URI for the supplied resource identifier (RFC 9728 §3.1).
    static URI
    rootMetadataUri(URI resource)
    Returns the root-form PRM URI for the supplied resource identifier — the ordered fallback location (SEP-2351).
    static String
    Returns the servlet-relative request path at which this server hosts its PRM document for the supplied resource identifier — i.e.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • metadataUri

      public static URI metadataUri(URI resource)
      Returns the path-inserted PRM URI for the supplied resource identifier (RFC 9728 §3.1).
      Parameters:
      resource - The canonical resource identifier. Must not be null and must be absolute (scheme + authority).
      Returns:
      The PRM document URI.
      Throws:
      IllegalArgumentException - If resource is null or is missing a scheme/authority.
    • rootMetadataUri

      public static URI rootMetadataUri(URI resource)
      Returns the root-form PRM URI for the supplied resource identifier — the ordered fallback location (SEP-2351).
      Parameters:
      resource - The canonical resource identifier. Must not be null and must be absolute (scheme + authority).
      Returns:
      The root PRM document URI.
      Throws:
      IllegalArgumentException - If resource is null or is missing a scheme/authority.
    • candidates

      public static List<URI> candidates(URI resource)
      Returns the ordered PRM lookup candidates — the path-inserted URI first, then the root fallback (SEP-2351).

      When the resource has no path component the two coincide and a single-element list is returned.

      Parameters:
      resource - The canonical resource identifier. Must not be null and must be absolute (scheme + authority).
      Returns:
      The ordered candidate list (1 or 2 entries). Never null.
      Throws:
      IllegalArgumentException - If resource is null or is missing a scheme/authority.
    • wellKnownRequestPath

      public static String wellKnownRequestPath(URI resource)
      Returns the servlet-relative request path at which this server hosts its PRM document for the supplied resource identifier — i.e. metadataUri(URI)'s path component.
      Parameters:
      resource - The canonical resource identifier. Must not be null.
      Returns:
      The request path (e.g. /.well-known/oauth-protected-resource/mcp).
      Throws:
      IllegalArgumentException - If resource is null.