Bone cancer pain (BCP) is one of the most common types of pain in cancer patients which compromises the patient’s functional status, quality of life, and survival. Central hyperalgesia has increasingly been identified as a crucial factor of BCP, especially in the medial prefrontal cortex (mPFC) which is the main cortical area involved in the process of pain and consequent negative emotion. To explore the genetic changes in the mPFC during BCP occurrence and find possible targets for prediction, we performed transcriptome sequencing of mPFC in the BCP rat model and found a total of 147 differentially expressed mRNAs (DEmRNAs). A protein-protein interaction (PPI) network revealed that the DEmRNAs mainly participate in the inflammatory response. Meanwhile, microglia and astrocytes were activated in the mPFC of BCP rats, further confirming the presence of neuroinflammation. In addition, Gene Ontology (GO) analysis showed that DEmRNAs in the mPFC are mainly involved in antigen processing, presentation of peptide antigen, and immune response, occurring in the MHC protein complex. Besides, the Kyoto Encyclopedia of Genes and Genomes (KEGG) analysis revealed that DEmRNAs are mainly enriched in the pathways of phagosome, staphylococcus aureus infection, and antigen processing, in which MHCII participate. Furthermore, immunostaining showed that MHCII is mainly located in the microglia. Microglia are believed to be involved in antigen processing, a key cause of BCP. In vivo, minocycline (MC) treatment inhibits the activation of microglia and reduces the expression of MHCII and proinflammatory cytokines, thereby alleviating BCP and pain-related anxiety. Taken together, our study identified differentially expressed genes in the BCP process and demonstrated that the activation of microglia participates in the inflammatory response and antigen process, which may contribute to BCP.