Abstract: A coupled LC-MS (liquid-phase chromatography and mass spectrometry) system consisting of a combination of a column of molecularly imprinted polymer (MIP) and a MS detector was used for affinitive separation and online identification of the antitumor components, harmine and harmaline, from the methanol extract of Peganum nigellastrum seeds. Three molecularly imprinted polymers were synthesized with porogens bearing different hydrogen bonding capacities with harman, the structural analogue of harmaline, and harmine as the template. The affinity and selectivity of the anti-harman MIPs for the targets, harmine and harmaline, were investigated chromatographically, and the influences of the porogens and sample loads on the retention of the target compounds were also discussed. In addition, the target binding capacities of the MIPs were evaluated by frontal chromatography. When the MIPs were further used in a LC-MS system to separate the extract of herb, it was observed that imprinting with different porogens would cause the MIPs to exhibit different tendencies to adsorb the matrix components from the herb. Though the MIP prepared with a porogen of less hydrogen bonding capacity possessed higher selectivity and stronger affinity for the targets, matrix components in the herb extract interfered with the chromatographic performance more seriously when it was used as the LC solid phase in the LC-MS system for selective extraction of harmaline and harmine from the crude herb extract. Positively, the MIPs were stable and reproducible in the separation test, and the imprinting columns could efficiently separate the antitumor components from the herb extract after the sample was simply pretreated. The work in this paper would be helpful for the further extraction and identification of certain pharmacophoric compounds in herbs by a LC-MS system using MIPs as the HPLC solid phase