The mechanical spider is a small automaton made by Hephaestus.
Percy Jackson and the Olympians
The Lightning Thief
Percy Jackson and Annabeth Chase go on the Thrill Ride O' Love in Waterland to retrieve Ares' Shield. A trap was set by Hephaestus which involved mechanical spiders. Percy and Annabeth had to go through the tunnel in order to escape them. Annabeth, as a daughter of Athena, is naturally afraid of spiders because of her mother and her grudge toward Arachne.
The Battle of the Labyrinth
Eurytion gives Percy, Annabeth, Tyson, and Grover a mechanical spider so they can find Hephaestus. Hephaestus had given this spider to Eurytion as a favor as he had helped him pull a prank on Ares and Aphrodite. The spider was in the form of a medal with a depression in the center. When the depression was pressed, it changed into a spider. This particular mechanical spider could shoot metal web fiber to swing across bars.