To retrieve the Custom Metadata and the associated custom fields using package.xml in Salesforce, check the following package.xml.
Sample package.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Test__mdt</members>
<name>CustomObject</name>
</types>
<version>54.0</version>
</Package>
Sample Custom Metadata Type:
Retrieved metadata:
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<fields>
<fullName>Active_Date__c</fullName>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<label>Active Date</label>
<required>false</required>
<type>Date</type>
</fields>
<fields>
<fullName>Is_Active__c</fullName>
<defaultValue>false</defaultValue>
<externalId>false</externalId>
<fieldManageability>DeveloperControlled</fieldManageability>
<label>Is Active?</label>
<type>Checkbox</type>
</fields>
<label>Test</label>
<pluralLabel>Tests</pluralLabel>
<visibility>Public</visibility>
</CustomObject>