Medications for cluster headaches are used to treat headache episodes when they occur. These medications also have other uses, such as treating other types of headaches. They work by narrowing blood vessels around the brain and reducing inflammation. Common classes include ergot alkaloids, such as ergotamine (Ergomar) and dihydroergotamine mesylate (Migranal). Ergot alkaloids are available in several forms, including oral and injectable forms.