A spokesman for the Islamist al-Shabab group, Abdulaziz Abu Musab, told the BBC that she was targeted for her politics and not her music.
The BBC’s Mohammed Moalimu in Mogadishu says she is the fourth MP to be killed this year.
The al-Qaeda-aligned al-Shabab group advocates the strict Saudi-inspired Wahhabi version of Islam and is battling the UN-backed government to create an Islamic state.
Ms Warsame rose to fame during the time of former President Siad Barre, who was overthrown in 1991, with her songs which were critical of his rule.
The song that made her famous was called Land Cruiser in which she said Mr Barre and his officials were buying expensive cars and then asking for aid to feed starving people.
She spent much of the civil war in the US and returned home in 2012 to represent her clan in the new Somali parliament.
BBC Somali Service’s Abdullahi Abdi says Ms Warsame will be remembered most for her daring musical career.
She was one of the few Somali female musicians to go on stage without covering her head and she sometimes wore trousers, which is highly unusual for women in Somalia, he says.
The singer song-writer continued to perform even after taking up her position in parliament.
UN envoy Nicholas Kay condemned the assassination and said Ms Warsame’s loss would be felt across Somalia.
Prime Minister Abdiweli Sheikh Ahmed said that the she had “not only worked tirelessly in the political arena of Somalia, she was also embedded in Somali culture as a gifted artist.
“Her work as a committed patriot will never be forgotten,” he said in a statement.
Somalia has been a largely lawless state since the fall of Mr Barre, with warlords, religious groups and clans fighting for control of the country.
But since al-Shabab lost control of Mogadishu in 2011, some Somalis in the diaspora have started to return home to start businesses and take up political positions.
The militants have continued to carry out attacks in Mogadishu – and attacked the parliament building and presidential palace this month.
Some 22,000 African Union troops are helping the government to try and win back territory from the group.
They have taken back several key cities over the last three years, but al-Shabab still controls many smaller towns and rural areas of the country where it has imposed Sharia and banned music which it regards as un-Islamic.