People have already suggested hammers so I think I'll take an alternate tact.
Spears
Hammers are tremendous weapons for inflicting huge, crushing blows on enemies. Unfortunately, they are slow and unwieldy compared to many other melee weapons. What you can't hit you can't hurt, and the downside to swinging large masses around is that, given a miss, there is still a lot of momentum carrying on. If the goal is to limit the mobility of your opponent, spear weapons can make a lot of sense. Spears allow you to thrust quickly, to concentrate a huge amount of force on a very fine point, and to do so without over-extending yourself and opening up to a counter strike.
Tweaks for Mech Combat
Furthermore, a spear can be more than a spear. Depending on your rational for melee-exclusive combat, a spear can act as a delivery system for more advanced weaponry. A spear could pierce a Dunesque Holtzman-Effect shield and then deliver an explosive or plasma charge. A spear could pierce the electrical shielding on the outside of a mech in order to deliver a debilitating shock, a jet of conductive or acidic liquid, expanding foam, or hell even a computer virus (injecting code indeed).
These type of attacks would lend even more safety to spearfighting, as the strikes could be made with very little force, quick, darting jabs that are accurate and easy to retract.
Harpoon Style
Furthermore, it may be a good tactic to use a harpoon. With a classic Whaling Harpoon, you could stab your enemy with a weapon that would be difficult or impossible to remove. Thus, you could keep hold of the weapon and use it to pull the enemy off balance, or you could let it go and have its weight, damage, and overall unwieldiness hamper your enemy while you draw another spear to finish them off safely. With a hooked harpoon, you could disarm your enemy, catch then with the hook part and pull them off balance, or pull down their shield if they carry one.
Conclusion
Spears are simple, adaptable, and deadly weapons. They are easy to use and have a high skill ceiling. They allow your soldiers to maintain distance while in combat, keeping them safe. Mechs equipped with spears could even fight in formation. Hammers are great and all but they have very significant drawbacks; There is a reason why spears are the weapon of choice for infantrymen for most of human history.
if you have already established bipedal mechs these points may give you some modifications you can make or the next technological advancement in the story.
– BornToDoStuff Jan 08 '18 at 15:17