Skip to main content
Glama
samihalawa

SMTP MCP Server

get-smtp-configs

Retrieve all SMTP server configurations for email sending, including connection details and authentication settings.

Instructions

Get all SMTP configurations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the 'get-smtp-configs' tool. Calls getSmtpConfigs() from config.ts and returns the SMTP configurations wrapped in a success object or an error message.
    async function handleGetSmtpConfigs() {
      try {
        const configs = await getSmtpConfigs();
        
        return {
          success: true,
          configs: configs
        };
      } catch (error) {
        logToFile('Error in handleGetSmtpConfigs:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
  • Tool schema definition for 'get-smtp-configs', including name, description, and empty input schema (no parameters required). This is part of createToolDefinitions() used for MCP tool registration.
    "get-smtp-configs": {
      name: "get-smtp-configs",
      description: "Get all SMTP configurations",
      inputSchema: {
        type: "object",
        properties: {},
        required: []
      }
    },
  • Core helper function that reads and returns the list of SMTP server configurations from the JSON config file, falling back to defaults on error.
    export async function getSmtpConfigs(): Promise<SmtpServerConfig[]> {
      try {
        const config = await fs.readJson(SMTP_CONFIG_FILE) as SmtpConfig;
        return config.smtpServers || [];
      } catch (error) {
        logToFile('Error reading SMTP config:');
        return DEFAULT_SMTP_CONFIG.smtpServers;
      }
    }
  • Registration/dispatch case in the main CallToolRequestSchema handler switch statement that routes 'get-smtp-configs' tool calls to the specific handler function.
    case "get-smtp-configs":
      return await handleGetSmtpConfigs();
  • Type definition for SMTP server configuration objects returned by the tool.
    export interface SmtpServerConfig {
      id: string;
      name: string;
      host: string;
      port: number;
      secure: boolean;
      auth: {
        user: string;
        pass: string;
      };
      isDefault: boolean;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/mcp-server-smtp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server