I want to save my niece

I'm going to try to explain this clearly as possible. My sister was forced into rehab by court. She is away for 30 days. Her daughter is living with her dad in a tent at his own father's house because they were evicted for cat pee. They already have a DCF case open but the worker isn't doing anything. The police were the ones who called the board of health about the cat pee when the DCF worker saw it the whole time and said nothing. My sister does drugs and her ex isn't a fit parent. He may be dabbling in pills, and his priorities are not right. Here is the problem. I live in a different state. How can I get custody of her against his will? Help. They live in MA