EL

Elastic Email MCP Server for AI Agents

Enable AI agents with full-scale email operations using Elastic Email's MCP server, compatible with popular AI tools for seamless protocol-based integration.

Quick Install
npx -y @ElasticEmail/elasticemail-mcp-server

Overview

This MCP server implements the Model Context Protocol (MCP) for Elastic Email, exposing email operations to AI agents and other MCP-aware tools. Run alongside your AI tooling, it translates protocol requests into Elastic Email API calls so agents can list contacts, create campaigns, send transactional or bulk mail, manage templates, and more — all through standardized MCP tools.

The server is most useful when you want an AI assistant (for example in VS Code Copilot Agents or other MCP-compatible agents) to perform full-scale email workflows programmatically and safely, without embedding your Elastic Email API logic into the agent itself. It centralizes authentication, API interaction, and provides discrete, discoverable tools the agent can call.

Features

  • Exposes Elastic Email operations as discrete MCP tools (campaigns, segments, templates, contacts, sending)
  • Health check tool to validate Elastic Email API connectivity
  • Support for bulk and transactional email sends (use templates or raw content)
  • Contact-list management, including upload and per-list operations
  • Campaign creation, updates, and statistics retrieval (open/click counts)
  • Simple authentication via X-Auth-Token header for API key usage
  • Designed for straightforward integration with MCP-aware developer tools and agents

Requirements

  • .NET SDK 10 or higher installed
  • An Elastic Email API key (server forwards requests to Elastic Email)
  • Port 5001 must be available (the server listens on http://localhost:5001 by default)

Installation / Configuration

  1. Clone the repository and open it with your .NET-capable IDE or terminal:
git clone https://github.com/ElasticEmail/elasticemail-mcp-server.git
cd elasticemail-mcp-server
  1. Build and run with .NET SDK 10+:
dotnet build
dotnet run

By default the server expects to be reachable at http://localhost:5001/. Ensure that port is open and not blocked by firewall.

  1. Provide your Elastic Email API key to clients (agents) through the X-Auth-Token header. Example MCP client/server entry (JSON):
"my-server-unique-number": {
  "url": "http://localhost:5001/",
  "headers": {
    "X-Auth-Token": "YOUR_ELASTICEMAIL_API_KEY"
  }
}

Security note: keep your API key secret. When integrating with agents, prefer local development contexts or securely injected secrets in CI/CD.

Available Tools / Resources

The server exposes grouped tools that map to Elastic Email capabilities. Key tools include:

  • HealthCheck

    • HealthCheck.IsReady — verify Elastic Email API is reachable
  • CampaignManagement

    • CreateCampaign, ListCampaigns, GetCampaign, UpdateCampaign, Pause
    • GetAllCampaignStatistics, GetCampaignStatistics
  • SegmentsManagement

    • CreateSegment, GetSegments, GetSegment
  • TemplateManagement

    • FetchTemplate, FetchTemplates
  • EmailSending

    • SendBulkEmails — send to multiple recipients or contact lists
    • SendTransactionalEmail — send transactional messages (single/targeted)
  • ContactsManagement

    • FetchContacts, FetchContactHistory, FetchLists, FetchList, FetchListContacts
    • AddContactToList, RemoveContactsToList, CreateList
    • AddContact, DeleteContacts, UploadContacts

You can think of each of the above as an individual MCP “tool” an agent can discover and invoke.

Table (summary)

DomainExample Tools
HealthHealthCheck.IsReady
CampaignsCreateCampaign, ListCampaigns, GetCampaignStatistics
SendingSendBulkEmails, SendTransactionalEmail
ContactsFetchContacts, AddContact, UploadContacts
Templates & SegmentsFetchTemplates, CreateSegment

Integration with Copilot Agents (VS Code)

To use with VS Code Copilot Agents:

  1. Open the project folder (or any folder containing your MCP settings.json).
  2. Open a Chat window and switch the Agent mode.
  3. Add the MCP server configuration (example above) to settings.json and add that file as a context to the agent.
  4. Open the “Select tools…” panel (screwdriver/wrench icon) and ensure the MCP server tools are enabled.
  5. Start the agent. It will discover the MCP tools and can call them directly.

Example settings snippet (add to agent contexts):

{
  "mcpServers": {
    "elasticemail-local": {
      "url": "http://localhost:5001/",
      "headers": {
        "X-Auth-Token": "YOUR_ELASTICEMAIL_API_KEY"
      }
    }
  }
}

Use Cases

  • Automated Campaign Management

    • An agent can create a campaign, attach a template, target a segment, and start the campaign via CampaignManagement.CreateCampaign and UpdateCampaign. Use GetCampaignStatistics to monitor opens/clicks.
  • Transactional Email from App Events

    • When a user signs up, an agent or workflow can call EmailSending.SendTransactionalEmail to deliver welcome messages using a stored template.
  • Contact List Operations via Chat Agent

    • Non-technical users can instruct an AI assistant to “Add this CSV of leads to the ‘Newsletter’ list.” The assistant uploads the file via ContactsManagement.UploadContacts and adds addresses to the list.
  • Reporting and Health Monitoring

    • Periodic checks (HealthCheck.IsReady) ensure Elastic Email is reachable; scheduled agents can call GetAllCampaignStatistics to create recurring reports.

Tips and Best Practices

  • Use separate API keys with least privilege for automated agents.
  • Test in a local or staging Elastic Email account before sending production campaigns.
  • Limit exposure of the server to trusted local or network environments; do not publish unsecured endpoints with API keys in headers.
  • Use the HealthCheck tool as a first step in any automated workflow to prevent actions when the Elastic Email API is unavailable.

This MCP server provides a protocol-first bridge between AI agents and Elastic Email, enabling safer, discoverable, and repeatable email workflows driven by agent logic.