Offensive weaponry (including small arms) makes a vessel a military combatant and subject to laws governing such vessels.
Nations may deny port access to combatants and there may be restrictions placed on the use of combatant vessels for the purposes of trade.
It is 100% political.
There is a fine line between what is an offensive weapon and what is not. Many captains keep a handgun in the payroll safe and this is often considered a defensive weapon (if anyone ever even knows about it). Vessels contracting to the US military and carrying their cargo often carry a number of small arms in the event that they are required to enter an internationally (that is, UN) declared warzone.
The horn of Africa is not considered a warzone, BTW.
The answer is that you certainly CAN carry as much weaponry and personnel as you want, but that might have detrimental effects on your ability to do business.