@sinch/mcp
Version:
Sinch MCP server
37 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMailgunApiKey = exports.getMailgunCredentials = void 0;
const types_1 = require("../../../types");
// TODO: Replace this method with a getMailgunService() method that will return the SinchClient once the Mailgun service is implemented.
const getMailgunCredentials = (domain) => {
let credentials = undefined;
const mailgunDomain = domain || process.env.MAILGUN_DOMAIN;
const apiKey = process.env.MAILGUN_API_KEY;
if (mailgunDomain && apiKey) {
credentials = {
domain: mailgunDomain,
apiKey: apiKey
};
}
if (!mailgunDomain || !credentials) {
let errorMessage = '';
if (!mailgunDomain) {
errorMessage = 'The "domain" is not provided and "MAILGUN_DOMAIN" is not set in the environment variables.';
}
if (!apiKey) {
errorMessage += '"MAILGUN_API_KEY" is not set in the environment variables. The property is required to use the emails related tools.';
}
return new types_1.PromptResponse(errorMessage);
}
return credentials;
};
exports.getMailgunCredentials = getMailgunCredentials;
const getMailgunApiKey = () => {
const apiKey = process.env.MAILGUN_API_KEY;
if (!apiKey) {
return new types_1.PromptResponse('The "MAILGUN_API_KEY" environment variable is not set. The property is required to use the emails related tools.');
}
return apiKey;
};
exports.getMailgunApiKey = getMailgunApiKey;
//# sourceMappingURL=mailgun-service-helper.js.map