MPManager, also known as Matte Pass Manager, is a script for 3ds Max from developer colinsenner. It creates matte passes by layers, and it works with xrefs.
The script ships as two MaxScript files, MPManager_v1.03.ms and MPManager_Functions.ms, and this release is marked version 1.03. Compatibility covers 3ds Max 2008 and later, so it runs across a wide span of releases. A demo video is available for those who want to see more before installing.
MPManager appears in the scriptspot library, where it currently sits at popularity rank 894. This catalog lists it as free; for current licensing and any further details, check colinsenner's page. If your work involves building matte passes by layers in scenes that use xrefs, this script covers that specific task.