We use the variational principle approach to derive the large $N$ holographic dictionary for two-dimensional $T\bar T$-deformed CFTs, for both signs of the deformation parameter. The resulting dual gravitational theory has mixed boundary conditions for the non-dynamical graviton; the boundary conditions for matter fields are undeformed. When the matter fields are turned off and the deformation parameter is negative, the mixed boundary conditions for the metric at infinity can be reinterpreted on-shell as Dirichlet boundary conditions at finite bulk radius, in agreement with a previous proposal by McGough, Mezei and Verlinde. The holographic stress tensor of the deformed CFT is fixed by the variational principle, and in pure gravity it coincides with the Brown-York stress tensor on the radial bulk slice with a particular cosmological constant counterterm contribution. In presence of matter fields, the connection between the mixed boundary conditions and the radial "bulk cutoff" is lost. Only the former correctly reproduce the energy of the bulk configuration, as expected from the fact that a universal formula for the deformed energy can only depend on the universal asymptotics of the bulk solution, rather than the details of its interior. The asymptotic symmetry group associated with the mixed boundary conditions consists of two commuting copies of a state-dependent Virasoro algebra, with the same central extension as in the original CFT.