District heating and cooling systems incorporating heat recovery and large-scale thermal storage dramatically reduce energy waste and greenhouse gas emissions. Electrifying district energy systems also has the effect of introducing city-scale controllable loads at the level of the electrical substation. Here we explore the opportunity for these systems to provide energy services to the grid through capacity-based demand response mechanisms. We present both a planning approach to estimate available demand-side capacity and a control framework to guide real-time scheduling when the program is active. These tools are used to assess the technical feasibility and the economic viability of participating in capacity-based demand response in the context of a real-world, megawatt-scale pilot during the summer of 2018 on the Stanford University campus.