The attack killed at least 14 people and injured 11 others, according to Mandera County Commissioner Alex Nkoyo.
The compound housed primarily quarry workers.
The attack began around 1 a.m. when a group of men using a variety of weapons attacked the compound, Nkoyo told CNN.
The commissioner said an explosive device -- something other than a hand grenade -- was used to blow open a gate to the compound. The attackers then entered and started shooting.
Many people were sleeping outside to escape the heat. When the attack began, those who were able to do so ran inside the houses, followed by the gunmen, Nkoyo said.
Attackers disappeared into the bush
Those killed were local laborers and workers from other parts of Kenya, he said. A woman, identified as the landlady of the compound, was also among the dead, he said.
Judging by the number of bullets at the attack site, Nkoyo said, the estimated number of attackers was 10 to 15, with more as backup.
The commissioner said local security forces responded within 10 minutes, and as their vehicles approached, the attackers dispersed into the bush and surrounding villages. Some may have crossed the border into Somalia, he said.
Mandera County borders Somalia and Ethiopia.
Nkoyo said Mandera has been under heightened security since attacks there last year on a bus that killed at least 28 people and on a quarry, where 36 people were killed.
Al-Shabaab's military operations spokesman, Sheikh Abdiaziz Abu Musab, said Tuesday's attack had killed more than a dozen people whom he described as Kenyan Christians.
Al-Shabaab is an Islamic terrorist group that operates primarily in Somalia.
The attack was part of Al-Shabaab's Ramadan offensive against Kenya, said the spokesman, speaking on Al-Shabaab's main broadcaster, Radio Andalus.