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.
The fastest path: the published aisend-mcp server
You don't have to build one from scratch — AISend publishes a ready MCP server on npm. Install it with `npm install -g aisend-mcp`, add a small block to your MCP client config with your AISEND_API_KEY, and Claude or Cursor gets eight email tools immediately: send_email, get_email_status, list_emails, validate_email, list_domains, list_api_keys, create_api_key, and agent_signup. If that covers your use case, you're done — the rest of this guide is for when you want to wrap AISend in your own server with custom business rules.
{
"mcpServers": {
"aisend": {
"command": "aisend-mcp",
"env": { "AISEND_API_KEY": "re_your_api_key" }
}
}
}Building your own: set up the project
If you need custom logic (approval steps, allowlists, your own tool names), build a thin server around the AISend API. Create a Node.js project, install the MCP SDK (@modelcontextprotocol/sdk), and use fetch for the API calls. The MCP SDK provides a Server class that manages the protocol — you define your tools and their handlers, read your AISend key from an environment variable, and register the tools you need.
Implementing email tools
Two tools cover most needs. First, send_email: accepts to, subject, html, and optional cc/bcc, calls AISend's POST /emails endpoint (Resend-compatible), and returns the email ID and status — note the from address must be on a domain you've verified. Second, check_email_status: accepts an email ID, calls GET /emails/:id, and returns the delivery status. Keep each tool a thin wrapper over one API call so the LLM's intent maps cleanly to one action.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const server = new McpServer({ name: "aisend-email", version: "1.0.0" });
server.tool(
"send_email",
{
to: z.string().email(),
subject: z.string(),
html: z.string(),
},
async ({ to, subject, html }) => {
const res = await fetch("https://api.aisend.app/api/v1/emails", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AISEND_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
from: "agent@mail.yourapp.com",
to, subject, html,
}),
});
const data = await res.json();
return { content: [{ type: "text", text: JSON.stringify(data) }] };
}
);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.