I'd skip the multiple back and forths to Yosemite. Just hike the JMT from Mammoth to Yosemite and take the bus back.
You'll need a Half Dome pass and they may not be able to give it to you in Mammoth. Here is a link to the Half Dome permit details for backpackers http://www.nps.gov/yose/planyourvisit/hdwildpermits.htm .
Contact them, maybe they will let you pick up a Half Dome pass in the Wilderness Center in Tuolomne as you pass through there.
Tuolomne Meadows has a backpackers campground you can stay at as you pass through, $5 per person per night. Early July there will be PCT thru hikers, fellow JMTers, Bay Area folks, and even a few UL backpackers in this campground.
There is a store in Tuolomne to buy resupply items as well as beer and ice- cream, a grill for a juicy hamburger and a post-office in case you prefer to mail a resupply.
The backpackers campground in Yosemite Valley is $5 per person, you can use it one night before and one night after your trip with a wilderness permit, no reservations needed or taken.
There is a pool and showers in Curry Village, $5 per person, use of towels included. Same at Yosemite Lodge I believe.
Free shuttle bus runs frequently in a loop to trail heads, store, etc, no need for a car in Yosemite Valley.
There is a bus ($20 fee?) up to Glacier Point. Hike back down or take the bus back.