<?xml version="1.0" encoding="utf-8"?>
<!--Generated by DFIN XBRL Instance Document - http://www.dfinsolutions.com/ - Version R3.0 - on 14-March-2024 [05:31:25] {AM}-->
<linkbase xmlns="http://www.xbrl.org/2003/linkbase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd" xmlns:xbrldt="http://xbrl.org/2005/xbrldt">
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#ConsolidatedStatementsOfComprehensiveIncomeLoss" roleURI="http://www.mastech.com/role/ConsolidatedStatementsOfComprehensiveIncomeLoss" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#ConsolidatedStatementsOfShareholdersEquity" roleURI="http://www.mastech.com/role/ConsolidatedStatementsOfShareholdersEquity" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#RevenueFromContractsWithCustomersTables" roleURI="http://www.mastech.com/role/RevenueFromContractsWithCustomersTables" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#SummaryOfSignificantAccountingPoliciesAdditionalInformationDetail" roleURI="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#SummaryOfSignificantAccountingPoliciesScheduleOfAReconciliationOfAllowanceForCreditLossesDetail" roleURI="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesScheduleOfAReconciliationOfAllowanceForCreditLossesDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#SummaryOfSignificantAccountingPoliciesEstimatedUsefulLivesOfDepreciableAssetsDetail" roleURI="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesEstimatedUsefulLivesOfDepreciableAssetsDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#RevenueFromContractsWithCustomersAdditionalInformationDetail" roleURI="http://www.mastech.com/role/RevenueFromContractsWithCustomersAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#RevenueFromContractsWithCustomersSummaryOfDisaggregationOfOurRevenuesByContractTypeAndOperatingSegmentDetail" roleURI="http://www.mastech.com/role/RevenueFromContractsWithCustomersSummaryOfDisaggregationOfOurRevenuesByContractTypeAndOperatingSegmentDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#RevenueFromContractsWithCustomersSummaryOfRevenueFromExternalCustomersDetail" roleURI="http://www.mastech.com/role/RevenueFromContractsWithCustomersSummaryOfRevenueFromExternalCustomersDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#GoodwillAndOtherIntangibleAssetsNetAdditionalInformationDetail" roleURI="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#GoodwillAndOtherIntangibleAssetsNetReconciliationOfGoodwillDetail" roleURI="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetReconciliationOfGoodwillDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#GoodwillAndOtherIntangibleAssetsNetComponentsOfIdentifiableIntangibleAssetsDetail" roleURI="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetComponentsOfIdentifiableIntangibleAssetsDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#CreditFacilityAdditionalInformationDetail" roleURI="http://www.mastech.com/role/CreditFacilityAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#LeasesAdditionalInformationDetail" roleURI="http://www.mastech.com/role/LeasesAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#LeasesSummaryOfBalanceSheetClassificationOfLeaseAssetAndRelatedLeaseLiabilityDetail" roleURI="http://www.mastech.com/role/LeasesSummaryOfBalanceSheetClassificationOfLeaseAssetAndRelatedLeaseLiabilityDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#LeasesScheduleOfFutureMinimumRentalPaymentsForOperatingLeasesDetail" roleURI="http://www.mastech.com/role/LeasesScheduleOfFutureMinimumRentalPaymentsForOperatingLeasesDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#LongTermPayrollTaxLiabilityAdditionalInformationDetail" roleURI="http://www.mastech.com/role/LongTermPayrollTaxLiabilityAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#CommitmentsAndContingenciesAdditionalInformationDetail" roleURI="http://www.mastech.com/role/CommitmentsAndContingenciesAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#EmployeeBenefitPlanAdditionalInformationDetail" roleURI="http://www.mastech.com/role/EmployeeBenefitPlanAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#StockBasedCompensationAdditionalInformationDetail" roleURI="http://www.mastech.com/role/StockBasedCompensationAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#StockBasedCompensationSummaryOfInformationRegardingTheCompanysOutstandingAndExercisableStockOptionsDetail" roleURI="http://www.mastech.com/role/StockBasedCompensationSummaryOfInformationRegardingTheCompanysOutstandingAndExercisableStockOptionsDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#StockBasedCompensationSummaryOfMastechsRestrictedStockUnitActivityDetail" roleURI="http://www.mastech.com/role/StockBasedCompensationSummaryOfMastechsRestrictedStockUnitActivityDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#IncomeTaxesAdditionalInformationDetail" roleURI="http://www.mastech.com/role/IncomeTaxesAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#ShareholdersEquityAdditionalInformationDetail" roleURI="http://www.mastech.com/role/ShareholdersEquityAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#OtherComprehensiveIncomeLossSummaryOfAccumulatedOtherComprehensiveIncomeLossDetail" roleURI="http://www.mastech.com/role/OtherComprehensiveIncomeLossSummaryOfAccumulatedOtherComprehensiveIncomeLossDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#FairValueMeasurementsAdditionalInformationDetail" roleURI="http://www.mastech.com/role/FairValueMeasurementsAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#FairValueMeasurementsSummaryOfFinancialAssetsLiabilitiesAtFairValueMeasuredOnNonRecurringBasisDetail" roleURI="http://www.mastech.com/role/FairValueMeasurementsSummaryOfFinancialAssetsLiabilitiesAtFairValueMeasuredOnNonRecurringBasisDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#BusinessSegmentsAndGeographicInformationAdditionalInformationDetail" roleURI="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#BusinessSegmentsAndGeographicInformationSummaryOfOperatingSegmentsDetail" roleURI="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfOperatingSegmentsDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#BusinessSegmentsAndGeographicInformationSummaryOfAssetsBySegmentDetail" roleURI="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfAssetsBySegmentDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#BusinessSegmentsAndGeographicInformationSummaryOfRevenueFromExternalCustomersDetail" roleURI="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfRevenueFromExternalCustomersDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#RelatedPartyTransactionsAdditionalInformationDetail" roleURI="http://www.mastech.com/role/RelatedPartyTransactionsAdditionalInformationDetail" />
<roleRef xlink:type="simple" xlink:href="mhh-20231231.xsd#SubsequentEventAdditionalInformationDetail" roleURI="http://www.mastech.com/role/SubsequentEventAdditionalInformationDetail" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/all" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#all" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#dimension-default" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#dimension-domain" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/domain-member" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#domain-member" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#hypercube-dimension" />
<arcroleRef arcroleURI="http://xbrl.org/int/dim/arcrole/notAll" xlink:type="simple" xlink:href="http://www.xbrl.org/2005/xbrldt-2005.xsd#notAll" />
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/ConsolidatedStatementsOfComprehensiveIncomeLoss">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_102" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_103" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_102" xlink:to="loc_us-gaap_StatementTable_103" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeInstrumentRiskAxis" xlink:label="loc_us-gaap_DerivativeInstrumentRiskAxis_100" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_103" xlink:to="loc_us-gaap_DerivativeInstrumentRiskAxis_100" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeContractTypeDomain" xlink:label="loc_us-gaap_DerivativeContractTypeDomain_99" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_DerivativeInstrumentRiskAxis_100" xlink:to="loc_us-gaap_DerivativeContractTypeDomain_99" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeContractTypeDomain" xlink:label="loc_us-gaap_DerivativeContractTypeDomain_99_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_DerivativeInstrumentRiskAxis_100" xlink:to="loc_us-gaap_DerivativeContractTypeDomain_99_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ComprehensiveIncomeNetOfTax" xlink:label="loc_us-gaap_ComprehensiveIncomeNetOfTax_111" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_102" xlink:to="loc_us-gaap_ComprehensiveIncomeNetOfTax_111" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetIncomeLoss" xlink:label="loc_us-gaap_NetIncomeLoss_110" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_102" xlink:to="loc_us-gaap_NetIncomeLoss_110" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_102" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossDerivativeExcludedComponentIncreaseDecreaseAfterAdjustmentsAndTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossDerivativeExcludedComponentIncreaseDecreaseAfterAdjustmentsAndTax_105" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossDerivativeExcludedComponentIncreaseDecreaseAfterAdjustmentsAndTax_105" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax_106" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax_106" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossBeforeTaxPortionAttributableToParent" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossBeforeTaxPortionAttributableToParent_107" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossBeforeTaxPortionAttributableToParent_107" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_OtherComprehensiveIncomeLossOnIncomeTaxExpenseBenefit" xlink:label="loc_mhh_OtherComprehensiveIncomeLossOnIncomeTaxExpenseBenefit_108" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" xlink:to="loc_mhh_OtherComprehensiveIncomeLossOnIncomeTaxExpenseBenefit_108" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent_109" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherComprehensiveIncomeLossTaxPortionAttributableToParentAbstract_101" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent_109" use="optional" order="12" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/ConsolidatedStatementsOfShareholdersEquity">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_116" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_117" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_StatementTable_117" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementEquityComponentsAxis" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_115" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_117" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_115" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_114" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_115" xlink:to="loc_us-gaap_EquityComponentDomain_114" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_114_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_115" xlink:to="loc_us-gaap_EquityComponentDomain_114_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CommonStockMember" xlink:label="loc_us-gaap_CommonStockMember_118" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_114" xlink:to="loc_us-gaap_CommonStockMember_118" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdditionalPaidInCapitalMember" xlink:label="loc_us-gaap_AdditionalPaidInCapitalMember_119" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_114" xlink:to="loc_us-gaap_AdditionalPaidInCapitalMember_119" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedDistributionsInExcessOfNetIncomeMember" xlink:label="loc_us-gaap_AccumulatedDistributionsInExcessOfNetIncomeMember_120" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_114" xlink:to="loc_us-gaap_AccumulatedDistributionsInExcessOfNetIncomeMember_120" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockCommonMember" xlink:label="loc_us-gaap_TreasuryStockCommonMember_121" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_114" xlink:to="loc_us-gaap_TreasuryStockCommonMember_121" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeMember" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeMember_122" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_114" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeMember_122" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue" xlink:label="loc_us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue_128" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_AdjustmentsToAdditionalPaidInCapitalSharebasedCompensationRequisiteServicePeriodRecognitionValue_128" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockholdersEquity" xlink:label="loc_us-gaap_StockholdersEquity_123" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_StockholdersEquity_123" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NetIncomeLoss" xlink:label="loc_us-gaap_NetIncomeLoss_124" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_NetIncomeLoss_124" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockIssuedDuringPeriodValueEmployeeStockPurchasePlan" xlink:label="loc_us-gaap_StockIssuedDuringPeriodValueEmployeeStockPurchasePlan_466495" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_StockIssuedDuringPeriodValueEmployeeStockPurchasePlan_466495" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent_126" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTaxPortionAttributableToParent_126" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised" xlink:label="loc_us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised_129" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_StockIssuedDuringPeriodValueStockOptionsExercised_129" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockValueAcquiredCostMethod" xlink:label="loc_us-gaap_TreasuryStockValueAcquiredCostMethod_466494" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_116" xlink:to="loc_us-gaap_TreasuryStockValueAcquiredCostMethod_466494" use="optional" order="16" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/RevenueFromContractsWithCustomersTables">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_938" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_939" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_938" xlink:to="loc_us-gaap_StatementTable_939" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsForNewAccountingPronouncementsAxis" xlink:label="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_937" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_939" xlink:to="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_937" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_940" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_937" xlink:to="loc_us-gaap_TypeOfAdoptionMember_940" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_940_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_937" xlink:to="loc_us-gaap_TypeOfAdoptionMember_940_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DisaggregationOfRevenueTableTextBlock" xlink:label="loc_us-gaap_DisaggregationOfRevenueTableTextBlock_941" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_938" xlink:to="loc_us-gaap_DisaggregationOfRevenueTableTextBlock_941" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevenueFromExternalCustomersByGeographicAreasTableTextBlock" xlink:label="loc_us-gaap_RevenueFromExternalCustomersByGeographicAreasTableTextBlock_942" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_938" xlink:to="loc_us-gaap_RevenueFromExternalCustomersByGeographicAreasTableTextBlock_942" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ContractWithCustomerAssetAndLiabilityTableTextBlock" xlink:label="loc_us-gaap_ContractWithCustomerAssetAndLiabilityTableTextBlock_1330003" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_938" xlink:to="loc_us-gaap_ContractWithCustomerAssetAndLiabilityTableTextBlock_1330003" use="optional" order="7" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SignificantAccountingPoliciesLineItems" xlink:label="loc_mhh_SignificantAccountingPoliciesLineItems_187" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SignificantAccountingPoliciesTable" xlink:label="loc_mhh_SignificantAccountingPoliciesTable_188" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_mhh_SignificantAccountingPoliciesTable_188" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsForNewAccountingPronouncementsAxis" xlink:label="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_180" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_180" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_191" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_180" xlink:to="loc_us-gaap_TypeOfAdoptionMember_191" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_191_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_180" xlink:to="loc_us-gaap_TypeOfAdoptionMember_191_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccountingStandardsUpdate201409Member" xlink:label="loc_us-gaap_AccountingStandardsUpdate201409Member_228" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_TypeOfAdoptionMember_191" xlink:to="loc_us-gaap_AccountingStandardsUpdate201409Member_228" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAxis" xlink:label="loc_us-gaap_BusinessAcquisitionAxis_182" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_BusinessAcquisitionAxis_182" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_182" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_182" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_InfoTrellisIncMember" xlink:label="loc_mhh_InfoTrellisIncMember_192" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181" xlink:to="loc_mhh_InfoTrellisIncMember_192" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AmberLeafMember" xlink:label="loc_mhh_AmberLeafMember_856486" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_181" xlink:to="loc_mhh_AmberLeafMember_856486" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_185" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_srt_RangeAxis_185" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_186" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_185" xlink:to="loc_srt_RangeMember_186" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_186_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_185" xlink:to="loc_srt_RangeMember_186_default" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_194" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_186" xlink:to="loc_srt_MinimumMember_194" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MaximumMember" xlink:label="loc_srt_MaximumMember_195" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_186" xlink:to="loc_srt_MaximumMember_195" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentByTypeAxis" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_183" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_183" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentTypeDomain" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_184" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_183" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_184" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentTypeDomain" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_184_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_183" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_184_default" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeAxis" xlink:label="loc_us-gaap_SubsequentEventTypeAxis_189" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_SubsequentEventTypeAxis_189" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_190" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_189" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_190" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_190_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_189" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_190_default" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AwardTypeAxis" xlink:label="loc_us-gaap_AwardTypeAxis_655717" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_AwardTypeAxis_655717" use="optional" order="22" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_655718" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AwardTypeAxis_655717" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_655718" use="optional" order="23" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_655718_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AwardTypeAxis_655717" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_655718_default" use="optional" order="24" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_EmployeeStockPurchasePlanMember" xlink:label="loc_mhh_EmployeeStockPurchasePlanMember_655719" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_655718" xlink:to="loc_mhh_EmployeeStockPurchasePlanMember_655719" use="optional" order="25" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_1311817" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_1311817" use="optional" order="26" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1311818" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1311817" xlink:to="loc_us-gaap_SegmentDomain_1311818" use="optional" order="27" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1311818_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1311817" xlink:to="loc_us-gaap_SegmentDomain_1311818_default" use="optional" order="28" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsSegmentMember" xlink:label="loc_mhh_DataAndAnalyticsSegmentMember_1311819" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_1311818" xlink:to="loc_mhh_DataAndAnalyticsSegmentMember_1311819" use="optional" order="29" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementEquityComponentsAxis" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_1329997" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_1329997" use="optional" order="30" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1329998" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1329997" xlink:to="loc_us-gaap_EquityComponentDomain_1329998" use="optional" order="31" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1329998_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1329997" xlink:to="loc_us-gaap_EquityComponentDomain_1329998_default" use="optional" order="32" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CommonStockMember" xlink:label="loc_us-gaap_CommonStockMember_1329999" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_1329998" xlink:to="loc_us-gaap_CommonStockMember_1329999" use="optional" order="33" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DetailsAxis" xlink:label="loc_mhh_DetailsAxis_1330164" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_SignificantAccountingPoliciesTable_188" xlink:to="loc_mhh_DetailsAxis_1330164" use="optional" order="34" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DetailsDomain" xlink:label="loc_mhh_DetailsDomain_1330165" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_mhh_DetailsAxis_1330164" xlink:to="loc_mhh_DetailsDomain_1330165" use="optional" order="35" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DetailsDomain" xlink:label="loc_mhh_DetailsDomain_1330165_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_mhh_DetailsAxis_1330164" xlink:to="loc_mhh_DetailsDomain_1330165_default" use="optional" order="36" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ConsolidatedMember" xlink:label="loc_mhh_ConsolidatedMember_1330166" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_DetailsDomain_1330165" xlink:to="loc_mhh_ConsolidatedMember_1330166" use="optional" order="37" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CapitalizedComputerSoftwareNet" xlink:label="loc_us-gaap_CapitalizedComputerSoftwareNet_202" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_CapitalizedComputerSoftwareNet_202" use="optional" order="38" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DepreciationDepletionAndAmortization" xlink:label="loc_us-gaap_DepreciationDepletionAndAmortization_203" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_DepreciationDepletionAndAmortization_203" use="optional" order="39" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetUsefulLife" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetUsefulLife_1330148" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetUsefulLife_1330148" use="optional" order="40" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DeferredTaxAssetsValuationAllowance" xlink:label="loc_us-gaap_DeferredTaxAssetsValuationAllowance_207" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_DeferredTaxAssetsValuationAllowance_207" use="optional" order="41" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationContingentConsiderationLiability" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationLiability_856490" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationLiability_856490" use="optional" order="42" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NumberOfReportableSegments" xlink:label="loc_us-gaap_NumberOfReportableSegments_214" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_NumberOfReportableSegments_214" use="optional" order="43" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer" xlink:label="loc_mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer_215" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer_215" use="optional" order="44" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized_216" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized_216" use="optional" order="45" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillImpairmentLoss" xlink:label="loc_us-gaap_GoodwillImpairmentLoss_655673" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_GoodwillImpairmentLoss_655673" use="optional" order="46" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_655675" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_655675" use="optional" order="47" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_655702" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_655702" use="optional" order="48" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_655716" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_655716" use="optional" order="49" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased" xlink:label="loc_us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased_1329995" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased_1329995" use="optional" order="50" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockRepurchaseProgramPeriodInForce1" xlink:label="loc_us-gaap_StockRepurchaseProgramPeriodInForce1_1329996" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_StockRepurchaseProgramPeriodInForce1_1329996" use="optional" order="51" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward_1330000" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward_1330000" use="optional" order="52" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DerivativeInstrumentsOutstanding" xlink:label="loc_mhh_DerivativeInstrumentsOutstanding_1330001" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_mhh_DerivativeInstrumentsOutstanding_1330001" use="optional" order="53" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ForeignCurrencyTransactionGainBeforeTax" xlink:label="loc_us-gaap_ForeignCurrencyTransactionGainBeforeTax_1330002" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_ForeignCurrencyTransactionGainBeforeTax_1330002" use="optional" order="54" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued" xlink:label="loc_us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued_212" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_UnrecognizedTaxBenefitsIncomeTaxPenaltiesAndInterestAccrued_212" use="optional" order="55" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockCommonShares" xlink:label="loc_us-gaap_TreasuryStockCommonShares_218" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_TreasuryStockCommonShares_218" use="optional" order="56" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockValue" xlink:label="loc_us-gaap_TreasuryStockValue_219" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_TreasuryStockValue_219" use="optional" order="57" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockSharesAcquired" xlink:label="loc_us-gaap_TreasuryStockSharesAcquired_1330062" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_TreasuryStockSharesAcquired_1330062" use="optional" order="58" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockAcquiredAverageCostPerShare" xlink:label="loc_us-gaap_TreasuryStockAcquiredAverageCostPerShare_1330127" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_SignificantAccountingPoliciesLineItems_187" xlink:to="loc_us-gaap_TreasuryStockAcquiredAverageCostPerShare_1330127" use="optional" order="59" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesScheduleOfAReconciliationOfAllowanceForCreditLossesDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems" xlink:label="loc_us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems_1330050" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfFinancingReceivableAllowanceForCreditLossesTable" xlink:label="loc_us-gaap_ScheduleOfFinancingReceivableAllowanceForCreditLossesTable_1330049" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems_1330050" xlink:to="loc_us-gaap_ScheduleOfFinancingReceivableAllowanceForCreditLossesTable_1330049" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AllowanceForDoubtfulAccountsReceivableCurrent" xlink:label="loc_us-gaap_AllowanceForDoubtfulAccountsReceivableCurrent_1330051" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems_1330050" xlink:to="loc_us-gaap_AllowanceForDoubtfulAccountsReceivableCurrent_1330051" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ProvisionForDoubtfulAccounts" xlink:label="loc_us-gaap_ProvisionForDoubtfulAccounts_1330054" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems_1330050" xlink:to="loc_us-gaap_ProvisionForDoubtfulAccounts_1330054" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AllowanceForCreditLossesRecoveriesWriteOffs" xlink:label="loc_mhh_AllowanceForCreditLossesRecoveriesWriteOffs_1330052" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FinancingReceivableAllowanceForCreditLossesLineItems_1330050" xlink:to="loc_mhh_AllowanceForCreditLossesRecoveriesWriteOffs_1330052" use="optional" order="4" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/SummaryOfSignificantAccountingPoliciesEstimatedUsefulLivesOfDepreciableAssetsDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentLineItems" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentLineItems_232" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfPropertyPlantAndEquipmentTable" xlink:label="loc_us-gaap_ScheduleOfPropertyPlantAndEquipmentTable_236" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentLineItems_232" xlink:to="loc_us-gaap_ScheduleOfPropertyPlantAndEquipmentTable_236" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentByTypeAxis" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_231" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfPropertyPlantAndEquipmentTable_236" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_231" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentTypeDomain" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_231" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentTypeDomain" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentByTypeAxis_231" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ComputerEquipmentMember" xlink:label="loc_us-gaap_ComputerEquipmentMember_238" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233" xlink:to="loc_us-gaap_ComputerEquipmentMember_238" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_MachineryAndEquipmentMember" xlink:label="loc_us-gaap_MachineryAndEquipmentMember_239" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233" xlink:to="loc_us-gaap_MachineryAndEquipmentMember_239" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SoftwareAndSoftwareDevelopmentCostsMember" xlink:label="loc_us-gaap_SoftwareAndSoftwareDevelopmentCostsMember_240" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentTypeDomain_233" xlink:to="loc_us-gaap_SoftwareAndSoftwareDevelopmentCostsMember_240" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_234" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfPropertyPlantAndEquipmentTable_236" xlink:to="loc_srt_RangeAxis_234" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_235" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_234" xlink:to="loc_srt_RangeMember_235" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_235_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_234" xlink:to="loc_srt_RangeMember_235_default" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_241" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_235" xlink:to="loc_srt_MinimumMember_241" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MaximumMember" xlink:label="loc_srt_MaximumMember_242" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_235" xlink:to="loc_srt_MaximumMember_242" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentUsefulLife" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentUsefulLife_1330075" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_PropertyPlantAndEquipmentLineItems_232" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentUsefulLife_1330075" use="optional" order="13" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/RevenueFromContractsWithCustomersAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DisaggregationOfRevenueLineItems" xlink:label="loc_us-gaap_DisaggregationOfRevenueLineItems_250" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DisaggregationOfRevenueTable" xlink:label="loc_us-gaap_DisaggregationOfRevenueTable_251" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_us-gaap_DisaggregationOfRevenueTable_251" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsForNewAccountingPronouncementsAxis" xlink:label="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_245" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_245" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_256" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_245" xlink:to="loc_us-gaap_TypeOfAdoptionMember_256" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_256_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_245" xlink:to="loc_us-gaap_TypeOfAdoptionMember_256_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_255" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_255" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_254" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_255" xlink:to="loc_us-gaap_SegmentDomain_254" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_254_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_255" xlink:to="loc_us-gaap_SegmentDomain_254_default" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_268" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_254" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_268" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskByBenchmarkAxis" xlink:label="loc_us-gaap_ConcentrationRiskByBenchmarkAxis_247" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_us-gaap_ConcentrationRiskByBenchmarkAxis_247" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskBenchmarkDomain" xlink:label="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_ConcentrationRiskByBenchmarkAxis_247" xlink:to="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskBenchmarkDomain" xlink:label="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_ConcentrationRiskByBenchmarkAxis_247" xlink:to="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246_default" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SalesRevenueNetMember" xlink:label="loc_us-gaap_SalesRevenueNetMember_257" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246" xlink:to="loc_us-gaap_SalesRevenueNetMember_257" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccountsReceivableMember" xlink:label="loc_us-gaap_AccountsReceivableMember_258" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246" xlink:to="loc_us-gaap_AccountsReceivableMember_258" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TopTenCustomersMember" xlink:label="loc_mhh_TopTenCustomersMember_259" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskBenchmarkDomain_246" xlink:to="loc_mhh_TopTenCustomersMember_259" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskByTypeAxis" xlink:label="loc_us-gaap_ConcentrationRiskByTypeAxis_248" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_us-gaap_ConcentrationRiskByTypeAxis_248" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskTypeDomain" xlink:label="loc_us-gaap_ConcentrationRiskTypeDomain_249" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_ConcentrationRiskByTypeAxis_248" xlink:to="loc_us-gaap_ConcentrationRiskTypeDomain_249" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskTypeDomain" xlink:label="loc_us-gaap_ConcentrationRiskTypeDomain_249_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_ConcentrationRiskByTypeAxis_248" xlink:to="loc_us-gaap_ConcentrationRiskTypeDomain_249_default" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevenueFromRightsConcentrationRiskMember" xlink:label="loc_us-gaap_RevenueFromRightsConcentrationRiskMember_260" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskTypeDomain_249" xlink:to="loc_us-gaap_RevenueFromRightsConcentrationRiskMember_260" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AccountsReceivableConcentrationRiskMember" xlink:label="loc_mhh_AccountsReceivableConcentrationRiskMember_1312420" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskTypeDomain_249" xlink:to="loc_mhh_AccountsReceivableConcentrationRiskMember_1312420" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CustomerConcentrationRiskMember" xlink:label="loc_us-gaap_CustomerConcentrationRiskMember_1330121" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ConcentrationRiskTypeDomain_249" xlink:to="loc_us-gaap_CustomerConcentrationRiskMember_1330121" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MajorCustomersAxis" xlink:label="loc_srt_MajorCustomersAxis_252" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_srt_MajorCustomersAxis_252" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_NameOfMajorCustomerDomain" xlink:label="loc_srt_NameOfMajorCustomerDomain_253" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_MajorCustomersAxis_252" xlink:to="loc_srt_NameOfMajorCustomerDomain_253" use="optional" order="22" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_NameOfMajorCustomerDomain" xlink:label="loc_srt_NameOfMajorCustomerDomain_253_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_MajorCustomersAxis_252" xlink:to="loc_srt_NameOfMajorCustomerDomain_253_default" use="optional" order="23" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CgiMember" xlink:label="loc_mhh_CgiMember_266" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_NameOfMajorCustomerDomain_253" xlink:to="loc_mhh_CgiMember_266" use="optional" order="24" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_OurLargestIndustryVerticalFinancialServicesMember" xlink:label="loc_mhh_OurLargestIndustryVerticalFinancialServicesMember_1330102" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_NameOfMajorCustomerDomain_253" xlink:to="loc_mhh_OurLargestIndustryVerticalFinancialServicesMember_1330102" use="optional" order="25" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_1330117" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_251" xlink:to="loc_srt_RangeAxis_1330117" use="optional" order="26" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_1330118" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_1330117" xlink:to="loc_srt_RangeMember_1330118" use="optional" order="27" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_1330118_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_1330117" xlink:to="loc_srt_RangeMember_1330118_default" use="optional" order="28" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_1330119" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_1330118" xlink:to="loc_srt_MinimumMember_1330119" use="optional" order="29" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer" xlink:label="loc_mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer_261" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_mhh_MaximumPercentageOfBillableExpensesOnRevenueFromCustomer_261" use="optional" order="30" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CustomerPercentageOfRevenue" xlink:label="loc_mhh_CustomerPercentageOfRevenue_262" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_mhh_CustomerPercentageOfRevenue_262" use="optional" order="31" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ConcentrationRiskPercentage1" xlink:label="loc_us-gaap_ConcentrationRiskPercentage1_263" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_us-gaap_ConcentrationRiskPercentage1_263" use="optional" order="32" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_NumberOfCustomersAccountedForRevenues" xlink:label="loc_mhh_NumberOfCustomersAccountedForRevenues_264" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_mhh_NumberOfCustomersAccountedForRevenues_264" use="optional" order="33" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RevenuePercentageToAggregateRevenue" xlink:label="loc_mhh_RevenuePercentageToAggregateRevenue_265" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_250" xlink:to="loc_mhh_RevenuePercentageToAggregateRevenue_265" use="optional" order="34" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/RevenueFromContractsWithCustomersSummaryOfDisaggregationOfOurRevenuesByContractTypeAndOperatingSegmentDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DisaggregationOfRevenueLineItems" xlink:label="loc_us-gaap_DisaggregationOfRevenueLineItems_275" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DisaggregationOfRevenueTable" xlink:label="loc_us-gaap_DisaggregationOfRevenueTable_276" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_275" xlink:to="loc_us-gaap_DisaggregationOfRevenueTable_276" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsForNewAccountingPronouncementsAxis" xlink:label="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_272" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_276" xlink:to="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_272" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_279" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_272" xlink:to="loc_us-gaap_TypeOfAdoptionMember_279" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_279_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_272" xlink:to="loc_us-gaap_TypeOfAdoptionMember_279_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_278" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_276" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_278" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_277" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_278" xlink:to="loc_us-gaap_SegmentDomain_277" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_277_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_278" xlink:to="loc_us-gaap_SegmentDomain_277_default" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_283" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_277" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_283" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ITStaffingServicesMember" xlink:label="loc_mhh_ITStaffingServicesMember_284" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_277" xlink:to="loc_mhh_ITStaffingServicesMember_284" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ContractWithCustomerBasisOfPricingAxis" xlink:label="loc_us-gaap_ContractWithCustomerBasisOfPricingAxis_273" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_DisaggregationOfRevenueTable_276" xlink:to="loc_us-gaap_ContractWithCustomerBasisOfPricingAxis_273" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ContractWithCustomerBasisOfPricingDomain" xlink:label="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_ContractWithCustomerBasisOfPricingAxis_273" xlink:to="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ContractWithCustomerBasisOfPricingDomain" xlink:label="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_ContractWithCustomerBasisOfPricingAxis_273" xlink:to="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274_default" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TimeAndMaterialsContractMember" xlink:label="loc_us-gaap_TimeAndMaterialsContractMember_280" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274" xlink:to="loc_us-gaap_TimeAndMaterialsContractMember_280" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FixedPriceContractMember" xlink:label="loc_us-gaap_FixedPriceContractMember_281" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ContractWithCustomerBasisOfPricingDomain_274" xlink:to="loc_us-gaap_FixedPriceContractMember_281" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_282" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DisaggregationOfRevenueLineItems_275" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_282" use="optional" order="15" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/RevenueFromContractsWithCustomersSummaryOfRevenueFromExternalCustomersDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems" xlink:label="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_289" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable" xlink:label="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_290" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_289" xlink:to="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_290" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AdjustmentsForNewAccountingPronouncementsAxis" xlink:label="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_288" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_290" xlink:to="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_288" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_293" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_288" xlink:to="loc_us-gaap_TypeOfAdoptionMember_293" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TypeOfAdoptionMember" xlink:label="loc_us-gaap_TypeOfAdoptionMember_293_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AdjustmentsForNewAccountingPronouncementsAxis_288" xlink:to="loc_us-gaap_TypeOfAdoptionMember_293_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_StatementGeographicalAxis" xlink:label="loc_srt_StatementGeographicalAxis_292" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfEntityWideInformationRevenueFromExternalCustomersByProductsAndServicesTable_290" xlink:to="loc_srt_StatementGeographicalAxis_292" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_291" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_292" xlink:to="loc_srt_SegmentGeographicalDomain_291" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_291_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_292" xlink:to="loc_srt_SegmentGeographicalDomain_291_default" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_US" xlink:label="loc_country_US_295" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_291" xlink:to="loc_country_US_295" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_CA" xlink:label="loc_country_CA_296" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_291" xlink:to="loc_country_CA_296" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_IndiaAndOtherMember" xlink:label="loc_mhh_IndiaAndOtherMember_297" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_291" xlink:to="loc_mhh_IndiaAndOtherMember_297" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax" xlink:label="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_294" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EntityWideInformationRevenueFromExternalCustomerLineItems_289" xlink:to="loc_us-gaap_RevenueFromContractWithCustomerExcludingAssessedTax_294" use="optional" order="11" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_GoodwillAndIntangibleAssetsLineItems" xlink:label="loc_mhh_GoodwillAndIntangibleAssetsLineItems_418" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ScheduleOfIntangibleAssetsAndGoodwillTable" xlink:label="loc_mhh_ScheduleOfIntangibleAssetsAndGoodwillTable_419" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_mhh_GoodwillAndIntangibleAssetsLineItems_418" xlink:to="loc_mhh_ScheduleOfIntangibleAssetsAndGoodwillTable_419" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAxis" xlink:label="loc_us-gaap_BusinessAcquisitionAxis_417" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_ScheduleOfIntangibleAssetsAndGoodwillTable_419" xlink:to="loc_us-gaap_BusinessAcquisitionAxis_417" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_417" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_417" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_HudsonItMember" xlink:label="loc_mhh_HudsonItMember_420" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416" xlink:to="loc_mhh_HudsonItMember_420" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_InfoTrellisIncMember" xlink:label="loc_mhh_InfoTrellisIncMember_421" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416" xlink:to="loc_mhh_InfoTrellisIncMember_421" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AmberLeafPartnersIncMember" xlink:label="loc_mhh_AmberLeafPartnersIncMember_856645" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_416" xlink:to="loc_mhh_AmberLeafPartnersIncMember_856645" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_1330064" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_ScheduleOfIntangibleAssetsAndGoodwillTable_419" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_1330064" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1330065" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1330064" xlink:to="loc_us-gaap_SegmentDomain_1330065" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1330065_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1330064" xlink:to="loc_us-gaap_SegmentDomain_1330065_default" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_1330066" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_1330065" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_1330066" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Goodwill" xlink:label="loc_us-gaap_Goodwill_422" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_GoodwillAndIntangibleAssetsLineItems_418" xlink:to="loc_us-gaap_Goodwill_422" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillImpairmentLoss" xlink:label="loc_us-gaap_GoodwillImpairmentLoss_423" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_GoodwillAndIntangibleAssetsLineItems_418" xlink:to="loc_us-gaap_GoodwillImpairmentLoss_423" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AmortizationOfIntangibleAssets" xlink:label="loc_us-gaap_AmortizationOfIntangibleAssets_424" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_GoodwillAndIntangibleAssetsLineItems_418" xlink:to="loc_us-gaap_AmortizationOfIntangibleAssets_424" use="optional" order="14" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetReconciliationOfGoodwillDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_426393" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_426390" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_426393" xlink:to="loc_us-gaap_StatementTable_426390" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_426416" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_426390" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_426416" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_426417" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_426416" xlink:to="loc_us-gaap_SegmentDomain_426417" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_426417_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_426416" xlink:to="loc_us-gaap_SegmentDomain_426417_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ITStaffingServicesMember" xlink:label="loc_mhh_ITStaffingServicesMember_426419" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_426417" xlink:to="loc_mhh_ITStaffingServicesMember_426419" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_426418" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_426417" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_426418" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Goodwill" xlink:label="loc_us-gaap_Goodwill_657602" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_426393" xlink:to="loc_us-gaap_Goodwill_657602" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillAcquiredDuringPeriod" xlink:label="loc_us-gaap_GoodwillAcquiredDuringPeriod_428" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_426393" xlink:to="loc_us-gaap_GoodwillAcquiredDuringPeriod_428" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillImpairmentLoss" xlink:label="loc_us-gaap_GoodwillImpairmentLoss_426388" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_426393" xlink:to="loc_us-gaap_GoodwillImpairmentLoss_426388" use="optional" order="9" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/GoodwillAndOtherIntangibleAssetsNetComponentsOfIdentifiableIntangibleAssetsDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_429583" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_429580" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_StatementTable_429580" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_429597" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_429580" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_429597" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_429597" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsByMajorClassAxis_429597" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CustomerRelationshipsMember" xlink:label="loc_us-gaap_CustomerRelationshipsMember_429599" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" xlink:to="loc_us-gaap_CustomerRelationshipsMember_429599" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CovenantNotToCompeteMember" xlink:label="loc_mhh_CovenantNotToCompeteMember_429600" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" xlink:to="loc_mhh_CovenantNotToCompeteMember_429600" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TradeNamesMember" xlink:label="loc_us-gaap_TradeNamesMember_429601" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" xlink:to="loc_us-gaap_TradeNamesMember_429601" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TechnologyBasedIntangibleAssetsMember" xlink:label="loc_us-gaap_TechnologyBasedIntangibleAssetsMember_429603" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FiniteLivedIntangibleAssetsMajorClassNameDomain_429598" xlink:to="loc_us-gaap_TechnologyBasedIntangibleAssetsMember_429603" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementClassOfStockAxis" xlink:label="loc_us-gaap_StatementClassOfStockAxis_429581" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_429580" xlink:to="loc_us-gaap_StatementClassOfStockAxis_429581" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_429582" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementClassOfStockAxis_429581" xlink:to="loc_us-gaap_ClassOfStockDomain_429582" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_429582_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementClassOfStockAxis_429581" xlink:to="loc_us-gaap_ClassOfStockDomain_429582_default" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_429593" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_429580" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_429593" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_429594" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_429593" xlink:to="loc_us-gaap_SegmentDomain_429594" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_429594_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_429593" xlink:to="loc_us-gaap_SegmentDomain_429594_default" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ITStaffingServicesMember" xlink:label="loc_mhh_ITStaffingServicesMember_429595" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_429594" xlink:to="loc_mhh_ITStaffingServicesMember_429595" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_429596" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_429594" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_429596" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetUsefulLife" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetUsefulLife_1330074" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetUsefulLife_1330074" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsGross" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsGross_429585" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsGross_429585" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization_429586" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsAccumulatedAmortization_429586" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FiniteLivedIntangibleAssetsNet" xlink:label="loc_us-gaap_FiniteLivedIntangibleAssetsNet_429587" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_FiniteLivedIntangibleAssetsNet_429587" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IntangibleAssetsGrossExcludingGoodwill" xlink:label="loc_us-gaap_IntangibleAssetsGrossExcludingGoodwill_429588" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_IntangibleAssetsGrossExcludingGoodwill_429588" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IntangibleAssetsNetExcludingGoodwill" xlink:label="loc_us-gaap_IntangibleAssetsNetExcludingGoodwill_429591" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_429583" xlink:to="loc_us-gaap_IntangibleAssetsNetExcludingGoodwill_429591" use="optional" order="22" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/CreditFacilityAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityLineItems" xlink:label="loc_us-gaap_LineOfCreditFacilityLineItems_470" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityTable" xlink:label="loc_us-gaap_LineOfCreditFacilityTable_471" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_LineOfCreditFacilityTable_471" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_474" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_srt_RangeAxis_474" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_475" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_474" xlink:to="loc_srt_RangeMember_475" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_475_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_474" xlink:to="loc_srt_RangeMember_475_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MaximumMember" xlink:label="loc_srt_MaximumMember_511" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_475" xlink:to="loc_srt_MaximumMember_511" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_512" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_475" xlink:to="loc_srt_MinimumMember_512" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityAxis" xlink:label="loc_us-gaap_LineOfCreditFacilityAxis_468" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_LineOfCreditFacilityAxis_468" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityLenderDomain" xlink:label="loc_us-gaap_LineOfCreditFacilityLenderDomain_469" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_LineOfCreditFacilityAxis_468" xlink:to="loc_us-gaap_LineOfCreditFacilityLenderDomain_469" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityLenderDomain" xlink:label="loc_us-gaap_LineOfCreditFacilityLenderDomain_469_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_LineOfCreditFacilityAxis_468" xlink:to="loc_us-gaap_LineOfCreditFacilityLenderDomain_469_default" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PncBankNaMember" xlink:label="loc_mhh_PncBankNaMember_485" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLenderDomain_469" xlink:to="loc_mhh_PncBankNaMember_485" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_VariableRateAxis" xlink:label="loc_us-gaap_VariableRateAxis_478" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_VariableRateAxis_478" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_VariableRateDomain" xlink:label="loc_us-gaap_VariableRateDomain_479" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_VariableRateAxis_478" xlink:to="loc_us-gaap_VariableRateDomain_479" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_VariableRateDomain" xlink:label="loc_us-gaap_VariableRateDomain_479_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_VariableRateAxis_478" xlink:to="loc_us-gaap_VariableRateDomain_479_default" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_FederalFundsRateMember" xlink:label="loc_mhh_FederalFundsRateMember_515" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_VariableRateDomain_479" xlink:to="loc_mhh_FederalFundsRateMember_515" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CreditFacilityAxis" xlink:label="loc_us-gaap_CreditFacilityAxis_464" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_CreditFacilityAxis_464" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CreditFacilityDomain" xlink:label="loc_us-gaap_CreditFacilityDomain_465" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_CreditFacilityAxis_464" xlink:to="loc_us-gaap_CreditFacilityDomain_465" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CreditFacilityDomain" xlink:label="loc_us-gaap_CreditFacilityDomain_465_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_CreditFacilityAxis_464" xlink:to="loc_us-gaap_CreditFacilityDomain_465_default" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TermLoanMember" xlink:label="loc_mhh_TermLoanMember_480" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CreditFacilityDomain_465" xlink:to="loc_mhh_TermLoanMember_480" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RevolvingCreditFacilityMember" xlink:label="loc_us-gaap_RevolvingCreditFacilityMember_482" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_CreditFacilityDomain_465" xlink:to="loc_us-gaap_RevolvingCreditFacilityMember_482" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DebtInstrumentAxis" xlink:label="loc_us-gaap_DebtInstrumentAxis_466" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_DebtInstrumentAxis_466" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DebtInstrumentNameDomain" xlink:label="loc_us-gaap_DebtInstrumentNameDomain_467" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_DebtInstrumentAxis_466" xlink:to="loc_us-gaap_DebtInstrumentNameDomain_467" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DebtInstrumentNameDomain" xlink:label="loc_us-gaap_DebtInstrumentNameDomain_467_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_DebtInstrumentAxis_466" xlink:to="loc_us-gaap_DebtInstrumentNameDomain_467_default" use="optional" order="22" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditMember" xlink:label="loc_us-gaap_LineOfCreditMember_483" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DebtInstrumentNameDomain_467" xlink:to="loc_us-gaap_LineOfCreditMember_483" use="optional" order="23" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SwingLoansMember" xlink:label="loc_mhh_SwingLoansMember_484" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DebtInstrumentNameDomain_467" xlink:to="loc_mhh_SwingLoansMember_484" use="optional" order="24" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_StatementGeographicalAxis" xlink:label="loc_srt_StatementGeographicalAxis_477" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_srt_StatementGeographicalAxis_477" use="optional" order="25" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_476" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_477" xlink:to="loc_srt_SegmentGeographicalDomain_476" use="optional" order="26" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_476_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_477" xlink:to="loc_srt_SegmentGeographicalDomain_476_default" use="optional" order="27" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_US" xlink:label="loc_country_US_513" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_476" xlink:to="loc_country_US_513" use="optional" order="28" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_CA" xlink:label="loc_country_CA_514" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_476" xlink:to="loc_country_CA_514" use="optional" order="29" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LongtermDebtTypeAxis" xlink:label="loc_us-gaap_LongtermDebtTypeAxis_472" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_LongtermDebtTypeAxis_472" use="optional" order="30" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LongtermDebtTypeDomain" xlink:label="loc_us-gaap_LongtermDebtTypeDomain_473" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_LongtermDebtTypeAxis_472" xlink:to="loc_us-gaap_LongtermDebtTypeDomain_473" use="optional" order="31" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LongtermDebtTypeDomain" xlink:label="loc_us-gaap_LongtermDebtTypeDomain_473_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_LongtermDebtTypeAxis_472" xlink:to="loc_us-gaap_LongtermDebtTypeDomain_473_default" use="optional" order="32" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeAxis" xlink:label="loc_us-gaap_SubsequentEventTypeAxis_656142" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LineOfCreditFacilityTable_471" xlink:to="loc_us-gaap_SubsequentEventTypeAxis_656142" use="optional" order="33" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_656143" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_656142" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_656143" use="optional" order="34" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_656143_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_656142" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_656143_default" use="optional" order="35" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityMaximumBorrowingCapacity" xlink:label="loc_us-gaap_LineOfCreditFacilityMaximumBorrowingCapacity_486" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_LineOfCreditFacilityMaximumBorrowingCapacity_486" use="optional" order="36" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_LineOfCreditFacilityAdditionalBorrowingCapacityUponCertainConditions" xlink:label="loc_mhh_LineOfCreditFacilityAdditionalBorrowingCapacityUponCertainConditions_487" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_LineOfCreditFacilityAdditionalBorrowingCapacityUponCertainConditions_487" use="optional" order="37" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LineOfCreditFacilityPeriodicPayment" xlink:label="loc_us-gaap_LineOfCreditFacilityPeriodicPayment_858358" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_LineOfCreditFacilityPeriodicPayment_858358" use="optional" order="38" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PercentageOfEligibleAccountsReceivableUsedToDetermineBorrowingsAvailableUnderCreditFacility" xlink:label="loc_mhh_PercentageOfEligibleAccountsReceivableUsedToDetermineBorrowingsAvailableUnderCreditFacility_489" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_PercentageOfEligibleAccountsReceivableUsedToDetermineBorrowingsAvailableUnderCreditFacility_489" use="optional" order="39" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PercentageOfEligibleUnbilledAccountsUsedToDetermineBorrowingsAvailableUnderCreditFacility" xlink:label="loc_mhh_PercentageOfEligibleUnbilledAccountsUsedToDetermineBorrowingsAvailableUnderCreditFacility_490" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_PercentageOfEligibleUnbilledAccountsUsedToDetermineBorrowingsAvailableUnderCreditFacility_490" use="optional" order="40" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DebtInstrumentBasisSpreadOnVariableRate1" xlink:label="loc_us-gaap_DebtInstrumentBasisSpreadOnVariableRate1_496" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_DebtInstrumentBasisSpreadOnVariableRate1_496" use="optional" order="41" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RevolvingCreditFacilityPercentageMarginOverBaseRate" xlink:label="loc_mhh_RevolvingCreditFacilityPercentageMarginOverBaseRate_497" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_RevolvingCreditFacilityPercentageMarginOverBaseRate_497" use="optional" order="42" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TermLoanPercentageMarginOverBaseRate" xlink:label="loc_mhh_TermLoanPercentageMarginOverBaseRate_498" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_TermLoanPercentageMarginOverBaseRate_498" use="optional" order="43" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RevolvingCreditFacilityPercentageMarginAdjustedSofrRate" xlink:label="loc_mhh_RevolvingCreditFacilityPercentageMarginAdjustedSofrRate_499" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_RevolvingCreditFacilityPercentageMarginAdjustedSofrRate_499" use="optional" order="44" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TermLoanPercentageMarginAdjustedSofrRate" xlink:label="loc_mhh_TermLoanPercentageMarginAdjustedSofrRate_500" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_TermLoanPercentageMarginAdjustedSofrRate_500" use="optional" order="45" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PaymentsOfFinancingCosts" xlink:label="loc_us-gaap_PaymentsOfFinancingCosts_502" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_PaymentsOfFinancingCosts_502" use="optional" order="46" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DeferredFinanceCostsNoncurrentNet" xlink:label="loc_us-gaap_DeferredFinanceCostsNoncurrentNet_503" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_DeferredFinanceCostsNoncurrentNet_503" use="optional" order="47" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RepaymentsOfDebt" xlink:label="loc_us-gaap_RepaymentsOfDebt_1330014" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_us-gaap_RepaymentsOfDebt_1330014" use="optional" order="48" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_LineOfCreditFacilityFinalAmount" xlink:label="loc_mhh_LineOfCreditFacilityFinalAmount_1330107" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LineOfCreditFacilityLineItems_470" xlink:to="loc_mhh_LineOfCreditFacilityFinalAmount_1330107" use="optional" order="49" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/LeasesAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_427927" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_427924" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_StatementTable_427924" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_428072" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_427924" xlink:to="loc_srt_RangeAxis_428072" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_428073" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_428072" xlink:to="loc_srt_RangeMember_428073" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_428073_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_428072" xlink:to="loc_srt_RangeMember_428073_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_428074" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_428073" xlink:to="loc_srt_MinimumMember_428074" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MaximumMember" xlink:label="loc_srt_MaximumMember_428075" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_428073" xlink:to="loc_srt_MaximumMember_428075" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_WeightedAverageMember" xlink:label="loc_srt_WeightedAverageMember_428076" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_428073" xlink:to="loc_srt_WeightedAverageMember_428076" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementClassOfStockAxis" xlink:label="loc_us-gaap_StatementClassOfStockAxis_427925" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_427924" xlink:to="loc_us-gaap_StatementClassOfStockAxis_427925" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_427926" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementClassOfStockAxis_427925" xlink:to="loc_us-gaap_ClassOfStockDomain_427926" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_427926_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementClassOfStockAxis_427925" xlink:to="loc_us-gaap_ClassOfStockDomain_427926_default" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_StatementGeographicalAxis" xlink:label="loc_srt_StatementGeographicalAxis_1330108" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_427924" xlink:to="loc_srt_StatementGeographicalAxis_1330108" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_1330109" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_1330108" xlink:to="loc_srt_SegmentGeographicalDomain_1330109" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_1330109_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_1330108" xlink:to="loc_srt_SegmentGeographicalDomain_1330109_default" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_NoidaIndiaMember" xlink:label="loc_mhh_NoidaIndiaMember_1330159" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_1330109" xlink:to="loc_mhh_NoidaIndiaMember_1330159" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_MoonTownshipPennsylvaniaMember" xlink:label="loc_mhh_MoonTownshipPennsylvaniaMember_1330160" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_1330109" xlink:to="loc_mhh_MoonTownshipPennsylvaniaMember_1330160" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AreaOfLand" xlink:label="loc_us-gaap_AreaOfLand_428069" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_AreaOfLand_428069" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseTermOfContract" xlink:label="loc_us-gaap_LesseeOperatingLeaseTermOfContract_428070" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_LesseeOperatingLeaseTermOfContract_428070" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_LesseeOperatingLeasesRenewalTerm" xlink:label="loc_mhh_LesseeOperatingLeasesRenewalTerm_428077" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_mhh_LesseeOperatingLeasesRenewalTerm_428077" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseDiscountRate" xlink:label="loc_us-gaap_LesseeOperatingLeaseDiscountRate_427928" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_LesseeOperatingLeaseDiscountRate_427928" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseCost" xlink:label="loc_us-gaap_OperatingLeaseCost_1329988" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_OperatingLeaseCost_1329988" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeasePayments" xlink:label="loc_us-gaap_OperatingLeasePayments_855582" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_OperatingLeasePayments_855582" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CapitalLeaseObligationsIncurred" xlink:label="loc_us-gaap_CapitalLeaseObligationsIncurred_855583" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427927" xlink:to="loc_us-gaap_CapitalLeaseObligationsIncurred_855583" use="optional" order="22" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/LeasesSummaryOfBalanceSheetClassificationOfLeaseAssetAndRelatedLeaseLiabilityDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_427867" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_427864" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_427867" xlink:to="loc_us-gaap_StatementTable_427864" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BalanceSheetLocationAxis" xlink:label="loc_us-gaap_BalanceSheetLocationAxis_427869" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_427864" xlink:to="loc_us-gaap_BalanceSheetLocationAxis_427869" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BalanceSheetLocationDomain" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_427870" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_427869" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_427870" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BalanceSheetLocationDomain" xlink:label="loc_us-gaap_BalanceSheetLocationDomain_427870_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BalanceSheetLocationAxis_427869" xlink:to="loc_us-gaap_BalanceSheetLocationDomain_427870_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementClassOfStockAxis" xlink:label="loc_us-gaap_StatementClassOfStockAxis_427865" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_427864" xlink:to="loc_us-gaap_StatementClassOfStockAxis_427865" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_427866" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementClassOfStockAxis_427865" xlink:to="loc_us-gaap_ClassOfStockDomain_427866" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfStockDomain" xlink:label="loc_us-gaap_ClassOfStockDomain_427866_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementClassOfStockAxis_427865" xlink:to="loc_us-gaap_ClassOfStockDomain_427866_default" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AssetsAbstract" xlink:label="loc_us-gaap_AssetsAbstract_427881" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427867" xlink:to="loc_us-gaap_AssetsAbstract_427881" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseRightOfUseAsset" xlink:label="loc_us-gaap_OperatingLeaseRightOfUseAsset_427884" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AssetsAbstract_427881" xlink:to="loc_us-gaap_OperatingLeaseRightOfUseAsset_427884" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LiabilitiesAbstract" xlink:label="loc_us-gaap_LiabilitiesAbstract_427886" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427867" xlink:to="loc_us-gaap_LiabilitiesAbstract_427886" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseLiabilityCurrent" xlink:label="loc_us-gaap_OperatingLeaseLiabilityCurrent_427887" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LiabilitiesAbstract_427886" xlink:to="loc_us-gaap_OperatingLeaseLiabilityCurrent_427887" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseLiabilityNoncurrent" xlink:label="loc_us-gaap_OperatingLeaseLiabilityNoncurrent_427889" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LiabilitiesAbstract_427886" xlink:to="loc_us-gaap_OperatingLeaseLiabilityNoncurrent_427889" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseLiability" xlink:label="loc_us-gaap_OperatingLeaseLiability_427890" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LiabilitiesAbstract_427886" xlink:to="loc_us-gaap_OperatingLeaseLiability_427890" use="optional" order="13" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/LeasesScheduleOfFutureMinimumRentalPaymentsForOperatingLeasesDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_427909" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_427906" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_StatementTable_427906" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueNextTwelveMonths" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueNextTwelveMonths_656179" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueNextTwelveMonths_656179" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo_427911" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearTwo_427911" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree_427912" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearThree_427912" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour_427913" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFour_427913" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive_427914" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueYearFive_427914" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive_427915" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDueAfterYearFive_427915" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue" xlink:label="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue_657499" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_LesseeOperatingLeaseLiabilityPaymentsDue_657499" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ImputedInterestInRespectOfOperatingLeasesFutureMinimumRentalsPayable" xlink:label="loc_mhh_ImputedInterestInRespectOfOperatingLeasesFutureMinimumRentalsPayable_427918" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_mhh_ImputedInterestInRespectOfOperatingLeasesFutureMinimumRentalsPayable_427918" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingLeaseLiability" xlink:label="loc_us-gaap_OperatingLeaseLiability_427920" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_427909" xlink:to="loc_us-gaap_OperatingLeaseLiability_427920" use="optional" order="10" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/LongTermPayrollTaxLiabilityAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_856889" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_856886" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_856889" xlink:to="loc_us-gaap_StatementTable_856886" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TaxSupportToEntityReliefActAxis" xlink:label="loc_mhh_TaxSupportToEntityReliefActAxis_856892" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_856886" xlink:to="loc_mhh_TaxSupportToEntityReliefActAxis_856892" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TaxSupportToEntityReliefActDomain" xlink:label="loc_mhh_TaxSupportToEntityReliefActDomain_856906" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_mhh_TaxSupportToEntityReliefActAxis_856892" xlink:to="loc_mhh_TaxSupportToEntityReliefActDomain_856906" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TaxSupportToEntityReliefActDomain" xlink:label="loc_mhh_TaxSupportToEntityReliefActDomain_856906_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_mhh_TaxSupportToEntityReliefActAxis_856892" xlink:to="loc_mhh_TaxSupportToEntityReliefActDomain_856906_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CoronavirusAidReliefAndEconomicSecurityActMember" xlink:label="loc_mhh_CoronavirusAidReliefAndEconomicSecurityActMember_857944" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_TaxSupportToEntityReliefActDomain_856906" xlink:to="loc_mhh_CoronavirusAidReliefAndEconomicSecurityActMember_857944" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TypeOfSecurityTaxAxis" xlink:label="loc_mhh_TypeOfSecurityTaxAxis_856896" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_856886" xlink:to="loc_mhh_TypeOfSecurityTaxAxis_856896" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TypeOfSecurityTaxDomain" xlink:label="loc_mhh_TypeOfSecurityTaxDomain_856909" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_mhh_TypeOfSecurityTaxAxis_856896" xlink:to="loc_mhh_TypeOfSecurityTaxDomain_856909" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TypeOfSecurityTaxDomain" xlink:label="loc_mhh_TypeOfSecurityTaxDomain_856909_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_mhh_TypeOfSecurityTaxAxis_856896" xlink:to="loc_mhh_TypeOfSecurityTaxDomain_856909_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SocialSecurityTaxMember" xlink:label="loc_mhh_SocialSecurityTaxMember_856912" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_TypeOfSecurityTaxDomain_856909" xlink:to="loc_mhh_SocialSecurityTaxMember_856912" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_BalancesheetlocationaxisAxis" xlink:label="loc_mhh_BalancesheetlocationaxisAxis_856914" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_856886" xlink:to="loc_mhh_BalancesheetlocationaxisAxis_856914" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_BalancesheetlocationaxisDomain" xlink:label="loc_mhh_BalancesheetlocationaxisDomain_856916" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_mhh_BalancesheetlocationaxisAxis_856914" xlink:to="loc_mhh_BalancesheetlocationaxisDomain_856916" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_BalancesheetlocationaxisDomain" xlink:label="loc_mhh_BalancesheetlocationaxisDomain_856916_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_mhh_BalancesheetlocationaxisAxis_856914" xlink:to="loc_mhh_BalancesheetlocationaxisDomain_856916_default" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AccruedPayrollAndRelatedCostMember" xlink:label="loc_mhh_AccruedPayrollAndRelatedCostMember_856917" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_BalancesheetlocationaxisDomain_856916" xlink:to="loc_mhh_AccruedPayrollAndRelatedCostMember_856917" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_LongTermPayrollTaxLiabiitiesMember" xlink:label="loc_mhh_LongTermPayrollTaxLiabiitiesMember_856918" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_BalancesheetlocationaxisDomain_856916" xlink:to="loc_mhh_LongTermPayrollTaxLiabiitiesMember_856918" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DeferredTaxLiabilities" xlink:label="loc_us-gaap_DeferredTaxLiabilities_856920" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_856889" xlink:to="loc_us-gaap_DeferredTaxLiabilities_856920" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RepaymentOfDefferedTaxLiabilities" xlink:label="loc_mhh_RepaymentOfDefferedTaxLiabilities_856923" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_856889" xlink:to="loc_mhh_RepaymentOfDefferedTaxLiabilities_856923" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CurrentLiabilities" xlink:label="loc_mhh_CurrentLiabilities_856925" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_856889" xlink:to="loc_mhh_CurrentLiabilities_856925" use="optional" order="17" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/CommitmentsAndContingenciesAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingenciesLineItems" xlink:label="loc_us-gaap_LossContingenciesLineItems_1330059" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingenciesTable" xlink:label="loc_us-gaap_LossContingenciesTable_1330055" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_LossContingenciesLineItems_1330059" xlink:to="loc_us-gaap_LossContingenciesTable_1330055" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingenciesByNatureOfContingencyAxis" xlink:label="loc_us-gaap_LossContingenciesByNatureOfContingencyAxis_1330056" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_LossContingenciesTable_1330055" xlink:to="loc_us-gaap_LossContingenciesByNatureOfContingencyAxis_1330056" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingencyNatureDomain" xlink:label="loc_us-gaap_LossContingencyNatureDomain_1330057" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_LossContingenciesByNatureOfContingencyAxis_1330056" xlink:to="loc_us-gaap_LossContingencyNatureDomain_1330057" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingencyNatureDomain" xlink:label="loc_us-gaap_LossContingencyNatureDomain_1330057_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_LossContingenciesByNatureOfContingencyAxis_1330056" xlink:to="loc_us-gaap_LossContingencyNatureDomain_1330057_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_FormerEmployeeUnassertedClaimMember" xlink:label="loc_mhh_FormerEmployeeUnassertedClaimMember_1330058" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LossContingencyNatureDomain_1330057" xlink:to="loc_mhh_FormerEmployeeUnassertedClaimMember_1330058" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_LossContingencyPaymentNetOfSettlement" xlink:label="loc_mhh_LossContingencyPaymentNetOfSettlement_1330140" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LossContingenciesLineItems_1330059" xlink:to="loc_mhh_LossContingencyPaymentNetOfSettlement_1330140" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_LossContingencyAccrualProvision" xlink:label="loc_us-gaap_LossContingencyAccrualProvision_1330061" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_LossContingenciesLineItems_1330059" xlink:to="loc_us-gaap_LossContingencyAccrualProvision_1330061" use="optional" order="7" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/EmployeeBenefitPlanAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DefinedBenefitPlanDisclosureLineItems" xlink:label="loc_us-gaap_DefinedBenefitPlanDisclosureLineItems_538" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfDefinedBenefitPlansDisclosuresTable" xlink:label="loc_us-gaap_ScheduleOfDefinedBenefitPlansDisclosuresTable_541" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_DefinedBenefitPlanDisclosureLineItems_538" xlink:to="loc_us-gaap_ScheduleOfDefinedBenefitPlansDisclosuresTable_541" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RetirementPlanNameAxis" xlink:label="loc_us-gaap_RetirementPlanNameAxis_539" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfDefinedBenefitPlansDisclosuresTable_541" xlink:to="loc_us-gaap_RetirementPlanNameAxis_539" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RetirementPlanNameDomain" xlink:label="loc_us-gaap_RetirementPlanNameDomain_540" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_RetirementPlanNameAxis_539" xlink:to="loc_us-gaap_RetirementPlanNameDomain_540" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RetirementPlanNameDomain" xlink:label="loc_us-gaap_RetirementPlanNameDomain_540_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_RetirementPlanNameAxis_539" xlink:to="loc_us-gaap_RetirementPlanNameDomain_540_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DefinedContributionPlanEmployerDiscretionaryContributionAmount" xlink:label="loc_us-gaap_DefinedContributionPlanEmployerDiscretionaryContributionAmount_542" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DefinedBenefitPlanDisclosureLineItems_538" xlink:to="loc_us-gaap_DefinedContributionPlanEmployerDiscretionaryContributionAmount_542" use="optional" order="5" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/StockBasedCompensationAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_552" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_552" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AwardTypeAxis" xlink:label="loc_us-gaap_AwardTypeAxis_549" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_552" xlink:to="loc_us-gaap_AwardTypeAxis_549" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AwardTypeAxis_549" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AwardTypeAxis_549" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_EmployeeStockPurchasePlanMember" xlink:label="loc_mhh_EmployeeStockPurchasePlanMember_428292" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" xlink:to="loc_mhh_EmployeeStockPurchasePlanMember_428292" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeStockOptionMember" xlink:label="loc_us-gaap_EmployeeStockOptionMember_656202" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" xlink:to="loc_us-gaap_EmployeeStockOptionMember_656202" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PerformanceSharesMember" xlink:label="loc_us-gaap_PerformanceSharesMember_656201" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" xlink:to="loc_us-gaap_PerformanceSharesMember_656201" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RestrictedStockMember" xlink:label="loc_us-gaap_RestrictedStockMember_583" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" xlink:to="loc_us-gaap_RestrictedStockMember_583" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RestrictedStockUnitsRSUMember" xlink:label="loc_us-gaap_RestrictedStockUnitsRSUMember_584" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_554" xlink:to="loc_us-gaap_RestrictedStockUnitsRSUMember_584" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeAxis" xlink:label="loc_srt_RangeAxis_550" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_552" xlink:to="loc_srt_RangeAxis_550" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_551" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_RangeAxis_550" xlink:to="loc_srt_RangeMember_551" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RangeMember" xlink:label="loc_srt_RangeMember_551_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_RangeAxis_550" xlink:to="loc_srt_RangeMember_551_default" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MinimumMember" xlink:label="loc_srt_MinimumMember_555" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_551" xlink:to="loc_srt_MinimumMember_555" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_MaximumMember" xlink:label="loc_srt_MaximumMember_556" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_RangeMember_551" xlink:to="loc_srt_MaximumMember_556" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualAxis" xlink:label="loc_srt_TitleOfIndividualAxis_428249" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_552" xlink:to="loc_srt_TitleOfIndividualAxis_428249" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualWithRelationshipToEntityDomain" xlink:label="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_428250" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_TitleOfIndividualAxis_428249" xlink:to="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_428250" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualWithRelationshipToEntityDomain" xlink:label="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_428250_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_TitleOfIndividualAxis_428249" xlink:to="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_428250_default" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized_557" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAuthorized_557" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingOrExercisedNumber" xlink:label="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingOrExercisedNumber_560" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingOrExercisedNumber_560" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_561" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsVestedInPeriod_561" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod_656200" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesIssuedInPeriod_656200" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_563" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardNumberOfSharesAvailableForGrant_563" use="optional" order="22" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_656203" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardAwardVestingPeriod1_656203" use="optional" order="23" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardExpirationPeriod" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardExpirationPeriod_565" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardExpirationPeriod_565" use="optional" order="24" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingIntrinsicValue" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingIntrinsicValue_567" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingIntrinsicValue_567" use="optional" order="25" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedAndExpectedToVestOutstandingAggregateIntrinsicValue" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedAndExpectedToVestOutstandingAggregateIntrinsicValue_568" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsVestedAndExpectedToVestOutstandingAggregateIntrinsicValue_568" use="optional" order="26" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue_569" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisesInPeriodTotalIntrinsicValue_569" use="optional" order="27" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsVestedInPeriodFairValue1" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsVestedInPeriodFairValue1_570" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsVestedInPeriodFairValue1_570" use="optional" order="28" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross_571" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsGrantsInPeriodGross_571" use="optional" order="29" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsExpectedDividendRate" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsExpectedDividendRate_572" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardFairValueAssumptionsExpectedDividendRate_572" use="optional" order="30" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardFairValueAssumptionsExpectedTerm1" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardFairValueAssumptionsExpectedTerm1_656204" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardFairValueAssumptionsExpectedTerm1_656204" use="optional" order="31" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardEquityInstrumentsOtherThanOptionsAggregateIntrinsicValueOutstanding" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardEquityInstrumentsOtherThanOptionsAggregateIntrinsicValueOutstanding_656216" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardEquityInstrumentsOtherThanOptionsAggregateIntrinsicValueOutstanding_656216" use="optional" order="32" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsIssuedInPeriodIntrinsicValue" xlink:label="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsIssuedInPeriodIntrinsicValue_575" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsIssuedInPeriodIntrinsicValue_575" use="optional" order="33" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensation" xlink:label="loc_us-gaap_ShareBasedCompensation_576" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensation_576" use="optional" order="34" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense_656242" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationTaxBenefitFromCompensationExpense_656242" use="optional" order="35" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedStockOptions" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedStockOptions_656243" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedStockOptions_656243" use="optional" order="36" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedPeriodForRecognition1" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedPeriodForRecognition1_656244" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedPeriodForRecognition1_656244" use="optional" order="37" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedShareBasedAwardsOtherThanOptions" xlink:label="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedShareBasedAwardsOtherThanOptions_656245" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_EmployeeServiceShareBasedCompensationNonvestedAwardsTotalCompensationCostNotYetRecognizedShareBasedAwardsOtherThanOptions_656245" use="optional" order="38" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharePrice" xlink:label="loc_us-gaap_SharePrice_566" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_SharePrice_566" use="optional" order="39" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockIssuedDuringPeriodSharesShareBasedCompensation" xlink:label="loc_us-gaap_StockIssuedDuringPeriodSharesShareBasedCompensation_426457" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_StockIssuedDuringPeriodSharesShareBasedCompensation_426457" use="optional" order="40" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardMaximumEmployeeSubscriptionRate" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardMaximumEmployeeSubscriptionRate_656232" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardMaximumEmployeeSubscriptionRate_656232" use="optional" order="41" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationMaximumLimitOfContributionsTowardsPlanPerPerson" xlink:label="loc_mhh_ShareBasedCompensationMaximumLimitOfContributionsTowardsPlanPerPerson_656233" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_mhh_ShareBasedCompensationMaximumLimitOfContributionsTowardsPlanPerPerson_656233" use="optional" order="42" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationPercentageOfDiscountToPurchaseOfCommonStock" xlink:label="loc_mhh_ShareBasedCompensationPercentageOfDiscountToPurchaseOfCommonStock_656235" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_mhh_ShareBasedCompensationPercentageOfDiscountToPurchaseOfCommonStock_656235" use="optional" order="43" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_EmployeeStockPurchasePlanAwardFairValueAssumptionsMethodUsed" xlink:label="loc_mhh_EmployeeStockPurchasePlanAwardFairValueAssumptionsMethodUsed_1330036" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_553" xlink:to="loc_mhh_EmployeeStockPurchasePlanAwardFairValueAssumptionsMethodUsed_1330036" use="optional" order="44" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/StockBasedCompensationSummaryOfInformationRegardingTheCompanysOutstandingAndExercisableStockOptionsDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_599" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_599" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansByExercisePriceRangeAxis" xlink:label="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansByExercisePriceRangeAxis_601" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_599" xlink:to="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansByExercisePriceRangeAxis_601" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain" xlink:label="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansByExercisePriceRangeAxis_601" xlink:to="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain" xlink:label="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansByExercisePriceRangeAxis_601" xlink:to="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RangeOneMember" xlink:label="loc_mhh_RangeOneMember_613" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" xlink:to="loc_mhh_RangeOneMember_613" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RangeTwoMember" xlink:label="loc_mhh_RangeTwoMember_614" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" xlink:to="loc_mhh_RangeTwoMember_614" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RangeThreeMember" xlink:label="loc_mhh_RangeThreeMember_615" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" xlink:to="loc_mhh_RangeThreeMember_615" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RangeFourMember" xlink:label="loc_mhh_RangeFourMember_616" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" xlink:to="loc_mhh_RangeFourMember_616" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_RangeFiveMember" xlink:label="loc_mhh_RangeFiveMember_1311857" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeDomain_602" xlink:to="loc_mhh_RangeFiveMember_1311857" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingNumber" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingNumber_603" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingNumber_603" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeLowerRangeLimit" xlink:label="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeLowerRangeLimit_604" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeLowerRangeLimit_604" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeUpperRangeLimit" xlink:label="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeUpperRangeLimit_605" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationSharesAuthorizedUnderStockOptionPlansExercisePriceRangeUpperRangeLimit_605" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsOutstandingWeightedAverageRemainingContractualTerm2" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsOutstandingWeightedAverageRemainingContractualTerm2_606" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsOutstandingWeightedAverageRemainingContractualTerm2_606" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingWeightedAverageExercisePrice" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingWeightedAverageExercisePrice_607" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsOutstandingWeightedAverageExercisePrice_607" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableNumber" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableNumber_608" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableNumber_608" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMinimum" xlink:label="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMinimum_609" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMinimum_609" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMaximum" xlink:label="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMaximum_610" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableExercisePricePerShareMaximum_610" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsExercisableWeightedAverageRemainingContractualTerm1" xlink:label="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsExercisableWeightedAverageRemainingContractualTerm1_611" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_SharebasedCompensationArrangementBySharebasedPaymentAwardOptionsExercisableWeightedAverageRemainingContractualTerm1_611" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableWeightedAverageExercisePrice" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableWeightedAverageExercisePrice_612" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_600" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardOptionsExercisableWeightedAverageExercisePrice_612" use="optional" order="19" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/StockBasedCompensationSummaryOfMastechsRestrictedStockUnitActivityDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable" xlink:label="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_627" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" xlink:to="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_627" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AwardTypeAxis" xlink:label="loc_us-gaap_AwardTypeAxis_626" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfShareBasedCompensationArrangementsByShareBasedPaymentAwardTable_627" xlink:to="loc_us-gaap_AwardTypeAxis_626" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_629" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_AwardTypeAxis_626" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_629" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_629_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_AwardTypeAxis_626" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_629_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RestrictedStockUnitsRSUMember" xlink:label="loc_us-gaap_RestrictedStockUnitsRSUMember_635" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementsByShareBasedPaymentAwardAwardTypeAndPlanNameDomain_629" xlink:to="loc_us-gaap_RestrictedStockUnitsRSUMember_635" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber_630" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsNonvestedNumber_630" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod_631" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsGrantsInPeriod_631" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsStockIssuedInPeriod" xlink:label="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsStockIssuedInPeriod_632" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" xlink:to="loc_mhh_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsStockIssuedInPeriod_632" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod_633" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardLineItems_628" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardEquityInstrumentsOtherThanOptionsForfeitedInPeriod_633" use="optional" order="9" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/IncomeTaxesAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementLineItems" xlink:label="loc_us-gaap_StatementLineItems_857035" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementTable" xlink:label="loc_us-gaap_StatementTable_857032" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_StatementLineItems_857035" xlink:to="loc_us-gaap_StatementTable_857032" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_StatementGeographicalAxis" xlink:label="loc_srt_StatementGeographicalAxis_857040" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_StatementTable_857032" xlink:to="loc_srt_StatementGeographicalAxis_857040" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_857041" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_857040" xlink:to="loc_srt_SegmentGeographicalDomain_857041" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_857041_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_857040" xlink:to="loc_srt_SegmentGeographicalDomain_857041_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DeferredTaxLiabilitiesValuationAllowance" xlink:label="loc_mhh_DeferredTaxLiabilitiesValuationAllowance_857046" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_857035" xlink:to="loc_mhh_DeferredTaxLiabilitiesValuationAllowance_857046" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease" xlink:label="loc_us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease_1330122" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_StatementLineItems_857035" xlink:to="loc_us-gaap_UnrecognizedTaxBenefitsPeriodIncreaseDecrease_1330122" use="optional" order="6" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/ShareholdersEquityAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityClassOfTreasuryStockLineItems" xlink:label="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ClassOfTreasuryStockTable" xlink:label="loc_us-gaap_ClassOfTreasuryStockTable_754" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_ClassOfTreasuryStockTable_754" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsidiarySaleOfStockAxis" xlink:label="loc_us-gaap_SubsidiarySaleOfStockAxis_759" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ClassOfTreasuryStockTable_754" xlink:to="loc_us-gaap_SubsidiarySaleOfStockAxis_759" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SaleOfStockNameOfTransactionDomain" xlink:label="loc_us-gaap_SaleOfStockNameOfTransactionDomain_758" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsidiarySaleOfStockAxis_759" xlink:to="loc_us-gaap_SaleOfStockNameOfTransactionDomain_758" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SaleOfStockNameOfTransactionDomain" xlink:label="loc_us-gaap_SaleOfStockNameOfTransactionDomain_758_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsidiarySaleOfStockAxis_759" xlink:to="loc_us-gaap_SaleOfStockNameOfTransactionDomain_758_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_CounterpartyNameAxis" xlink:label="loc_srt_CounterpartyNameAxis_755" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ClassOfTreasuryStockTable_754" xlink:to="loc_srt_CounterpartyNameAxis_755" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RepurchaseAgreementCounterpartyNameDomain" xlink:label="loc_srt_RepurchaseAgreementCounterpartyNameDomain_757" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_CounterpartyNameAxis_755" xlink:to="loc_srt_RepurchaseAgreementCounterpartyNameDomain_757" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_RepurchaseAgreementCounterpartyNameDomain" xlink:label="loc_srt_RepurchaseAgreementCounterpartyNameDomain_757_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_CounterpartyNameAxis_755" xlink:to="loc_srt_RepurchaseAgreementCounterpartyNameDomain_757_default" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeAxis" xlink:label="loc_us-gaap_SubsequentEventTypeAxis_1330020" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ClassOfTreasuryStockTable_754" xlink:to="loc_us-gaap_SubsequentEventTypeAxis_1330020" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_1330021" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_1330020" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_1330021" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_1330021_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_1330020" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_1330021_default" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementEquityComponentsAxis" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_1330023" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ClassOfTreasuryStockTable_754" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_1330023" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1330024" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1330023" xlink:to="loc_us-gaap_EquityComponentDomain_1330024" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1330024_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1330023" xlink:to="loc_us-gaap_EquityComponentDomain_1330024_default" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_CommonStockMember" xlink:label="loc_us-gaap_CommonStockMember_1330025" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityComponentDomain_1330024" xlink:to="loc_us-gaap_CommonStockMember_1330025" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward" xlink:label="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward_764" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_ShareBasedCompensationArrangementByShareBasedPaymentAwardSharesPurchasedForAward_764" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased" xlink:label="loc_us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased_1330018" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_StockRepurchaseProgramNumberOfSharesAuthorizedToBeRepurchased_1330018" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockRepurchaseProgramPeriodInForce1" xlink:label="loc_us-gaap_StockRepurchaseProgramPeriodInForce1_1330019" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_StockRepurchaseProgramPeriodInForce1_1330019" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockCommonShares" xlink:label="loc_us-gaap_TreasuryStockCommonShares_1330026" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_TreasuryStockCommonShares_1330026" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockValue" xlink:label="loc_us-gaap_TreasuryStockValue_1330027" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_TreasuryStockValue_1330027" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StockRepurchasedDuringPeriodShares" xlink:label="loc_us-gaap_StockRepurchasedDuringPeriodShares_1330067" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_StockRepurchasedDuringPeriodShares_1330067" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_TreasuryStockAcquiredAverageCostPerShare" xlink:label="loc_us-gaap_TreasuryStockAcquiredAverageCostPerShare_1330147" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_EquityClassOfTreasuryStockLineItems_756" xlink:to="loc_us-gaap_TreasuryStockAcquiredAverageCostPerShare_1330147" use="optional" order="21" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/OtherComprehensiveIncomeLossSummaryOfAccumulatedOtherComprehensiveIncomeLossDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossTable" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossTable_656297" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossTable_656297" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementEquityComponentsAxis" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_656300" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossTable_656297" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_656300" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_656301" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_656300" xlink:to="loc_us-gaap_EquityComponentDomain_656301" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_656301_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_656300" xlink:to="loc_us-gaap_EquityComponentDomain_656301_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax_656302" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentNetOfTax_656302" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeForeignCurrencyTransactionAndTranslationGainLossBeforeReclassificationAndTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeForeignCurrencyTransactionAndTranslationGainLossBeforeReclassificationAndTax_656303" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeForeignCurrencyTransactionAndTranslationGainLossBeforeReclassificationAndTax_656303" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationReclassificationAdjustmentFromAOCIRealizedUponSaleOrLiquidationBeforeTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationReclassificationAdjustmentFromAOCIRealizedUponSaleOrLiquidationBeforeTax_656304" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationReclassificationAdjustmentFromAOCIRealizedUponSaleOrLiquidationBeforeTax_656304" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentTax_656305" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTranslationAdjustmentTax_656305" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax_656932" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossForeignCurrencyTransactionAndTranslationAdjustmentBeforeTax_656932" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax" xlink:label="loc_us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax_656311" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_AociLossCashFlowHedgeCumulativeGainLossAfterTax_656311" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAndTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAndTax_656313" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossBeforeReclassificationAndTax_656313" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationBeforeTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationBeforeTax_656314" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossReclassificationBeforeTax_656314" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationTax_656320" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationTax_656320" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationAndTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationAndTax_656933" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossCashFlowHedgeGainLossAfterReclassificationAndTax_656933" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax" xlink:label="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_656325" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossNetOfTax_656325" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_OtherComprehensiveIncomeGainLossArisingDuringThePeriodBeforeReclassificationAndTax" xlink:label="loc_mhh_OtherComprehensiveIncomeGainLossArisingDuringThePeriodBeforeReclassificationAndTax_656335" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_mhh_OtherComprehensiveIncomeGainLossArisingDuringThePeriodBeforeReclassificationAndTax_656335" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ReclassificationFromAociCurrentPeriodBeforeTaxAttributableToParent" xlink:label="loc_us-gaap_ReclassificationFromAociCurrentPeriodBeforeTaxAttributableToParent_656338" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_ReclassificationFromAociCurrentPeriodBeforeTaxAttributableToParent_656338" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossTax_656340" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossTax_656340" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherComprehensiveIncomeLossNetOfTax" xlink:label="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_656935" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_AccumulatedOtherComprehensiveIncomeLossLineItems_656299" xlink:to="loc_us-gaap_OtherComprehensiveIncomeLossNetOfTax_656935" use="optional" order="19" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/FairValueMeasurementsAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_FairValueDisclosuresLineItems" xlink:label="loc_mhh_FairValueDisclosuresLineItems_808" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_FairValueDisclosuresTable" xlink:label="loc_mhh_FairValueDisclosuresTable_809" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_mhh_FairValueDisclosuresLineItems_808" xlink:to="loc_mhh_FairValueDisclosuresTable_809" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAxis" xlink:label="loc_us-gaap_BusinessAcquisitionAxis_807" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_FairValueDisclosuresTable_809" xlink:to="loc_us-gaap_BusinessAcquisitionAxis_807" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_807" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_807" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_InfoTrellisIncMember" xlink:label="loc_mhh_InfoTrellisIncMember_810" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806" xlink:to="loc_mhh_InfoTrellisIncMember_810" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_AmberLeafMember" xlink:label="loc_mhh_AmberLeafMember_858188" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_806" xlink:to="loc_mhh_AmberLeafMember_858188" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeInstrumentRiskAxis" xlink:label="loc_us-gaap_DerivativeInstrumentRiskAxis_1329991" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_FairValueDisclosuresTable_809" xlink:to="loc_us-gaap_DerivativeInstrumentRiskAxis_1329991" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeContractTypeDomain" xlink:label="loc_us-gaap_DerivativeContractTypeDomain_1329992" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_DerivativeInstrumentRiskAxis_1329991" xlink:to="loc_us-gaap_DerivativeContractTypeDomain_1329992" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DerivativeContractTypeDomain" xlink:label="loc_us-gaap_DerivativeContractTypeDomain_1329992_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_DerivativeInstrumentRiskAxis_1329991" xlink:to="loc_us-gaap_DerivativeContractTypeDomain_1329992_default" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_InterestRateSwapMember" xlink:label="loc_us-gaap_InterestRateSwapMember_1329993" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_DerivativeContractTypeDomain_1329992" xlink:to="loc_us-gaap_InterestRateSwapMember_1329993" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_1330141" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_mhh_FairValueDisclosuresTable_809" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_1330141" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1330142" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1330141" xlink:to="loc_us-gaap_SegmentDomain_1330142" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_1330142_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_1330141" xlink:to="loc_us-gaap_SegmentDomain_1330142_default" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_1330143" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_1330142" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_1330143" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_811" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_FairValueDisclosuresLineItems_808" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_811" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillImpairmentLoss" xlink:label="loc_us-gaap_GoodwillImpairmentLoss_812" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_FairValueDisclosuresLineItems_808" xlink:to="loc_us-gaap_GoodwillImpairmentLoss_812" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationContingentConsiderationLiability" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationLiability_858187" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_FairValueDisclosuresLineItems_808" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationLiability_858187" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure" xlink:label="loc_us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure_1329990" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_mhh_FairValueDisclosuresLineItems_808" xlink:to="loc_us-gaap_ForeignCurrencyContractsLiabilityFairValueDisclosure_1329990" use="optional" order="18" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/FairValueMeasurementsSummaryOfFinancialAssetsLiabilitiesAtFairValueMeasuredOnNonRecurringBasisDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_825" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable" xlink:label="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_822" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_825" xlink:to="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_822" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueByMeasurementFrequencyAxis" xlink:label="loc_us-gaap_FairValueByMeasurementFrequencyAxis_1330104" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_822" xlink:to="loc_us-gaap_FairValueByMeasurementFrequencyAxis_1330104" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueMeasurementFrequencyDomain" xlink:label="loc_us-gaap_FairValueMeasurementFrequencyDomain_1330105" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FairValueByMeasurementFrequencyAxis_1330104" xlink:to="loc_us-gaap_FairValueMeasurementFrequencyDomain_1330105" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueMeasurementFrequencyDomain" xlink:label="loc_us-gaap_FairValueMeasurementFrequencyDomain_1330105_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FairValueByMeasurementFrequencyAxis_1330104" xlink:to="loc_us-gaap_FairValueMeasurementFrequencyDomain_1330105_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueMeasurementsNonrecurringMember" xlink:label="loc_us-gaap_FairValueMeasurementsNonrecurringMember_1330106" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementFrequencyDomain_1330105" xlink:to="loc_us-gaap_FairValueMeasurementsNonrecurringMember_1330106" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueByFairValueHierarchyLevelAxis" xlink:label="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_823" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisTable_822" xlink:to="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_823" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueMeasurementsFairValueHierarchyDomain" xlink:label="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_823" xlink:to="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueMeasurementsFairValueHierarchyDomain" xlink:label="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_FairValueByFairValueHierarchyLevelAxis_823" xlink:to="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueInputsLevel1Member" xlink:label="loc_us-gaap_FairValueInputsLevel1Member_1330069" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824" xlink:to="loc_us-gaap_FairValueInputsLevel1Member_1330069" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueInputsLevel2Member" xlink:label="loc_us-gaap_FairValueInputsLevel2Member_1330070" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824" xlink:to="loc_us-gaap_FairValueInputsLevel2Member_1330070" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_FairValueInputsLevel3Member" xlink:label="loc_us-gaap_FairValueInputsLevel3Member_826" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueMeasurementsFairValueHierarchyDomain_824" xlink:to="loc_us-gaap_FairValueInputsLevel3Member_826" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillFairValueDisclosure" xlink:label="loc_us-gaap_GoodwillFairValueDisclosure_827" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_FairValueAssetsAndLiabilitiesMeasuredOnRecurringAndNonrecurringBasisLineItems_825" xlink:to="loc_us-gaap_GoodwillFairValueDisclosure_827" use="optional" order="12" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentReportingInformationLineItems" xlink:label="loc_us-gaap_SegmentReportingInformationLineItems_842" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable" xlink:label="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_840" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_842" xlink:to="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_840" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_843" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_840" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_843" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_841" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_843" xlink:to="loc_us-gaap_SegmentDomain_841" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_841_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_843" xlink:to="loc_us-gaap_SegmentDomain_841_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_844" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_841" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_844" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAxis" xlink:label="loc_us-gaap_BusinessAcquisitionAxis_1312422" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_840" xlink:to="loc_us-gaap_BusinessAcquisitionAxis_1312422" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1312423" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_1312422" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1312423" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionAcquireeDomain" xlink:label="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1312423_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_BusinessAcquisitionAxis_1312422" xlink:to="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1312423_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_BusinessCombinationCreditAgreementMember" xlink:label="loc_mhh_BusinessCombinationCreditAgreementMember_1312561" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_BusinessAcquisitionAcquireeDomain_1312423" xlink:to="loc_mhh_BusinessCombinationCreditAgreementMember_1312561" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_NumberOfReportableSegments" xlink:label="loc_us-gaap_NumberOfReportableSegments_845" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_842" xlink:to="loc_us-gaap_NumberOfReportableSegments_845" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessAcquisitionEffectiveDateOfAcquisition1" xlink:label="loc_us-gaap_BusinessAcquisitionEffectiveDateOfAcquisition1_846" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_842" xlink:to="loc_us-gaap_BusinessAcquisitionEffectiveDateOfAcquisition1_846" use="optional" order="11" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfOperatingSegmentsDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentReportingInformationLineItems" xlink:label="loc_us-gaap_SegmentReportingInformationLineItems_853" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable" xlink:label="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_851" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_851" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_ConsolidationItemsAxis" xlink:label="loc_srt_ConsolidationItemsAxis_849" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_851" xlink:to="loc_srt_ConsolidationItemsAxis_849" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_ConsolidationItemsDomain" xlink:label="loc_srt_ConsolidationItemsDomain_850" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_ConsolidationItemsAxis_849" xlink:to="loc_srt_ConsolidationItemsDomain_850" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_ConsolidationItemsDomain" xlink:label="loc_srt_ConsolidationItemsDomain_850_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_ConsolidationItemsAxis_849" xlink:to="loc_srt_ConsolidationItemsDomain_850_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingSegmentsMember" xlink:label="loc_us-gaap_OperatingSegmentsMember_855" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_ConsolidationItemsDomain_850" xlink:to="loc_us-gaap_OperatingSegmentsMember_855" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_854" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_851" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_854" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_852" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_854" xlink:to="loc_us-gaap_SegmentDomain_852" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_852_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_854" xlink:to="loc_us-gaap_SegmentDomain_852_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_856" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_852" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_856" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ITStaffingServicesMember" xlink:label="loc_mhh_ITStaffingServicesMember_857" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_852" xlink:to="loc_mhh_ITStaffingServicesMember_857" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Revenues" xlink:label="loc_us-gaap_Revenues_858" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_Revenues_858" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_GrossMarginPercentage" xlink:label="loc_mhh_GrossMarginPercentage_859" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_mhh_GrossMarginPercentage_859" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OperatingIncomeLoss" xlink:label="loc_us-gaap_OperatingIncomeLoss_860" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_OperatingIncomeLoss_860" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_AmortizationOfIntangibleAssets" xlink:label="loc_us-gaap_AmortizationOfIntangibleAssets_861" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_AmortizationOfIntangibleAssets_861" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_GoodwillImpairmentLoss" xlink:label="loc_us-gaap_GoodwillImpairmentLoss_466576" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_GoodwillImpairmentLoss_466576" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SegmentReconciliationAdjustmentEmploymentRelatedClaimNetOfRecoveries" xlink:label="loc_mhh_SegmentReconciliationAdjustmentEmploymentRelatedClaimNetOfRecoveries_1330101" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_mhh_SegmentReconciliationAdjustmentEmploymentRelatedClaimNetOfRecoveries_1330101" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_MalpracticeLossContingencyClaimsIncurredNet" xlink:label="loc_us-gaap_MalpracticeLossContingencyClaimsIncurredNet_1329986" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_MalpracticeLossContingencyClaimsIncurredNet_1329986" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SeveranceCosts1" xlink:label="loc_us-gaap_SeveranceCosts1_1329987" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_SeveranceCosts1_1329987" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1" xlink:label="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_466575" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_BusinessCombinationContingentConsiderationArrangementsChangeInAmountOfContingentConsiderationLiability1_466575" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_BusinessCombinationAcquisitionRelatedCosts" xlink:label="loc_us-gaap_BusinessCombinationAcquisitionRelatedCosts_466577" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_BusinessCombinationAcquisitionRelatedCosts_466577" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_InterestExpenseForeignExchangeGainsOrLossesAndOtherNet" xlink:label="loc_mhh_InterestExpenseForeignExchangeGainsOrLossesAndOtherNet_1330029" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_mhh_InterestExpenseForeignExchangeGainsOrLossesAndOtherNet_1330029" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest" xlink:label="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_866" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_853" xlink:to="loc_us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest_866" use="optional" order="22" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfAssetsBySegmentDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentReportingAssetReconcilingItemLineItems" xlink:label="loc_us-gaap_SegmentReportingAssetReconcilingItemLineItems_871" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ReconciliationOfAssetsFromSegmentToConsolidatedTable" xlink:label="loc_us-gaap_ReconciliationOfAssetsFromSegmentToConsolidatedTable_869" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SegmentReportingAssetReconcilingItemLineItems_871" xlink:to="loc_us-gaap_ReconciliationOfAssetsFromSegmentToConsolidatedTable_869" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementBusinessSegmentsAxis" xlink:label="loc_us-gaap_StatementBusinessSegmentsAxis_872" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ReconciliationOfAssetsFromSegmentToConsolidatedTable_869" xlink:to="loc_us-gaap_StatementBusinessSegmentsAxis_872" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_870" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_872" xlink:to="loc_us-gaap_SegmentDomain_870" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentDomain" xlink:label="loc_us-gaap_SegmentDomain_870_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementBusinessSegmentsAxis_872" xlink:to="loc_us-gaap_SegmentDomain_870_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_DataAndAnalyticsServicesMember" xlink:label="loc_mhh_DataAndAnalyticsServicesMember_873" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_870" xlink:to="loc_mhh_DataAndAnalyticsServicesMember_873" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ITStaffingServicesMember" xlink:label="loc_mhh_ITStaffingServicesMember_874" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentDomain_870" xlink:to="loc_mhh_ITStaffingServicesMember_874" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Assets" xlink:label="loc_us-gaap_Assets_875" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingAssetReconcilingItemLineItems_871" xlink:to="loc_us-gaap_Assets_875" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_DepreciationAmortizationAndAccretionNet" xlink:label="loc_us-gaap_DepreciationAmortizationAndAccretionNet_1330149" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingAssetReconcilingItemLineItems_871" xlink:to="loc_us-gaap_DepreciationAmortizationAndAccretionNet_1330149" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PaymentsAndCapitalExpendituresIncurredButNotYetPaidToAcquirePropertyPlantAndEquipment" xlink:label="loc_mhh_PaymentsAndCapitalExpendituresIncurredButNotYetPaidToAcquirePropertyPlantAndEquipment_877" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingAssetReconcilingItemLineItems_871" xlink:to="loc_mhh_PaymentsAndCapitalExpendituresIncurredButNotYetPaidToAcquirePropertyPlantAndEquipment_877" use="optional" order="9" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/BusinessSegmentsAndGeographicInformationSummaryOfRevenueFromExternalCustomersDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SegmentReportingInformationLineItems" xlink:label="loc_us-gaap_SegmentReportingInformationLineItems_882" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable" xlink:label="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_880" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_882" xlink:to="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_880" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_StatementGeographicalAxis" xlink:label="loc_srt_StatementGeographicalAxis_883" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfSegmentReportingInformationBySegmentTable_880" xlink:to="loc_srt_StatementGeographicalAxis_883" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_881" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_StatementGeographicalAxis_883" xlink:to="loc_srt_SegmentGeographicalDomain_881" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_SegmentGeographicalDomain" xlink:label="loc_srt_SegmentGeographicalDomain_881_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_StatementGeographicalAxis_883" xlink:to="loc_srt_SegmentGeographicalDomain_881_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_US" xlink:label="loc_country_US_884" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_881" xlink:to="loc_country_US_884" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/country/2023/country-2023.xsd#country_CA" xlink:label="loc_country_CA_885" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_881" xlink:to="loc_country_CA_885" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_IndiaAndOtherMember" xlink:label="loc_mhh_IndiaAndOtherMember_886" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_SegmentGeographicalDomain_881" xlink:to="loc_mhh_IndiaAndOtherMember_886" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_Revenues" xlink:label="loc_us-gaap_Revenues_887" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_882" xlink:to="loc_us-gaap_Revenues_887" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_PropertyPlantAndEquipmentNet" xlink:label="loc_us-gaap_PropertyPlantAndEquipmentNet_888" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SegmentReportingInformationLineItems_882" xlink:to="loc_us-gaap_PropertyPlantAndEquipmentNet_888" use="optional" order="9" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/RelatedPartyTransactionsAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyTransactionLineItems" xlink:label="loc_us-gaap_RelatedPartyTransactionLineItems_1325410" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_ScheduleOfRelatedPartyTransactionsByRelatedPartyTable" xlink:label="loc_us-gaap_ScheduleOfRelatedPartyTransactionsByRelatedPartyTable_1325409" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_RelatedPartyTransactionLineItems_1325410" xlink:to="loc_us-gaap_ScheduleOfRelatedPartyTransactionsByRelatedPartyTable_1325409" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyTransactionsByRelatedPartyAxis" xlink:label="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1325411" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_ScheduleOfRelatedPartyTransactionsByRelatedPartyTable_1325409" xlink:to="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1325411" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyDomain" xlink:label="loc_us-gaap_RelatedPartyDomain_1325412" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1325411" xlink:to="loc_us-gaap_RelatedPartyDomain_1325412" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyDomain" xlink:label="loc_us-gaap_RelatedPartyDomain_1325412_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1325411" xlink:to="loc_us-gaap_RelatedPartyDomain_1325412_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_CrowdstrikeIncMember" xlink:label="loc_mhh_CrowdstrikeIncMember_1325413" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RelatedPartyDomain_1325412" xlink:to="loc_mhh_CrowdstrikeIncMember_1325413" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TermOfAgreement" xlink:label="loc_mhh_TermOfAgreement_1330136" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RelatedPartyTransactionLineItems_1325410" xlink:to="loc_mhh_TermOfAgreement_1330136" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyTransactionPurchasesFromRelatedParty" xlink:label="loc_us-gaap_RelatedPartyTransactionPurchasesFromRelatedParty_1325414" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RelatedPartyTransactionLineItems_1325410" xlink:to="loc_us-gaap_RelatedPartyTransactionPurchasesFromRelatedParty_1325414" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyTransactionAmountsOfTransaction" xlink:label="loc_us-gaap_RelatedPartyTransactionAmountsOfTransaction_1330033" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RelatedPartyTransactionLineItems_1325410" xlink:to="loc_us-gaap_RelatedPartyTransactionAmountsOfTransaction_1330033" use="optional" order="8" />
</definitionLink>
<definitionLink xlink:type="extended" xlink:role="http://www.mastech.com/role/SubsequentEventAdditionalInformationDetail">
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventLineItems" xlink:label="loc_us-gaap_SubsequentEventLineItems_1330091" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTable" xlink:label="loc_us-gaap_SubsequentEventTable_1330078" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_us-gaap_SubsequentEventTable_1330078" xbrldt:contextElement="segment" xbrldt:closed="true" use="optional" order="1" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeAxis" xlink:label="loc_us-gaap_SubsequentEventTypeAxis_1330082" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_us-gaap_SubsequentEventTypeAxis_1330082" use="optional" order="2" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_1330083" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_1330082" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_1330083" use="optional" order="3" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventTypeDomain" xlink:label="loc_us-gaap_SubsequentEventTypeDomain_1330083_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_SubsequentEventTypeAxis_1330082" xlink:to="loc_us-gaap_SubsequentEventTypeDomain_1330083_default" use="optional" order="4" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_SubsequentEventMember" xlink:label="loc_us-gaap_SubsequentEventMember_1330084" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventTypeDomain_1330083" xlink:to="loc_us-gaap_SubsequentEventMember_1330084" use="optional" order="5" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/dei/2023/dei-2023.xsd#dei_LegalEntityAxis" xlink:label="loc_dei_LegalEntityAxis_1330079" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_dei_LegalEntityAxis_1330079" use="optional" order="6" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/dei/2023/dei-2023.xsd#dei_EntityDomain" xlink:label="loc_dei_EntityDomain_1330080" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_dei_LegalEntityAxis_1330079" xlink:to="loc_dei_EntityDomain_1330080" use="optional" order="7" />
<loc xlink:type="locator" xlink:href="https://xbrl.sec.gov/dei/2023/dei-2023.xsd#dei_EntityDomain" xlink:label="loc_dei_EntityDomain_1330080_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_dei_LegalEntityAxis_1330079" xlink:to="loc_dei_EntityDomain_1330080_default" use="optional" order="8" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PrimentorIncMember" xlink:label="loc_mhh_PrimentorIncMember_1330081" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_dei_EntityDomain_1330080" xlink:to="loc_mhh_PrimentorIncMember_1330081" use="optional" order="9" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentsAxis" xlink:label="loc_us-gaap_OtherCommitmentsAxis_1330129" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_us-gaap_OtherCommitmentsAxis_1330129" use="optional" order="10" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentsDomain" xlink:label="loc_us-gaap_OtherCommitmentsDomain_1330130" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_OtherCommitmentsAxis_1330129" xlink:to="loc_us-gaap_OtherCommitmentsDomain_1330130" use="optional" order="11" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentsDomain" xlink:label="loc_us-gaap_OtherCommitmentsDomain_1330130_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_OtherCommitmentsAxis_1330129" xlink:to="loc_us-gaap_OtherCommitmentsDomain_1330130_default" use="optional" order="12" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ConsultingServicesAgreementMember" xlink:label="loc_mhh_ConsultingServicesAgreementMember_1330131" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_OtherCommitmentsDomain_1330130" xlink:to="loc_mhh_ConsultingServicesAgreementMember_1330131" use="optional" order="13" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_StatementEquityComponentsAxis" xlink:label="loc_us-gaap_StatementEquityComponentsAxis_1330085" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_us-gaap_StatementEquityComponentsAxis_1330085" use="optional" order="14" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1330086" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1330085" xlink:to="loc_us-gaap_EquityComponentDomain_1330086" use="optional" order="15" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_EquityComponentDomain" xlink:label="loc_us-gaap_EquityComponentDomain_1330086_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_StatementEquityComponentsAxis_1330085" xlink:to="loc_us-gaap_EquityComponentDomain_1330086_default" use="optional" order="16" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualAxis" xlink:label="loc_srt_TitleOfIndividualAxis_1330088" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_srt_TitleOfIndividualAxis_1330088" use="optional" order="17" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualWithRelationshipToEntityDomain" xlink:label="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_srt_TitleOfIndividualAxis_1330088" xlink:to="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089" use="optional" order="18" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/srt/2023/elts/srt-2023.xsd#srt_TitleOfIndividualWithRelationshipToEntityDomain" xlink:label="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_srt_TitleOfIndividualAxis_1330088" xlink:to="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089_default" use="optional" order="19" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_MurthyMember" xlink:label="loc_mhh_MurthyMember_1330090" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089" xlink:to="loc_mhh_MurthyMember_1330090" use="optional" order="20" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SanguptaMember" xlink:label="loc_mhh_SanguptaMember_1330100" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089" xlink:to="loc_mhh_SanguptaMember_1330100" use="optional" order="21" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_MurthyAndSanguptaMember" xlink:label="loc_mhh_MurthyAndSanguptaMember_1330132" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_srt_TitleOfIndividualWithRelationshipToEntityDomain_1330089" xlink:to="loc_mhh_MurthyAndSanguptaMember_1330132" use="optional" order="22" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyTransactionsByRelatedPartyAxis" xlink:label="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1330161" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="loc_us-gaap_SubsequentEventTable_1330078" xlink:to="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1330161" use="optional" order="23" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyDomain" xlink:label="loc_us-gaap_RelatedPartyDomain_1330162" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1330161" xlink:to="loc_us-gaap_RelatedPartyDomain_1330162" use="optional" order="24" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_RelatedPartyDomain" xlink:label="loc_us-gaap_RelatedPartyDomain_1330162_default" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="loc_us-gaap_RelatedPartyTransactionsByRelatedPartyAxis_1330161" xlink:to="loc_us-gaap_RelatedPartyDomain_1330162_default" use="optional" order="25" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_SharesFromFoundersMember" xlink:label="loc_mhh_SharesFromFoundersMember_1330163" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_RelatedPartyDomain_1330162" xlink:to="loc_mhh_SharesFromFoundersMember_1330163" use="optional" order="26" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_TermOfAgreementOfConsultancyServices" xlink:label="loc_mhh_TermOfAgreementOfConsultancyServices_1330124" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_mhh_TermOfAgreementOfConsultancyServices_1330124" use="optional" order="27" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentDueInNextTwelveMonths" xlink:label="loc_us-gaap_OtherCommitmentDueInNextTwelveMonths_1330092" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_us-gaap_OtherCommitmentDueInNextTwelveMonths_1330092" use="optional" order="28" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentDueInSecondYear" xlink:label="loc_us-gaap_OtherCommitmentDueInSecondYear_1330093" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_us-gaap_OtherCommitmentDueInSecondYear_1330093" use="optional" order="29" />
<loc xlink:type="locator" xlink:href="https://xbrl.fasb.org/us-gaap/2023/elts/us-gaap-2023.xsd#us-gaap_OtherCommitmentDueInThirdYear" xlink:label="loc_us-gaap_OtherCommitmentDueInThirdYear_1330094" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_us-gaap_OtherCommitmentDueInThirdYear_1330094" use="optional" order="30" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_ShareBasedCompensationByShareBasedNumberOfSharesCoveredForTheOptionsToBeIssuedAndExercised" xlink:label="loc_mhh_ShareBasedCompensationByShareBasedNumberOfSharesCoveredForTheOptionsToBeIssuedAndExercised_1330133" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_mhh_ShareBasedCompensationByShareBasedNumberOfSharesCoveredForTheOptionsToBeIssuedAndExercised_1330133" use="optional" order="31" />
<loc xlink:type="locator" xlink:href="mhh-20231231.xsd#mhh_PercentageOfStockOutstandingIssuable" xlink:label="loc_mhh_PercentageOfStockOutstandingIssuable_1330135" />
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/domain-member" xlink:from="loc_us-gaap_SubsequentEventLineItems_1330091" xlink:to="loc_mhh_PercentageOfStockOutstandingIssuable_1330135" use="optional" order="32" />
</definitionLink>
</linkbase>
