Mega Lucario doesn't have a lot of counters because it's Adaptability-boosted Close Combat and Iron Tail are so strong, especially under Swords Dance, but there are a select few.
Ghost types: Ghost types are by far the biggest counters to Mega-Lucario. They are immune to its best STAB and take little damage from its other moves. Ghost Arceus and Giratina cripple it with Will-O-Wisp, Mega Gengar traps and OHKOs Mega Lucario with Focus Blast, and Aegislash stops Mega Lucario cold by lowering its Attack with King's Shield.
Counters: Mega Gengar is the best counter to Ghost types, as it can easily trap and OHKO them (unfortunately you cannot use Mega Gengar). Powerful Dark types, most notably Darkrai, can easily dispatch Ghost types with their STAB moves.
Ho-Oh: Ho-Oh's resistances and good natural bulk allow it to take any of Lucario's attacks, and it can OHKO back with Sacred Fire.
Counters: Stealth Rock greatly reduces Ho-Oh' longevity and Stealth Rock damage actually puts it in range of being KOed by a boosted Close Combat. You could also run Stone Edge on Mega Lucario for a clean OHKO, but between two STAB moves, needed priority in Bullet Punch, and Swords Dance, you don't really have room for it.
Mewtwo: All Mewtwo forms can outspeed and OHKO Lucario if it has no Speed boosts with their various coverage. Mewtwo X is particularly good because it has the bulk to survive boosted Bullet Punches and an accurate, super effective STAB to KO Mega Lucario.
Counters: Mewtwo and Mewtwo Y can fall to boosted Bullet Punches with their average physical bulk. Bulky Ghost, Dark, Psychic and Dark types take relatively little from Mewtwo's attacks and can dent or KO in return. Paralyzing them allows Mega Lucario to outspeed.
Mega-Salamence: Mega Salamence can lower Mega Lucario's attack with Intimidate before Mega Evolving. More offensive variants can OHKO with Double Edge, while defensive variants can set up Dragon Dance and heal off damage with Roost.
Counters: Respective defensive Pokemon, including Tyranitar, Skarmory, Klefki, Lugia, Arceus Rock, and Groudon can take boosted Double Edges or Returns and either KO back or cripple it with status. Speaking of status, burning or paralyzing Mega Salamence severly cripples it.