The former Beatle explained that he will be "closing the opening" of the Games on July 27.
McCartney told BBC Radio 5 Live: "I've been booked".
Slumdog Millionnaire director Danny Boyle has been working as artistic director for the opening ceremony, titled 'Isles of Wonder'.
A 50-minute pre-show starts July 27 at 8.12pm (20.12) BST, with the ceremony kicking off properly at 9pm with the ringing of the bell.
Adele and Coldplay have been linked with the closing ceremony event on August 12.
Sir Paul McCartney also closed the Diamond Jubilee Concert outside Buckingham Palace last night (June 4).
The singer performed a medley of his biggest hits including 'Let it Be' and 'Live and Let Die'.
Photo gallery - Diamond Jubilee Concert: