From the documentation (WWW::Mechanize::Firefox::FAQ):
Do I Need An X Session To Run Firefox?
Yes.
If you run a unixish operating system, like OSX or Ubuntu or some
other Linux distribution, then Firefox will connect to your X server
and display a window there. If you do not want Firefox to actually
display on your monitor, many people have had success by running
Firefox on another X server separate from the main X server, like
Xvfb.
Personally, I would prefer to have a "headless Firefox" that does not
need a windowing environment. So far, I am unaware of this actually
existing.
So yes, you need to have an X session available.
Enable XForwarding, with ssh, so you can view the remote GUI desktop on your local machine. Then install Firefox via package management, then install MozRepel within Firefox. Once this is done ensure the MozRepel plugin is enabeled. Then use cpan to install the rest:
cpan WWW::Mechanize::Firefox