add-smtp-config
Configure SMTP server settings for sending emails by specifying host, port, credentials, and security options. Add multiple configurations to manage email delivery through the SMTP MCP Server.
Instructions
Add a new SMTP configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the SMTP configuration | |
| host | Yes | SMTP host | |
| port | Yes | SMTP port | |
| secure | No | Whether to use secure connection (SSL/TLS) | |
| user | Yes | SMTP username | |
| pass | Yes | SMTP password | |
| isDefault | No | Whether this configuration should be the default |
Implementation Reference
- src/requestHandler.ts:241-285 (handler)The main handler function that executes the 'add-smtp-config' tool. It generates a unique ID, creates the SMTP config object from parameters, handles setting as default by unsetting others, appends to list, and saves.async function handleAddSmtpConfig(parameters: any) { try { // Get existing configs const configs = await getSmtpConfigs(); // Create a new config const newConfig: SmtpServerConfig = { id: generateUUID(), name: parameters.name, host: parameters.host, port: parameters.port, secure: parameters.secure ?? false, auth: { user: parameters.user, pass: parameters.pass }, isDefault: parameters.isDefault ?? false }; // If this is set as default, update other configs if (newConfig.isDefault) { configs.forEach(config => { config.isDefault = false; }); } // Add the new config to the list configs.push(newConfig); // Save the updated configs await saveSmtpConfigs(configs); return { success: true, config: newConfig }; } catch (error) { logToFile('Error in handleAddSmtpConfig:'); logToFile(error instanceof Error ? error.message : 'Unknown error'); return { success: false, message: error instanceof Error ? error.message : 'Unknown error' }; } }
- src/tools.ts:188-225 (schema)The tool schema definition for 'add-smtp-config', including input schema with properties and required fields."add-smtp-config": { name: "add-smtp-config", description: "Add a new SMTP configuration", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the SMTP configuration" }, host: { type: "string", description: "SMTP host" }, port: { type: "number", description: "SMTP port" }, secure: { type: "boolean", description: "Whether to use secure connection (SSL/TLS)" }, user: { type: "string", description: "SMTP username" }, pass: { type: "string", description: "SMTP password" }, isDefault: { type: "boolean", description: "Whether this configuration should be the default" } }, required: ["name", "host", "port", "user", "pass"] } },
- src/requestHandler.ts:78-79 (registration)The switch case registration in the CallToolRequestHandler that dispatches 'add-smtp-config' tool calls to the specific handler function.case "add-smtp-config": return await handleAddSmtpConfig(toolParams);