AttestoMCP.Server.Phoenix (attesto_mcp_server v0.14.0)

Copy Markdown View Source

Narrow integration helpers for Phoenix hosts.

attesto_mcp_server remains the protected resource and does not mount or configure an authorization server. When a host already uses attesto_phoenix, attesto_config/1 derives the core Attesto.Config from that package's validated application configuration, while protected_resource_options/1 also derives its runtime DPoP and mTLS callbacks, access-token revocation check, and principal loader. Neither helper introduces a hard dependency in this package.

Summary

Functions

Derives an Attesto verifier configuration from an installed attesto_phoenix host.

Derives the complete protected-resource authentication options from an installed attesto_phoenix host.

Functions

attesto_config(otp_app)

@spec attesto_config(atom()) :: term()

Derives an Attesto verifier configuration from an installed attesto_phoenix host.

The host must configure AttestoPhoenix.Config under otp_app. This helper fails closed when the optional package or its supported configuration API is unavailable.

protected_resource_options(otp_app)

@spec protected_resource_options(atom()) :: keyword()

Derives the complete protected-resource authentication options from an installed attesto_phoenix host.

The returned keyword contains the core Attesto.Config plus the runtime DPoP replay, nonce, canonical-URL, and mTLS certificate callbacks enabled by the host's validated AttestoPhoenix.Config. Its principal callback checks the access-token jti through the host's revocation store before resolving the verified subject through load_principal. Resolve it at request time: the adapter callbacks close over the current validated configuration and must not be baked into a compiled Phoenix router.

This helper fails closed when the optional package or its supported public configuration/adapter API is unavailable.