Exhibit 23.1
CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM
We consent to the incorporation by reference in this Pre-Effective Amendment No. 1 to the Registration Statement on Form S-3 and related Prospectus of MainStreet Bancshares, Inc. of our reports dated March 13, 2026, relating to the consolidated financial statements and internal control over financial reporting, appearing in the Annual Report on Form 10-K of MainStreet Bancshares, Inc. for the year ended December 31, 2025.
We also consent to the reference to our firm under the heading “Experts” in such Prospectus.
/s/ Yount, Hyde & Barbour, P.C.
Roanoke, Virginia
June 3, 2026