While most insect-inspired robots come with a simple tarsus, such as a hemispherical foot tip, insect legs have complex tarsal structures and claws, which enable them to walk on complex terrain. Their sharp claws can smoothly attach and detach on plant surfaces by actuating a single muscle. Thus, installing an insect-inspired tarsus on legged robots would improve their locomotion on complex terrain. This paper shows that the tendon-driven ball–socket structure provides the tarsus with both flexibility and rigidity, which is necessary for the beetle to walk on a complex substrate such as a mesh surface. Disabling the tarsus’ rigidity by removing the socket and elastic membrane of a tarsal joint, means that the claws could not attach to the mesh securely. Meanwhile, the beetle struggled to draw the claws out of the substrate when we turned the tarsus rigid by tubing. We then developed a cable-driven bio-inspired tarsus structure to validate the function of the tarsus as well as to show its potential application in the legged robot. With the tarsus, the robotic leg was able to attach and retract smoothly from the mesh substrate when performing a walking cycle.