01 - Preheat your oven to 375°F (190°C). Lightly grease a 9x13 inch baking dish.
02 - Cook the ziti or penne pasta in generously salted boiling water until it is just al dente. Drain thoroughly and set aside.
03 - While the pasta is cooking, heat the olive oil in a large skillet over medium heat. Add the diced onion and sauté for 3 to 4 minutes until it becomes translucent. Stir in the minced garlic and cook for an additional minute until fragrant.
04 - Incorporate the diced green chilies, cumin, oregano, chili powder, salt, black pepper, and cayenne pepper (if using) into the skillet. Cook for 1 minute, stirring, until the spices are fragrant.
05 - Add the shredded cooked chicken and both the cannellini and great northern beans to the skillet. Stir everything together to combine.
06 - Add the cubed cream cheese, sour cream, and chicken broth to the skillet. Stir continuously over medium heat for about 3 to 4 minutes, or until the cream cheese has completely melted and the sauce is smooth. Taste and adjust seasonings as needed.
07 - Gently add the cooked pasta to the skillet containing the sauce. Toss until the pasta is evenly coated.
08 - Spread half of the pasta mixture into the prepared baking dish. Sprinkle this layer evenly with half of the mozzarella and Monterey Jack cheeses. Then, evenly distribute the remaining pasta mixture over the cheese, and top with the rest of the shredded cheeses.
09 - Place the baking dish in the preheated oven and bake uncovered for 20 to 25 minutes, or until the cheese is fully melted and the sauce is bubbling and golden.
10 - Remove the dish from the oven and allow it to rest for 5 minutes before serving. Garnish with fresh cilantro and sliced green onions, if desired. Serve warm.