To be precise the two hypothesis you need for the mean value theorem to hold are:
1)The function f is continuous in the closed interval a,b
2)The function f is differentiable in the open interval a,b

Here's the proof:
Let k be (f(b)-f(a))/(b-a)
Consider the function defined as:
g(x)=f(x)-kx
Then it is easy to show that:
g(a)= (bf(a)-af(b))/(b-a) = g(b)
By Rolle's Theorem the derivative of g must vanish on the open interval a,b. Thus there must exist a point c such that
g'(c)=f'(c)-k = 0
At this point c:
f'(c)=k
Thats it. Q.E.D