I wouldn’t bother with a cab. The “N Judah” streetcar/subway line runs right to the park. You can catch it at any of the major MUNI stations along Market St in downtown SF. They run every couple of minutes to/from the ballpark.
Several other bus lines will bring you either to the park or to Market St.