Consider the following category $\mathcal C$:

- An object of $\mathcal C$ is a pair $(X,\mathcal F)$ where $X$ is a space and $\mathcal F$ is a sheaf on $X$.
- A morphism $(X,\mathcal F)\to(Y,\mathcal G)$ is a map of spaces $f:X\to Y$ together with a map of sheaves $f^*\mathcal G\to\mathcal F$ (equivalently $\mathcal G\to f_*\mathcal F$).

The words 'space' and 'sheaf' above can be taken in a number of senses: topological spaces and all sheaves, schemes and coherent sheaves, complex analytic spaces and coherent sheaves, etc. My question is somewhat general, and I will leave it up to the reader which context they wish to work in.

Cohomology $H^*$ is a functor from $\mathcal C$ to the category of graded abelian groups, however we can say more. Namely, let $W$ denote the class of morphisms $(X,\mathcal F)\to(Y,\mathcal G)$ in $\mathcal C$ for which $\mathcal G\xrightarrow\sim f_*\mathcal F\xrightarrow\sim Rf_*\mathcal F$ are both isomorphisms. It follows by the Leray spectral sequence that $H^*$ sends morphisms in $W$ to isomorphisms. The functor $H^*:\mathcal C\to\operatorname{AbGrp}$ thus factors through the localization $\mathcal C\to\mathcal C[W^{-1}]$ (note though that we have not argued that this localization exists).

The above suggests that cohomology makes sense not only for objects of $\mathcal C$ but also for what we might get by gluing together various objects of $\mathcal C$ along morphisms in $W$. For instance, take two objects $(X_1,\mathcal F_1),(X_2,\mathcal F_2)\in\mathcal C$. We could glue these together along a common open subset $(U_1,\mathcal F_1|_{U_1})\xrightarrow\sim(U_2,\mathcal F_2|_{U_2})$ to obtain another object of $\mathcal C$. On the other hand, we should also be able to, at least formally speaking, glue together along any morphism $(U_1,\mathcal F_1|_{U_1})\xrightarrow\sim(U_2,\mathcal F_2|_{U_2})$ in $W$ and obtain some sort of generalized object (though not an object of $\mathcal C$) to which it still makes sense to apply the functor $H^*$.

I can imagine various ways of making the above discussion precise (i.e. making sense out of "objects of $\mathcal C$ glued together along morphisms in $W$"), however they all suffer from the following deficiency: there is no simple way to describe morphisms between two such objects. This is similar to how a topological groupoid presents a stack, but given two topological groupoids it is somewhat cumbersome to describe, purely in terms of topological groupoids, the space of morphisms between the associated stacks. The notion of a stack solves this issue (of describing morphism spaces) beautifully: a morphism of stacks (on a site $\mathcal D$) is just a natural transformation of functors $\mathcal D\to\operatorname{Groupoids}$. I can finally form my question:

How can we form a category whose objects are "generalized objects" of $\mathcal C$ (i.e. gluings of objects of $\mathcal C$ along morphisms in $W$) and whose morphisms admit some sort of simple description?