Never silent. In this word, it's non-syllabic. It's a prenasalised "g". Basically, if you isolate the "ng" sound of "sing" and pronounce it very briefly before saying "gapi", it should be just a light kind of humming attached to the beginning of the "g".
The m's that appear in the M-Wa and M-MI classes are syllabic and the N's and M's at the beginning of words in the N class that would otherwise only have one syllable (such as mbwa, nchi) are syllabic (and wherever they are the second last syllable, they of course take the stress). Syllabic M's and N's make up their own syllable and will be pronounced a little bit longer. For example mke "wife" is more or less like "Mmm, keh", with the "mmm" stressed.
With all that being said, I'm sure if you pronounce the non-syllabic M's and N's a little bit to long and give them their own syllables, that probably won't impede communication. Whether they're syllabic or non-syllabic isn't indicated in writing, after all. Dropping them completely, on the other hand, will sometimes lead to confusion. For example parachichi means "avocado (fruit)" while mparachichi means "avocado tree".
The word mbuzi (goat, N class) for example. If you pronounce it a bit like "mmm, boozey" that's probably better than just saying boozey — the best pronunciation is with a very short little bit of "m" kind of mixed into the beginning of the b in "boozey" (although not quite the same vowels as in English).