The State Dept. has a few ways you can go. If you have never had a passport, I'm not sure what you do.
But if you do already have a passport, you have two main options. One is a provisional change (don't quote me, but I think this requires renewal after two or three years) that reverts back to your original gender marker if you don't update it. The last time I looked, you needed a letter from a qualifying physician attesting to your in-progress transition
The permanent change is, well, permanent. The passport is treated as a regular passport; it needs renewing every ten years, and you never have to update your gender info again. This option requires medical documentation that you have transitioned.
There are other variables--do you need a name change?
Anyway, I suggest that you look at the Transgender Law Center's "ID Please" document. This organization focuses on California but contains info about federal stuff like how to change info with the SSS, the SSA, and the State Department. Here's the link:
http://transgenderlawcenter.org/issues/id/id-please.
Oh, and the last time I read this document, the pagination was all dorked up. Don't be surprised if you don't find what you want on the page it's supposed to be on.