In MagicDraw  (or other modeling tool developed by No Magic Inc.) version 17.0.1, the UML metamodel has only one package - UML, and all UML metadata exist in this package. All UML metadata can be found in com.nomagic.uml2.ext.magicdraw.metadata.UMLPackage. For example:

EAttribute nameAttribute = UMLPackage.Literals.NAMED_ELEMENT__NAME;

UML model elements can be created using the EMF factory com.nomagic.uml2.ext.magicdraw.metadata.UMLFactory. For example:

Component component = UMLFactory.eINSTANCE.createComponent();

In version 17.0.1, an element created using the EMF factory will be placed in the repository that does not belong to any project. The created object will be automatically added into the project’s repository after it will be added into the container that is in the project’s repository.

All UML model elements are directly or indirectly contained by EMF resources. Resource of an element can be retrieved in the standard way:

Element element;
org.eclipse.emf.ecore.resource.Resource resource = element.eResource();

There is no strict definition how EMF resources are organized in MagicDraw project. It depends on the project type (local, from Teamwork Server or from the Teamwork Cloud server).