Yasir, who has taken 149 wickets in 26 Tests, has most recently been playing for Kent in the County Championship and joins fellow Pakistan international Misbah-ul-Haq in facing Afghanistan in a 50 overs per side match.
Lord's owners MCC will be captained by former New Zealand skipper Brendon McCullum.
Their team also features West Indies great Shivnarine Chanderpaul and Sri Lanka star Kumar Sangakkara.
McCullum is currently playing for Lord's-based Middlesex in English county cricket's Twenty20 Blast.
MCC's side also includes England all-rounder Samit Patel and former England wicket-keeper Chris Read, both of whom recently tasted victory at Lord's with the Nottinghamshire side that won the One-Day Cup.
Afghanistan, recently awarded Test status, can include spinner Rashid Khan and all-rounder Mohammad Nabi in their side, with both players having featured for Sunrisers Hyderabad in this year's Indian Premier League.
"Yasir joins the MCC team as the final piece in the jigsaw for this match and we are delighted he is able to play in this historic fixture," said MCC head of cricket John Stephenson in a club statement.
"With Afghanistan having recently been awarded Test match status, it is fitting that they will make their Lord's debut in this match and we hope that many of their UK-based supporters are able to see them in action," the former England batsman added.
Although its more than 40 years since Marylebone Cricket Club (MCC) ceased to run English cricket, it retains worldwide responsibility for the sport's rules, known as Laws.
brendon mccullumKumar SangakkaraMCC vs AfghanistanMisbah-ul-HaqMohammad NabiRashid Khanshivnarine chanderpaulYasir Shah
First Published: July 8, 2017, 9:59 PM IST