Will you spend your whole time in Ptown or do you want to explore other parts of the outer Cape? If you want to explore, you may want a car
How you reach the ferry ... Uber/Lyft/taxi is an option. So is subway. There are two ferries so subway options will vary based on which you choose. Both are reputable and similar in price. Choose the one that fits best timewise.
The two companies are Boston Harbor Cruises and Baystate Cruise company.
You can also fly from Logan to Ptown. Look at Cape Air
Silver Line from airport to WTC is free, you pay for the return trip (under S3 pp) and it runs frequently.
Take the Fast Ferry. Well worth the money to save yourself hours of precious vaca time. Cape traffic in the summer is miserable and not only would you have to drive TO the cape, you literally would also have to drive the entire length of the cape.
Cape Air might also be an option