Purpose: To develop a real‐time (while the patient is being irradiated) tumour tracking and dose adaptation algorithm that can operate within a novel Linear accelerator‐Magnetic Resonance imaging (Linac‐MR) system. Current emphasis is given to lung tumour, which shows the most extensive and abrupt motion. Method and Materials: The auto‐contouring algorithm to automatically identify the shape of the tumour from each MR image is comprised of an autocorrelation technique for image matching, and Histogram Shifting (HS) algorithm for edge detection. A MR compatible motion phantom was built to simulate the motion of tumours (ex: lung tumours) and to perform various dosimetric measurements. The 4D MR images of this phantom and volunteers were used to evaluate the auto‐contouring algorithm. To conform the radiation beam, a Multi‐Leaf Collimator (MLC) controller is being developed using Field Programmable Gate Array (FPGA) based electronics. To compensate for the time delay between MR imaging and irradiating instances, a motion prediction algorithm was developed using a Kalman filter. Results: The auto‐contouring algorithm showed successful tumour tracking and contouring capabilities in the 4D MR images of thoracic region and phantom. The motion prediction algorithm was evaluated by using a modified cosine model, motion phantoms, and fluoroscopic patient data. In most cases, the algorithm predicted the position of tumour correctly more than 95% of the total treatment time. The FPGA based electronics demonstrated its real‐time MLC controlling capability. Various 1‐D lung tumour motions were simulated by the MR motion phantom, which was used to evaluate our algorithms. Conclusion: This work indicates the potential of Linac‐MR system for (1) auto‐contouring capability of tumours in real‐time MR image (more than 4 frames per second) (2) radiation beam conformity to the shape of tumours (3) accurate tumour tracking ability by developing motion prediction algorithm (4) beam intensity modification.