What you're describing is the function of a Cryptographic Key Management System. A key manager will contain several components: a Hardware Security Module (HSM, generally with a PKCS#11 interface) to securely store the master key and to encrypt/decrypt client keys; a database of encrypted client keys; some kind of server with an interface to grant authenticated users access to their keys; and a management function that allows an administrator to bind to the HSM, manage the database, manage users, permissions, access rules, backup and recover keys, log access to the keys, etc.
Some KMS will only serve as a bare-bones key manager, while others will offer cryptography as a service, and can encrypt/decrypt user data or sign documents without the user's key ever leaving the secured perimeter of the KMS.
Key manager services deliver keys and cryptographic functions via interfaces, which are offered in a variety of protocols. Probably the most notable standard in the space that you might consider is the Key Management Interoperability Protocol (KMIP), a binary protocol defined by OASIS and supported by many vendors in the space. KMS vendors that have been in the business a long time usually come with ancient legacy proprietary interfaces (that you might want to ignore); more modern key managers include RESTful API access to cryptographic keys and functions.
Key managers will often incorporate a certificate management system, too; allowing the KMS to not only generate keys, but issue certificates for those keys or users.
Key managers also offer a variety of authentication options. All offer some simple form of username/password access. Those with certificate functions may offer mutual TLS authentication. Many integrate with other authentication, including OIDC/JWT, LDAP integration, AWS, GCP, Kerberos, etc.
There are both open source and commercial offerings in this space. The commercial systems used by major banks and financial institutions are generally very expensive, but they deliver pre-built servers that comes with a full suite of tamper protection and even physical armor. Some big cloud vendors (GCP, AWS, Azure, etc.) offer key management as an integrated service; they can replicate your keys for you so they're highly available wherever your servers are. There are also companies offering dedicated standalone key management services you can contract with.
I would caution against building your own system without more information. The well-known risks of "rolling your own cryptography" strongly apply to key management. A key management server is usually protecting keys that encrypt business critical data. Getting the service secured is therefore a critical security function; any vulnerabilities will be magnified in importance.