Building an MCP Email Server with AISend
What is MCP and why build an email server
The Model Context Protocol (MCP) is an open standard for connecting AI assistants like Claude to external tools and data sources. An MCP server exposes capabilities (tools, resources, prompts) that AI assistants can use during conversations. An MCP email server gives Claude the ability to send emails, check delivery status, and manage email templates — all through a standardized protocol. Unlike custom tool implementations that are tied to a specific LLM provider, MCP servers work with any MCP-compatible client. Build once, use with Claude Desktop, Claude Code, and any future MCP client.
Setting up your MCP server project
Create a new Node.js project for your MCP server. Install the MCP SDK (@modelcontextprotocol/sdk) and the AISend SDK or use fetch for API calls. Structure your project with a server entry point that registers tools and handles requests. The MCP SDK provides a Server class that manages the protocol communication — you just define your tools and their handlers. Initialize the AISend client with your API key (stored in an environment variable), and you're ready to define email tools.
Implementing email tools
Define three core tools for your MCP email server. First, send_email: accepts to, subject, html, and optional cc/bcc fields, calls AISend's POST /v1/emails endpoint, and returns the email ID and status. Second, check_email_status: accepts an email ID, calls GET /v1/emails/:id, and returns the delivery status. Third, generate_template: accepts a description string, calls AISend's template generation API, and returns the HTML template. Each tool is defined with a JSON Schema for its inputs and a handler function that executes the API call. The MCP SDK handles serialization and protocol communication automatically.
Connecting to Claude Desktop
To use your MCP email server with Claude Desktop, add it to your Claude Desktop configuration file (claude_desktop_config.json). Specify the command to start your server (e.g., node server.js) and any environment variables (AISEND_API_KEY). When Claude Desktop starts, it launches your server process and discovers the available tools. You can then ask Claude to send emails during your conversations: 'Send an email to team@example.com summarizing today's meeting notes.' Claude will use your MCP server's send_email tool to deliver the message through AISend.
Production considerations
For production MCP email servers, add authentication and authorization checks in your tool handlers. Validate that the requested recipient is in an approved list. Log all email sending requests with the full conversation context for auditing. Implement rate limiting to prevent excessive email sending. Consider adding a confirmation step — return a preview of the email as a tool result and require the user to confirm before actually sending. AISend's webhook events let you track delivery status, which your MCP server can expose as a resource that Claude can query. Publish your MCP server as an npm package so other developers can install and use it with their own AISend credentials.
Related Posts
Ready to Send Smarter Emails?
3,000 emails/month free. No credit card required.