Exhibit 23.1

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM

We have issued our reports dated February 25, 2022, with respect to the consolidated financial statements, financial highlights, financial statement schedule and internal control over financial reporting included in the Annual Report of Main Street Capital Corporation on Form 10-K for the year ended December 31, 2021, which are incorporated by reference in this Registration Statement. We consent to the incorporation by reference of the aforementioned reports in this Registration Statement.

/s/ GRANT THORNTON LLP

Houston, Texas

May 3, 2022