Serves the /.well-known/oauth-protected-resource discovery document
(RFC 9728) so OAuth-aware MCP clients — such as claude.ai custom
connectors — can discover the authorization server for this endpoint.
Configuration
config :ectomancer, :oauth_protected_resource, %{
"resource" => "https://your-app.com/mcp",
"authorization_servers" => [
"https://auth.your-app.com"
],
"scopes_supported" => ["mcp"]
}Router integration
get "/.well-known/oauth-protected-resource",
Ectomancer.Plug.OAuthProtectedResource,
[]Without configuration the plug returns 404.
When both this plug and WWW-Authenticate challenges are wanted, also set:
config :ectomancer, :oauth,
resource_metadata_url: "https://your-app.com/.well-known/oauth-protected-resource"
Summary
Functions
Sends the configured :oauth_protected_resource metadata as JSON with
status 200, or a JSON 404 when no metadata is configured.
Returns the plug options unchanged.
Functions
@spec call(Plug.Conn.t(), Plug.opts()) :: Plug.Conn.t()
Sends the configured :oauth_protected_resource metadata as JSON with
status 200, or a JSON 404 when no metadata is configured.
Returns the plug options unchanged.