MCP Server Facade Construct

AppTheoryMcpServer is the CDK deployment contract for the route-algebra MCP OAuth facade. Its primary mode attaches an ordered MCP route family to a caller-owned API Gateway v2 IHttpApi; omitting api creates the same surface on a standalone HttpApi. The construct routes traffic only. Go runtime/mcpfacade.RegisterMCPFacade owns runtime composition, and the application owns issuer, JWKS, scopes, capabilities, and authorize/token behavior through its explicit FacadeConfig.

This is the one path for both the four-pattern theory-mcp-server topology and a standalone specialization. It does not accept an origin or resource URL, does not inject OAuth metadata configuration, and does not rederive OAuth routes outside AppTheoryMcpRouteAlgebra.

Route families

A route family is an ordered patterns list. Each pattern must be a synthesis-time string whose segments are either RFC 3986 literal path segments or complete {parameter_name} segments. Parameter names start with a letter or underscore and continue with letters, digits, or underscores. Tokens, origins, relative paths, empty segments, ./.., mixed literal/parameter segments, greedy parameters, and duplicate patterns fail synthesis.

The default family is the contract’s ordered endpoint quartet:

const server = new AppTheoryMcpServer(this, "McpServer", {
  handler,
});
Kind Default MCP pattern
namespace /{client_namespace}/mcp
partner namespace /{client_namespace}/partners/{partner_id}/mcp
agent /{client_namespace}/agents/{agent_id}/mcp
partner agent /{client_namespace}/partners/{partner_id}/agents/{agent_id}/mcp

For every pattern, the construct calls AppTheoryMcpRouteAlgebra to derive and wire the exact runtime facade:

  • POST, GET, and DELETE on the MCP pattern;
  • GET on RFC 9728 protected-resource metadata;
  • GET on canonical and suffix-compatible RFC 8414 discovery;
  • GET on the application-owned authorize endpoint;
  • POST on the application-owned token endpoint.

routeInventory exposes the contract version and the ordered derived paths. Its shape intentionally matches the relevant fields of mcpfacade.RouteInventory. A shared fixture is asserted by both the Go helper tests and CDK synth tests, so dropping a pattern, transport method, or facade route fails the repository gates. Set routeFamily.rootAuthorizationServerDiscovery: true only when the runtime also supplies FacadeConfig.RootAuthorizationServer; both sides then install the algebra-derived root discovery route.

runtime/mcpfacade.RegisterMCPFacade serves exactly this canonical four-pattern family. A noncanonical routeFamily still uses the construct’s route algebra, but it is runtime-bring-your-own-registration: the application must register handlers for every entry in routeInventory and must not assume RegisterMCPFacade can be configured with those patterns. This boundary keeps the shipped helper and the deployed routes congruent instead of presenting a facade that returns 404 for every configured path.

Route model: explicit and consolidated

routeModel selects how the derived route inventory reaches API Gateway. The AppTheoryMcpRouteModel enum has two members and defaults to explicit:

  • explicit (default) wires one HTTP API v2 route per derived route key. This is the construct’s historical inventory and stays byte-stable, so a deployed stack upgrades in place with no change.
  • consolidated wires exactly two routes, ANY / and ANY /{proxy+}, backed by one shared integration. The AppTheory runtime router performs method and path dispatch, path-parameter capture, and denial instead of the gateway enumerating the derived inventory.
new AppTheoryMcpServer(this, "ConsolidatedMcp", {
  handler,
  transportPosture: AppTheoryMcpTransportPosture.RUNTIME_BEARER,
  runtimePosture: { requireBearerToken: true },
  originReachability: AppTheoryMcpOriginReachability.DISABLED,
  denialSignal: {},
  ownedApi: { stage: { throttlingEnabled: true }, domain: { domainName: "mcp.example.com", certificate } },
  routeModel: AppTheoryMcpRouteModel.CONSOLIDATED,
});

Consolidation never changes gateway admission, so it is valid only where every gateway route is NONE: the runtime-bearer and none-public postures. iam and jwt keep the explicit model and are refused at synthesis with AppTheoryMcpServer: routeModel consolidated is only valid for transportPosture RUNTIME_BEARER or NONE_PUBLIC; the message names the offending posture and the admission reason.

Consolidated mode is allowed on a construct-owned API, or on an attached API that has no routes at attach time. “no routes” is enforced over the whole stack rather than over the API’s own construct children: a route wired onto the attached API from a sibling construct scope — the common front-door shape, for example stack-level OAuthFacadeRoute0, OAuthFacadeRoute1, … constructs — holds a route key the greedy routes would collide with and is refused with AppTheoryMcpServer: routeModel consolidated may attach only to an API that has no routes at attach time followed by the offending construct paths. Attaching a consolidated server only inspects the API it attaches to, so a route on a different API in the same stack is unaffected.

A consumer may still add explicit, more specific routes to the consolidated API after the construct creates its greedy routes — in either the attached or the construct-owned mode — with a stricter authorizer: a full method+path match beats the greedy routes by API Gateway precedence, and a wrong-method hit on such a path falls to the runtime’s fail-closed 404/405. That exception is validated at synthesis and is allowed only when the added route carries a non-NONE authorizer and does not redeclare the greedy ANY / or ANY /{proxy+} route key. Either violation fails synthesis with AppTheoryMcpServer: a route added to a consolidated API after construction must carry a non-NONE authorizer or AppTheoryMcpServer: routeModel consolidated already owns the greedy API Gateway route key "ANY /{proxy+}".

routeModel changes only the API Gateway route resources. The runtime contract is unchanged: routeInventory, mcpPaths, protectedResourceMetadataPaths, and endpoints carry the same derived values in both models, the runtime still registers every entry in routeInventory, and the apptheory:mcp-transport-posture metadata route_count still records the MCP pattern count. The two consolidated routes use the semantic construct ids RouteAnyRoot and RouteAnyProxy rather than the explicit model’s positional Route0, Route1, … ids.

Both greedy routes share one integration, so scopePermissionToRoute (default true) grants two route-scoped invoke permissions, one per greedy route, instead of one permission per derived route key; scopePermissionToRoute: false keeps the single API-scoped permission. See the migration recipe in UPGRADING.md before moving a deployed server to the consolidated model.

Route identity: routeIdMode

On the explicit model, routeIdMode (AppTheoryMcpRouteIdMode) selects how construct ids are assigned. It defaults to legacy:

  • legacy (default) assigns positional ids in emission order — Route0, Route1, … — and is byte-stable for every deployed stack. A stack that does not set routeIdMode synthesizes byte-identically.
  • semantic derives each id from the route method and pattern, for example RoutePOSTClientNamespaceMcp for POST /{client_namespace}/mcp. Inserting, removing, or reordering a route family never renames an unrelated route, which is what lets an in-place update add or move a route without a create-before-delete route-key collision. Deriving a duplicate id fails synthesis.

semantic is intended for newly created explicit APIs. Switching an existing deployed explicit API from legacy to semantic in place renames every route in a single update, which is itself the create-before-delete collision the model exists to avoid; adopt it on an existing stack only through the new-API swap in UPGRADING.md. The consolidated model ignores routeIdMode: it always emits the fixed semantic ids RouteAnyRoot and RouteAnyProxy.

new AppTheoryMcpServer(this, "McpServer", {
  handler,
  ownedApi: { stage: { throttlingEnabled: true } },
  routeIdMode: AppTheoryMcpRouteIdMode.SEMANTIC,
});

The construct does not emit a synthesis warning on the default legacy mode: legacy is the documented byte-stable default for deployed stacks, so warning on it would fire for every existing consumer deploy, and the choice between legacy and semantic is a migration decision the recipe above already records.

Stage-global upstream callback

The upstream OAuth callback is installed once per deployment rather than once per MCP kind: the callback is correlated by the single-use upstream state the facade minted, so no per-kind callback multiplies. The construct wires one GET route for it, exposed as routeInventory.callbackPattern.

upstreamCallbackPath overrides the path. It must be a synthesis-time literal absolute path with no query, fragment, or dot segment, and it is normalized with the same rules as every other route path (/cb/ becomes /cb). An empty value keeps the contract default, AppTheoryMcpRouteAlgebra.DEFAULT_CALLBACK_PATH (/_oauth/mcp/callback); a token, a relative path, or a value that collides with another derived route fails synthesis.

new AppTheoryMcpServer(this, "McpServer", {
  handler,
  upstreamCallbackPath: "/_oauth/mcp/callback",
});

The construct resolves the prop through AppTheoryMcpRouteAlgebra.callbackPathForConfiguredPath, the same algebra the runtime applies to FacadeConfig.UpstreamCallbackPath in Go, TypeScript, and Python. Supplying the same value to the construct and to the runtime FacadeConfig keeps the CDK-mounted route and the runtime-registered route congruent instead of letting them diverge. transportPosture: none-public attaches no OAuth surface, so it refuses upstreamCallbackPath.

Attach mode and owned mode

Attach mode is for a shared front door. It adds HttpRoute resources to the supplied IHttpApi and creates no AWS::ApiGatewayV2::Api:

new AppTheoryMcpServer(this, "PublicMcpFacade", {
  handler: apiFunction,
  api: publicHttpApi,
  routeFamily: {
    patterns: AppTheoryMcpRouteAlgebra.supportedEndpointTemplates().map(
      (route) => route.mcpPattern,
    ),
    rootAuthorizationServerDiscovery: true,
  },
  // The shared front door already owns its stage posture.
  sessionState: { enabled: false },
});

The API owner owns its stage, logging, throttling, domain, CDN, and public authority. Therefore ownedApi, and the deprecated top-level apiName, domain, and stage props, are invalid with api; synthesis names every conflicting prop. This is the topology needed for a control plane such as theory-mcp-server, where MCP, OAuth, downloads, webhooks, and control-plane routes share one front door.

Attach-mode endpoint and endpoints values are execute-api origin templates, not declarations of that public authority. The construct derives their origin from api.apiId, the stack region, and the AWS URL suffix; it never consults an apiEndpoint supplied through HttpApi.fromHttpApiAttributes. Set attachedApiStageName when the intended stage is known so a non-$default stage such as prod appears in each template. If the stage is not supplied, the construct cannot determine it and retains the bare execute-api origin. This accessor behavior does not change the front door’s ownership of its public URL.

Owned mode is the standalone specialization. Omit api and optionally configure ownedApi:

new AppTheoryMcpServer(this, "StandaloneMcp", {
  handler,
  ownedApi: {
    apiName: "cloud-keeper-mcp",
    stage: { stageName: "live" },
  },
});

Only owned mode may create or configure a custom domain or stage. attachedApiStageName only identifies an existing attach-mode stage for endpoint-template derivation; it does not create, import, or mutate that stage. endpoints returns one execute-api or owned-domain template per family member; parameterized values remain templates until request time.

Transport posture

The full facade is wired by default, and the three MCP transport routes (POST, GET, and DELETE on every MCP pattern) require credentials. A plain transport server defaults to an IAM authorizer; attaching facade marks the server facade-configured and flips the default to runtime-bearer, where the gateway authorizer is NONE and the runtime validates RFC 9728 bearer tokens. A credential-free request is then rejected by API Gateway (IAM/JWT) or by the runtime before the application handler runs.

transportPosture selects the posture explicitly and overrides that default. The four values are iam, jwt (a static issuer and audience through transportAuthorizer), runtime-bearer (runtime-validated RFC 9728 bearer tokens), and none-public (deliberately public, never a default). jwt is the only posture that accepts transportAuthorizer; supplying it with iam, runtime-bearer, or none-public fails synthesis.

runtime-bearer and none-public carry a mandatory defense-in-depth floor and fail synthesis without it:

  • originReachability must be disabled, locked, or fronted; a directly reachable origin is refused unless it is declared fronted with a runtime-enforced front-door verification (see Fronted origins);
  • runtime-bearer requires runtimePosture: { requireBearerToken: true }, which asserts the runtime registers the transport routes with the runtime-validated bearer posture;
  • in owned mode the throttling decision must be explicit (ownedApi.stage.throttlingEnabled: true) and access logging must stay on; in attach mode owningApiDefense records the owning API’s access-logging and throttling decisions;
  • runtime-bearer also requires a denialSignal declaration naming the apptheory.mcp.auth_denied metric with the bounded outcome and route_family dimensions.

The origin decision is enforced, not asserted:

  • owned disabled requires an effective ordinary ownedApi.domain, emits DisableExecuteApiEndpoint: true, and advertises only https://<domain>/.... A later L1 re-enable of the default endpoint fails final synthesis.
  • owned locked additionally requires ownedApi.domain.mutualTlsAuthentication. Final synthesis proves every AWS::ApiGatewayV2::ApiMapping bound to the owned API targets an in-stack AWS::ApiGatewayV2::DomainName with MutualTlsAuthentication.TruststoreUri, and that the default endpoint stays disabled. LOCKED is an mTLS ingress model, not a DISABLED alias and not a CloudFront/VPC-origin assertion.
  • attach locked is unsupported. Attach disabled is accepted only on a same-stack concrete HttpApi whose emitted DisableExecuteApiEndpoint resolves to true; imported APIs fail. In attach mode endpoint/endpoints remain execute-api origin templates, not public-authority declarations.
  • Supplying ownedApi.domain.mutualTlsAuthentication without owned locked fails as contradictory.

Fronted origins (fronted)

fronted is the attach-mode posture for a topology the construct does not own: an application-owned HTTP API v2 whose execute-api hostname is the origin of a public front door (for example a CloudFront distribution), with the MCP server attached to that API. The construct sees neither the distribution nor the API’s endpoint configuration, so — unlike disabled and locked — it cannot produce in-stack evidence. fronted therefore accepts only an explicit, runtime-enforced declaration:

new AppTheoryMcpServer(this, "TmsMcp", {
  handler,
  api,                                     // the app-owned HTTP API the distribution fronts
  routeModel: AppTheoryMcpRouteModel.CONSOLIDATED,
  transportPosture: AppTheoryMcpTransportPosture.RUNTIME_BEARER,
  runtimePosture: { requireBearerToken: true },
  originReachability: AppTheoryMcpOriginReachability.FRONTED,
  frontDoorVerification: { headerName: FRONT_DOOR_HEADER, secretValue: FRONT_DOOR_SECRET, asserted: true },
  denialSignal: {},
  owningApiDefense: { accessLogging: true, throttling: { rateLimit: 50, burstLimit: 100 } },
});
  • frontDoorVerification is mandatory with fronted and refused under every other decision. headerName must be 1 to 64 characters of [A-Za-z0-9-] and a header the front door can set (reserved request headers, x-amz-*, x-amzn-*, and cloudfront-* names are refused); asserted must be true. Supply exactly one secret form: secretValue, the literal 32 to 128 characters of [A-Za-z0-9._~-], or secretParameterName, a well-known SSM parameter. fronted is refused in owned mode, where disabled or locked wires the front door.
  • The synthesized apptheory:mcp-transport-posture marker records, in addition to the transport posture, origin_reachability: "fronted" and front_door_header_name. The literal form adds front_door_secret_sha256 — a SHA-256 digest of the declared secret — and never emits the literal. The parameter form adds front_door_secret_source: "ssm-parameter" and front_door_secret_parameter_name and emits no digest, because the application holds no literal to digest. disabled and locked markers are unchanged.
  • Parameter form: no literal in source. secretParameterName names a well-known, stage-qualified Parameter Store parameter that the application’s installer creates if absent (see Namespace Install Parameters). The construct exposes frontDoorOriginHeader — { headerName, headerValue } — for the distribution origin the app owns:

    const origin = new origins.HttpOrigin(`${api.apiId}.execute-api.${stack.region}.${stack.urlSuffix}`, {
      customHeaders: {
        [server.frontDoorOriginHeader!.headerName]: server.frontDoorOriginHeader!.headerValue,
      },
    });
    

    Under the parameter form headerValue is ``, a CloudFormation dynamic reference, so the synthesized distribution carries the parameter name rather than the value. The parameter must be type String: AWS lists the resource properties that support ssm-secure exhaustively and AWS::CloudFront::Distribution is not among them, so a SecureString cannot feed the origin header. The value is defense-in-depth against direct origin access, not a confidentiality control — anyone who can read the parameter, or cloudfront:GetDistributionConfig, can read the header.

  • Rotation and propagation. CloudFormation resolves the reference at stack create/update time (latest version unless the reference pins one) and does not re-resolve it on drift detection, so updating the parameter alone does not move the distribution: perform a stack update. The runtime reads the same parameter lazily and refreshes on a verification mismatch or after its TTL, so the first request carrying the new value is admitted. The runtime image needs ssm:GetParameter on exactly that parameter ARN; the construct adds that grant to handler, plus kms:Decrypt when a secretParameterKmsKey is declared.
  • One constant, three copies. Because the distribution is app-owned, the declaration is only as good as its copies: the construct prop, the distribution’s origin custom-header configuration, and the runtime’s front-door verification config must agree. The construct proves its own copy only. An unwired fronted enforces nothing.
  • Enforcement lives in the runtime. mcpfacade.FacadeConfig (Go), registerMcpFacade (TypeScript), and register_mcp_facade (Python) take OriginReachability / originReachability / origin_reachability plus FrontDoorVerification / frontDoorVerification / front_door_verification. Registration fails closed when fronted is declared without the verification. Under it, every derived route — the MCP transport routes and the OAuth facade paths (protected-resource metadata, both discovery documents, authorize, token, register, and the upstream callback) — refuses a request whose declared header is absent or wrong with 403 app.forbidden before any credential work. A direct-origin request that bypasses the front door is therefore refused on every route. Under the parameter form a read failure, an empty value, or a value outside the documented alphabet refuses the same way; the route is never left open.
  • fronted is a defense-in-depth declaration with runtime enforcement. It is not mutual-TLS assurance (that is locked), it does not make the origin unreachable (that is disabled), and it cannot be proven by synthesis. The adoption-time proof is the receipted run: a request without the declared header is refused.

Discovery, protected-resource metadata, authorize, and token routes stay explicitly NONE so a supplied API’s default authorizer cannot intercept OAuth traffic: OAuth clients must fetch those documents before they hold a token. Scope policy and authorize/token behavior belong to the AppTheory runtime composition helper. Applications must call RegisterMCPFacade with non-empty per-kind scopes and an application-owned authorize/token handler pair. The helper fails closed if that pair is partial and does not install authorize/token runtime routes when both are absent.

none-public wires only the three MCP transport methods and no OAuth facade, and it cannot be combined with transportAuthorizer, root discovery, the deprecated issuer/JWKS props, upstreamCallbackPath, or runtimePosture. RegisterMCPFacade now registers the MCP transport routes with an authenticated posture by default and pairs its FacadeConfig.TransportPosture with FacadeConfig.RequireBearerToken, which validates RFC 9728 bearer tokens on those routes. Omitting runtime auth config is not an opt-out: the default CDK facade remains present and the runtime must initialize its explicit FacadeConfig successfully.

The synthesized template records the resolved posture as CloudFormation Metadata under apptheory:mcp-transport-posture (posture, contract_id, route_count, runtime_posture_declared) so a conformance kit can compare a deployed posture with the runtime registration output. A fronted decision adds origin_reachability, front_door_header_name, and front_door_secret_sha256; the other decisions keep the four-field marker unchanged.

The v3.1.x authorizationServerIssuer and jwksUri props are deprecated together. They remain pair-validated for migration safety but no longer control facade wiring and no longer become environment variables. Move them into mcpfacade.FacadeConfig.IssuerURL and .JWKSURI; scopes and capabilities move into the same app-owned struct.

Production defaults and opt-outs

Owned mode enables these defaults:

Surface Default Explicit opt-out
DynamoDB session state on; pay-per-request, AWS-managed encryption, PITR, TTL, retain removal policy sessionState: { enabled: false }
Access logging on; one-month retention ownedApi.stage.accessLogging: false
Stage throttling on; 100 requests/second, burst 200 ownedApi.stage.throttlingEnabled: false

Disabled surfaces reject their dependent options. For example, a disabled session table cannot also specify tableName, ttlMinutes, or removalPolicy; disabled throttling cannot specify rate or burst limits. Under runtime-bearer and none-public the access-logging and throttling opt-outs are refused outright: the owned stage must keep access logging and an explicit throttling decision. Attach mode still creates the session table by default, but logging and throttling belong to the supplied API’s owner. A shared front door must configure those controls on its own stage rather than asking an attached child construct to mutate them.

Runtime helper and environment contract

The construct and runtime/mcpfacade share routes, not configuration environment variables. FacadeConfig has no env reads. Issuer, JWKS, optional registration endpoint, URL mode, public base URL or hostname allowlist, per-kind scopes, capabilities, MCP handler, authorize/token factories, optional root discovery, the transport posture (FacadeConfig.TransportPosture paired with FacadeConfig.RequireBearerToken), and the direct-origin posture (FacadeConfig.OriginReachability paired with FacadeConfig.FrontDoorVerification) are app-owned values.

The construct writes only environment variables consumed by existing runtime code:

Variable When written Runtime consumer
MCP_SESSION_TABLE session state enabled runtime/mcp DynamoDB session store
MCP_SESSION_TTL_MINUTES session state enabled runtime/mcp session policy

MCP_ENDPOINT is retired in v6 in both directions: no construct writes it and no runtime reads it, so there is no shim. The bearer challenge is app-owned configuration — a route-derived ResourceMetadataURLFunc, the per-actor ResourceMetadataURLTemplate (TypeScript resourceMetadataURLTemplate, Python resource_metadata_url_template), or an explicit ResourceMetadataURL (precedence: resolver > template > static) — and with none configured the middleware advertises the bare Bearer challenge. AppTheoryRemoteMcpServer exposes the route-derived protectedResourceMetadataUrl (the RFC 9728 metadata URL template, with {actor} preserved when actorPath is enabled); pass it into your own app config and configure it as the template option so the middleware resolves {actor} from the matched route. The construct emits a synth warning on the per-actor route and injects no environment variable for this. AppTheoryMcpServer exposes its route-derived protected-resource paths through routeInventory and protectedResourceMetadataPaths. The construct still does not accept an origin prop — adding one would reintroduce the THE-2861 failure class.

The construct never writes the retired APPTHEORY_MCP_PATH, APPTHEORY_MCP_PROTECTED_RESOURCE_PATH, APPTHEORY_MCP_AUTHORIZATION_SERVER_ISSUER, or APPTHEORY_MCP_JWKS_URI variables.

v3.1.x A6 migration

The A6 shape is deprecated in place for the next minor. There is no parallel legacy construct and no major-version fork.

A6 surface Redesign fate
handler retained unchanged
mcpPath prop deprecated; use routeFamily.patterns
authorizationServerIssuer prop deprecated; move to FacadeConfig.IssuerURL
jwksUri prop deprecated; move to FacadeConfig.JWKSURI
apiName prop deprecated; use ownedApi.apiName
enableSessionTable prop deprecated; use sessionState.enabled; default flips from off to on
sessionTableName prop deprecated; use sessionState.tableName
sessionTtlMinutes prop deprecated; use sessionState.ttlMinutes
domain prop deprecated; use ownedApi.domain; invalid in attach mode
stage prop deprecated; use ownedApi.stage; invalid in attach mode
api accessor retained and generalized from HttpApi to IHttpApi
endpoint accessor deprecated; use ordered endpoints
mcpPath accessor deprecated; use ordered mcpPaths
protectedResourceMetadataPath accessor deprecated; use protectedResourceMetadataPaths or routeInventory
POST-only/no-facade default removed; full three-method OAuth facade is the default
session/logging/throttling off by default removed; production defaults are on
issuer/JWKS env injection removed; FacadeConfig is explicit app-owned configuration

AppTheoryMcpProtectedResource remains only for existing REST API stacks that intentionally synthesize a static metadata document. Its URL-valued props are deprecated and are not an alternate namespace deployment path.

REST v1 edge challenge restoration

An AWS API Gateway REST API v1 origin remaps the WWW-Authenticate response header onto x-amzn-remapped-www-authenticate, so the canonical RFC 9728 challenge an MCP transport route returns can be lost before the client sees it. AppTheoryRestV1ChallengeRestoration fronts a REST v1 execute-api origin with CloudFront, derives its route set from AppTheoryMcpRouteAlgebra (never a hand-written path list), and attaches an origin-response Lambda@Edge function that restores WWW-Authenticate from the AWS remap artifact — and, only when the optional alias bridge is enabled, from the x-theory-www-authenticate then mcp-www-authenticate spellings — then removes the consumed source headers.

The construct requires the DD-2 direct-origin decision: pass origin plus originReachability: AppTheoryRestV1OriginReachability.LOCKED (with originLock: { secret, asserted: true }, which injects the secret as a custom origin header and strips a viewer-supplied copy at the edge) or DISABLED (with disableExecuteApiEndpointAsserted: true). A directly reachable origin (direct) is refused at synthesis, because the REST API’s own execute-api endpoint is this distribution’s origin: a client that bypasses the distribution still reaches it and sees a challenge-less 401 (authentication still fails closed there, so it is challenge loss and edge bypass rather than an authentication bypass).

The LOCKED secret is a defense-in-depth layer, not a credential store. It is a literal CloudFront origin custom header value, so it appears verbatim in the synthesized template and in CloudFormation; the [A-Za-z0-9._~-]{32,128} alphabet structurally excludes a `` dynamic reference, so there is no Secrets Manager path and rotating it means changing the value and redeploying; and it must not be (or contain) a secret that protects anything else. Where a custom domain is acceptable, prefer DISABLED, which keeps no secret in the template.

The construct is additive otherwise, so a stack that does not use it synthesizes unchanged. It requires a stack with a resolved account and region, and it fails synthesis on a non-REST-v1 origin (the restoration is a documented no-op on HTTP API v2). See the AppTheoryRestV1ChallengeRestoration surface note in the CDK package README and UPGRADING.md, section “REST v1 edge WWW-Authenticate restoration”, for the source-set priority order, the origin-reachability options and the optional alias bridge.