Does the Grothendieck construction produce a 2-category or a category?

The usual Grothendieck construction has for $\mathcal C$ an ordinary category, so it doesn't have any 2-cells (or at least, doesn't have any non-identity 2-cells). Moreover, we actually get not only a category out of it, but an object of the slice (2-)category $\mathcal Cat/\mathcal C$. If $\mathcal C$ weren't an ordinary category, this wouldn't make as much sense since $\mathcal C$ wouldn't be an object of $\mathcal Cat$. (Just like how we can have functors $\mathcal C \to \mathcal Cat$, though, it's still possible to talk about functors from 1-categories to 2-categories).

Nonetheless, you can get a meaningful construction when adding in 2-cells. I have no idea if this construction has a name, but once you get the pattern, it's easy to extend this to any arbitrary level. For this construction, we'll assume we have a (lax) 2-functor $F : \mathcal C \to \mathcal Cat$.

0-cells of $\int F$ are pairs $(c, x)$ where $c$ is an object of $\mathcal C$ and $x$ is an object of $F(c)$.

1-cells $(c, x) \to (c', x')$ are pairs $(f, g)$ where $f : c \to c'$ and $g : x \to_f x'$. $x \to_f x'$ is the set of dependent morphisms from $x$ to $x'$ (terminology adapted from HoTT's dependent paths). Effectively, we use functorality in the types of $x$ and $x'$ to transport from one type to the other. In this case, the type of $x$ is $F(c)$ and the type of $x'$ is $F(c')$ so we can use $F(f)$ to map $x$ into the type of $x'$.

Summing up, $g$ should be a morphism $F(f)(x) \to x'$, i.e. an element of $\hom_{F(c')}(F(f)(x), x')$.

Next, our 2-cells $(f, g) \to (f', g')$ should be pairs $(\alpha, \beta)$ where $\alpha$ is a 2-cell $f \to f'$ in $\mathcal C$. $\beta$ should be a dependent morphism $g \to_\alpha g'$.

Now the types of $g$ and $g'$ are $\hom_{F(c')}(F(f)(x), x')$ and $\hom_{F(c')}(F(f')(x), x')$ respectively. This time, these type are contravariant in the variable we need to transport ($f$ and $f'$), so we'll transport $g'$ to $\hom_{F(c')}(F(f)(x), x')$ via $\hom_{F(c')}(F(\alpha)(x), x')$.

Unpacking this, $g'$ gets sent to $g' \circ F(\alpha)(x)$, so $\beta$ is a morphism $g' \circ F(\alpha)(x) \to g$. This time, though, we're talking about a morphism between morphisms in $F(c')$, which is an ordinary category. So rather than an actual morphism, we'll have an equality $g' \circ F(\alpha)(x) = g$.


It produces a functor between categories. In fact, what is called a fibred category. The construction is detailed in Volume 2 of Borceux's Handbook on Categorical Algebra.

Also Angelo Vistolis Notes on Grothendieck topologies, fibered categories and descent theory is worth looking at.