Difficulties in stating mean value theorem for functions which are not continuous on a closed interval.
If you just consider continuity of $f(x)$ on $(a, b)$, then the limits at endpoints could be infinity or do not exist at all.
For example $f(x)= \tan (x)$ on $(-\pi /2, \pi /2)$.
In that case the statement of the theorem does not make sense as it stands.
Because in the particular cases you evoke, it is always possible to bring you back to that form of the theorem.
For example if $f$ has only a left limit in $a$, you would define the function $g$ as $$ g(x) := f(x)\quad \text{if} \quad x>a $$ and $$ g(a) := \lim_{x\rightarrow a^+}f(x) $$ Then you can apply the theorem to $g$.
But it will much more complicated to state all the particular cases in the hypothesis, with no real gain, since they can be easily deduced with simple procedures as above.
Let $f$ be a differentiable function on $(a,b)$. If the right side limit at $a$ and the left side limit at $b$ exist and are finite, then you can (uniquely) extend $f$ to a continuous function $\widetilde{f}$ on $[a,b]$ and apply the mean value theorem for $\widetilde{f}$ to get the desired result for $f$. But, in general, the side limits could be infinite, or they could not exist at all.