[36] Crook's capture added to the confusion as the army was reorganized for the spring campaign, and McKinley served on the staffs of four different generals over the next fifteen days—Crook, John D. Stevenson, Samuel S. Carroll, and Winfield S. Hancock.[36] Finally assigned to Carroll's staff again, McKinley acted as the general's first and only adjutant.[37]
Lee and his army surrendered to General Ulysses S. Grant a few days later, effectively ending the war. McKinley joined a Freemason lodge (later renamed after him) in Winchester, Virginia, before he and Carroll were transferred to Hancock's First Veterans Corps in Washington.[38] Just before the war's end, McKinley received his final promotion, a brevet commission as major.[39] In July, the Veterans Corps was mustered out of service, and McKinley and Carroll were relieved of their duties.[39] Carroll and Hancock encouraged McKinley to apply for a place in the peacetime army, but he declined and returned to Ohio the following month.[39]
McKinley, along with Samuel M. Taylor and James C. Howe, co-authored and published a twelve-volume work, Official Roster of the Soldiers of the State of Ohio in the War of the Rebellion, 1861–1866, published in 1886.