EmailTemplateMCP

EmailTemplateMCP

Generates email templates via Claude, turning a description (with optional tone and brand name) into a subject, plain-text, and HTML email body.

Category
Visit Server

README

EmailTemplateMCP

A minimal MCP server that generates email templates with Claude — one tool, one file, deployed as a single AWS Lambda function behind a public Function URL. No framework, no MCP SDK dependency: the JSON-RPC dispatch is ~130 lines of plain JavaScript.

This is the reference implementation used in the "Build an MCP server from scratch" video series.

What it does

Exposes a single tool, create_email_template, which takes a description of an email's purpose (plus optional tone and brand name) and returns a subject line, a plain-text body, and an inline-styled HTML body — generated by Claude in one call.

{
  "name": "create_email_template",
  "arguments": {
    "description": "welcome email for new SaaS signups",
    "tone": "friendly",
    "brand_name": "Acme"
  }
}

Why no MCP SDK?

MCP isn't a library you install — it's a protocol: JSON-RPC 2.0 over HTTP. This project implements initialize, tools/list, and tools/call directly in the Lambda handler, so there's nothing to learn beyond reading index.mjs top to bottom. The only real dependency is the Anthropic SDK, used to actually generate the email content.

Output shape is enforced server-side via Anthropic's structured output (output_config.format.json_schema), so there's no fragile hand-rolled JSON parsing of the model's response.

Why a Function URL, not API Gateway?

Generating an email is a real model call — it can take 10-20+ seconds. API Gateway's HTTP API has a hard, non-configurable 30-second integration timeout. A Lambda Function URL has no such ceiling; the only limit is the function's own configured timeout (set here to ~2 minutes).

Deploying

Option A — one command, via AWS SAM

template.yaml in this repo defines the whole thing — the function, its Function URL, and both environment variables — so you don't have to click through the console at all.

sam build
sam deploy --guided

--guided walks you through stack name, region, and the two secret parameters (AnthropicApiKey, McpApiKey — both NoEcho, never printed or stored in plain text in the template) on first run, then remembers your answers in samconfig.toml for future deploys. On success it prints the Function URL as an output.

Requires the AWS SAM CLI and valid AWS credentials configured locally.

Option B — manual, via the Lambda console

  1. npm install — pulls in the Anthropic SDK.
  2. Zip the folder's contents (not the folder itself) — index.mjs, node_modules, package.json, package-lock.json should sit at the zip's top level.
  3. In the Lambda console: Create function → author from scratch → Node.js 22+ → upload the zip.
  4. Configuration → General configuration: raise Timeout (e.g. 2 min) and Memory (e.g. 256 MB) — the defaults (3s / 128MB) aren't enough for a real generation call.
  5. Configuration → Environment variables:
    • ANTHROPIC_API_KEY — from the Anthropic console.
    • MCP_API_KEY — a secret you invent (any long random string). This is the shared secret every caller must present.
    • ANTHROPIC_MODEL — optional, defaults to claude-opus-5.
  6. Configuration → Function URL: create one with Auth type NONE. This doesn't mean unauthenticated — it means AWS isn't checking IAM signatures. MCP_API_KEY is the actual gate, checked on every request inside the handler.

Authentication

Every request must include the shared secret, either as a header:

x-api-key: <MCP_API_KEY>

or a query parameter:

?key=<MCP_API_KEY>

Requests without a valid key get a 401 before anything else runs — including before any call to Anthropic, so a bad key never costs you a generation.

Testing it directly

# List tools
curl -s https://<your-function-url> \
  -H "x-api-key: <MCP_API_KEY>" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

# Call the tool
curl -s https://<your-function-url> \
  -H "x-api-key: <MCP_API_KEY>" \
  -H "content-type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"create_email_template","arguments":{"description":"welcome email for new signups"}}}'

Connecting an MCP client

For Claude Code:

claude mcp add --transport http email-template https://<your-function-url> \
  --header "x-api-key: <MCP_API_KEY>"

Any MCP-compatible client that supports plain header auth over Streamable HTTP works the same way.

Project structure

index.mjs          — the entire server: tool definition, Anthropic call, JSON-RPC dispatch
package.json        — the one runtime dependency

Security note

MCP_API_KEY and ANTHROPIC_API_KEY are both plain environment variables — never hardcode them in index.mjs. If you've ever shown this function's configuration on screen (a demo, a screen recording), rotate both values afterward.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured