# Agent Composer MCP Access and Cognito OAuth

Composer can protect its official WordPress MCP Adapter endpoint with signed Amazon Cognito access tokens. Authorization is the least-privilege intersection of the role mapped from `cognito:groups`, the OAuth App Client's maximum role, the Composer scopes granted in the token, and the active Site Contract, Blueprint, ownership, validation, and approval rules.

**Open** preserves the backward-compatible WordPress-authenticated path. **Protected** validates a bearer token when present. **Protected Required** fails closed: Composer exposes no tools until its identity provider, group mappings, and allowed clients are complete, and every MCP request requires a valid token.

The MCP Access administration screen shows the effective AWS Region, User Pool ID, issuer, JWKS URL, configuration source, and readiness. Manual mode requires both Region and User Pool ID. Client secrets and private keys do not belong in Composer.

OAuth requires a Cognito User Pool domain and a dedicated public App Client using authorization code grant, PKCE S256, no client secret, and the exact HTTPS callback supplied by the MCP client. WP Suite orchestration v1.0.93 or newer can optionally create the Composer resource server and App Client for a new or existing pool and requires a generated or custom Cognito domain for a newly created pool.

Supported requested scopes are `openid`, `composer/read`, `composer/draft`, `composer/propose`, and `composer/publish.request`. Composer validates the signed access token, not an ID token. The signed `cognito:groups` claim is the group source; scopes do not manufacture membership. Legacy pools may additionally derive `sc.group.<group>` scopes.

Protected-resource metadata, OAuth authorization-server metadata, and the 401 `WWW-Authenticate` challenge must remain discoverable without an existing token. Discovery must work through direct HTTP and an OpenAI Secure MCP Tunnel HTTP profile targeting `/wp-json/mcp/smartcloud-agent-composer`. STDIO tunnels cannot forward the external challenge and bearer token.

A 401 indicates missing or invalid authentication, including issuer, client, expiry, signature, or token-use problems. A 403 means authentication succeeded but group mapping, client ceiling, scopes, ownership, role, or contract forbids the operation. Successful and denied calls appear in the tamper-evident audit log without full tokens, authorization headers, client secrets, request arguments, or tool results.
