Anubis.Server.Transport.WellKnown (anubis_mcp v2.0.0)

Copy Markdown

Plug that serves the RFC 9728 OAuth Protected Resource metadata document at /.well-known/oauth-protected-resource.

Mount this plug at the root of your MCP server so the discovery endpoint is reachable even when the Streamable HTTP plug is mounted under a sub-path such as /mcp.

Usage

Within a Plug.Router:

forward "/.well-known/oauth-protected-resource",
  to: Anubis.Server.Transport.WellKnown,
  init_opts: [server: MyApp.MCPServer]

forward "/mcp", to: Anubis.Server.Transport.StreamableHTTP.Plug,
  init_opts: [server: MyApp.MCPServer]

Within Phoenix:

forward "/.well-known/oauth-protected-resource",
  Anubis.Server.Transport.WellKnown,
  server: MyApp.MCPServer

Returns 404 Not Found when the configured server has no authorization configured.

Summary

Types

opts()

@type opts() :: %{server: module()}