Melanin is capable of transforming 99.9% of the absorbed sunlight energy into heat, reducing the risk of skin cancer. We here develop a melanin-mediated cancer immunotherapy strategy through a transdermal microneedle patch. B16F10 whole tumor lysate containing melanin is loaded into polymeric microneedles that allow sustained release of the lysate upon insertion into the skin. In combination with the near-infrared light irradiation, melanin in the patch mediates the generation of heat, which further promotes tumor-antigen uptake by dendritic cells, and leads to enhanced antitumor vaccination. We found that the spatiotemporal photoresponsive immunotherapy increases infiltration of polarized T cells and local cytokine release. These immunological effects increase the survival of mice after tumor challenge and elicited antitumor effects toward established primary tumor and distant tumor. Collectively, melanin generates local heat, boosts T cell activities by transdermal vaccines, and promotes antitumor immune responses.