Documentation

Libraries & CLI

Official Node and Python SDKs, a CLI, and an MCP server — all published and ready to install.

Node SDK

Install
npm install mailstein

Construct a client with your key (or set MAILSTEIN_API_KEY) and use resource methods: emails, domains, contacts, contactBooks, campaigns, analytics, webhooks.

Node.js
import { Mailstein } from "mailstein";

const mailstein = new Mailstein("ms_your_api_key");

const { data, error } = await mailstein.emails.send({
  from: "hello@yourdomain.com",
  to: "customer@example.com",
  subject: "Hi",
  html: "<p>Hello</p>",
});

Python SDK

Install
pip install mailstein

Methods return a (result, error) tuple.

Python
from mailstein import Mailstein

client = Mailstein("ms_your_api_key")

email, err = client.emails.send({
    "from": "hello@yourdomain.com",
    "to": "customer@example.com",
    "subject": "Hi",
    "html": "<p>Hello</p>",
})
if err:
    raise RuntimeError(err)

CLI

Install
npm install -g mailstein-cli

The mailstein CLI reads MAILSTEIN_API_KEY from the environment.

Shell
export MAILSTEIN_API_KEY=ms_your_api_key

mailstein whoami                 # show the authenticated account
mailstein domains                # list sending domains
mailstein emails                 # list recent emails
mailstein emails send \
  --from hello@yourdomain.com \
  --to customer@example.com \
  --subject "Hi" --html "<p>Hello</p>"

MCP server

The MCP server lets an AI assistant (e.g. Claude) send and inspect mail through mailstein. It exposes three tools: send_email, list_domains, and get_email.

claude mcp add
claude mcp add mailstein \
  -e MAILSTEIN_API_KEY=ms_your_api_key \
  -- npx mailstein-mcp
All of the above authenticate with the same ms_ API key and hit the same live API, so quotas, suppression and analytics stay consistent no matter how you send.