I know that there are some people who are close to Imam Mahdi (ajfs) and were able to communicate with him. Is it possible for a female servant of God to speak with the Imam (ajfs)?
Yes of course. Humble servants of Allah (SWT) can be males or females. Imam Al-Mahdi (AS) meets, guides and helps servants of Allah, where ever and when ever Allah wants him to help. Many sincere females were been blessed with this bounty in many places and times. Piousness degrees are never restricted to any gender.
Allah says in Quran : Whoever does good whether male or female while being true believer, We will grant them righteous life and will grant them reward for the best of they were doing. (Sura 16, verse 14).
Allah (SWT) Has sent revelation (Wahi وحي) on the mother of Musa (Sura 28, verse 7) because she was a Pious female.
Wassalam.