Trump was fully within his rights to fire Comey, and has the constitutional right to fire Mueller if he wants to.
President Trump Is Actually Allowed to Have Robert Mueller Fired, According to the Constitution
http://time.com/4837851/donald-trump-mueller-fire-power/
Alan Dershowitz: Trump did not obstruct justice in firing James Comey
http://www.washingtonexaminer.com/alan-dershowitz-trump-did-not-obstruct-justice-in-firing-james-comey/article/2622875