Repository avatar
Developer Tools
v0.3.2
active

mcp

io.senlo/mcp

Transactional email from your coding agent: templates, triggers, automations and tests in Senlo.

Documentation

Senlo MCP server

Your coding agent creates transactional emails in Senlo: the template, the trigger your code sends, an automation if you need one, and a test email in your inbox. You don't open the editor. The templates are ordinary Senlo templates, so anyone on the team can open them in the visual editor and change them later.

"Add password reset. The email goes through Senlo."

The agent writes the endpoint, creates the Password reset template and its trigger, puts the send call in your code and sends a test to you.

A remote MCP server over Streamable HTTP, a thin layer over Senlo's API v1. It holds no data and never touches a database: it passes your API key, or on Senlo Cloud your checked OAuth token, on to Senlo, and Senlo decides what it may do. MIT licensed.

Tools

GroupToolWhat it does
GeneralwhoamiThe workspace, permissions and instance behind the connection
Generalget_guideThe format rules: design document blocks, automation format, step types, examples
Templateslist_templatesThe workspace's templates
Templatesget_templateOne template with its design document, with warnings
Templatescreate_templateCreates a template from a design document; dry_run only checks it
Templatesupdate_templateChanges a template and keeps the previous version; dry_run only checks it
Templatespreview_templateThe rendered HTML and text, with your variables
Templatessend_testA test email to a member of the organization
Triggerslist_triggersTriggers with their ids and variables
Triggersget_triggerOne trigger: template, sender, variables
Triggerscreate_triggerThe trigger your code sends, for a template
Triggersupdate_triggerChanges a trigger
Automationslist_automationsAutomations and their status
Automationsget_automationThe graph and settings as an export, with warnings
Automationslist_eventsThe events the workspace gets, with the fields of their payloads
Automationscreate_automationCreates a draft; dry_run only checks it
Automationsupdate_automationReplaces an automation's draft
Automationsset_automation_statusGoes live or pauses
Automationstest_automationA test run for a member of the organization
Automationsget_automation_runHow a test run went, step by step
Codeget_send_snippetThe code for your backend that sends a trigger or an event (which starts automations): JavaScript, Python, PHP or curl

What it deliberately can't do:

  • Delete. Remove what you don't need in Senlo yourself.
  • Send real email to anyone. Tests go only to members of the organization (self-hosted: the project owner). Your app sends real email with its own key.

Every change an agent makes is kept as a version, marked "MCP", and can be restored in the editor's History.

Creating or changing a template or an automation also answers warnings: what saved but is probably wrong, such as an event the workspace never got, a field its events never carried, email variants with no fallback, or a button to a site's home page. The agent is told to fix them or tell you.

Connect

AddressSign-in
Senlo Cloudhttps://mcp.senlo.io/mcpOAuth: sign in and pick a workspace, no key
Self-hosted Senlohttps://<your-senlo>/mcpA Senlo API key with the manage permission

Step-by-step setup for each client is in the docs: Connect your coding agent. Check the connection by asking the agent: "Call Senlo whoami."

Senlo Cloud

  • Claude (web, desktop, mobile): Settings → Connectors → Add custom connector, https://mcp.senlo.io/mcp.
  • Claude Code: claude mcp add --scope user --transport http senlo https://mcp.senlo.io/mcp, then /mcp → Authenticate.
  • ChatGPT (web, paid plans): Plugins → + → Add custom MCP server, https://mcp.senlo.io/mcp, authentication OAuth.
  • Cursor: { "mcpServers": { "senlo": { "url": "https://mcp.senlo.io/mcp" } } } in ~/.cursor/mcp.json, then Connect in Settings → Tools & MCP.

Any other client with remote MCP servers over Streamable HTTP and OAuth works with the same address.

Self-hosted, with an API key

Create a key with the manage permission in the project's API keys. Keep it apart from the key your app sends with (send): the agent's key can't send real email, and your app's key can't change templates.

claude mcp add --transport http senlo https://<your-senlo>/mcp \
  --header "Authorization: Bearer snl_..."

To share the setup with your team without the key, put it in .mcp.json at the repository root; Claude Code fills in the variable from each developer's environment:

{
  "mcpServers": {
    "senlo": {
      "type": "http",
      "url": "https://<your-senlo>/mcp",
      "headers": { "Authorization": "Bearer ${SENLO_MCP_KEY}" }
    }
  }
}

Cursor and other clients take the same url and headers.

Self-hosting

The image is ghcr.io/igorfilippov3/senlo-mcp (:latest for releases, :0.3 for the newest 0.3.x, :main for the newest commit; amd64 and arm64). Next to Senlo's own compose file, in docker-compose.override.yml:

services:
  mcp:
    image: ghcr.io/igorfilippov3/senlo-mcp:latest
    container_name: senlo-mcp
    restart: always
    ports:
      - "127.0.0.1:3100:3000"
    environment:
      # Senlo inside the compose network.
      SENLO_API_URL: http://app:3000
      # Senlo as your app reaches it: the send snippets use this address.
      SENLO_PUBLIC_URL: https://senlo.example.com
    depends_on:
      - app

Then route /mcp to it in your reverse proxy. Caddy:

senlo.example.com {
    handle /mcp* {
        reverse_proxy 127.0.0.1:3100 {
            header_up X-Real-IP {remote_host}
        }
    }
    handle {
        reverse_proxy 127.0.0.1:3000 {
            header_up X-Real-IP {remote_host}
        }
    }
}

nginx, checks and updating: MCP server in Senlo's self-hosting docs. The server answers GET /health with 200; the image's health check uses it.

Environment variables

VariableDefault
SENLO_API_URL(required)Where the server calls Senlo's API v1. May be an internal address
SENLO_PUBLIC_URLSENLO_API_URLThe Senlo address in the send snippets: the one your app reaches
PORT3000
HOST0.0.0.0
MCP_PATH/mcpThe MCP endpoint's path
MCP_ALLOWED_ORIGINS(none)Browser origins allowed to call the server, comma-separated hostnames. Agents and desktop clients send no Origin and are always allowed
SENLO_OAUTH_ISSUER(none)OAuth: the authorization server (its tokens' iss). Set with MCP_RESOURCE_URL to turn OAuth on
MCP_RESOURCE_URL(none)OAuth: this server's public URL as users enter it, ending in MCP_PATH (its tokens' aud)
SENLO_MCP_SECRET(none)OAuth: the shared secret sent to Senlo with every call, 32+ characters, the same value as Senlo's. Senlo accepts OAuth tokens only with it, and trusts the client address (Senlo-Client-Ip, taken from X-Real-IP) only next to it: run the server behind a proxy that overwrites X-Real-IP
SENLO_OAUTH_DEBUG(off)1 logs the claims of every accepted OAuth token (never the token). For checking the setup only

Without the OAuth variables the server accepts Senlo API keys only, which is how a self-hosted install runs it. With them (Senlo Cloud) it also accepts access tokens from the authorization server: it checks each one (signature, issuer, audience, expiry), answers 401 with a WWW-Authenticate challenge that points clients at /.well-known/oauth-protected-resource, and passes a valid token to Senlo with the shared secret. API keys keep working next to OAuth.

The server is stateless: run as many copies as you like behind a load balancer. It logs JSON lines to stdout.

Development

Node 22 and pnpm.

pnpm install
cp .env.example .env            # SENLO_API_URL of a Senlo with API v1
pnpm dev                        # http://localhost:3000/mcp, reloads on change
pnpm typecheck
pnpm test
pnpm build && pnpm start

pnpm dev reads .env if there is one (Node's --env-file-if-exists); variables already set in the shell win. To try it against a local Senlo, npx @modelcontextprotocol/inspector and connect to http://localhost:3000/mcp with the header Authorization: Bearer snl_....

The tests run the real server in process, with an MCP client in front and a fake Senlo behind (test/fake-senlo.ts): no network, no Senlo needed.

License

MIT

No installation packages available.

Remote