Skip to main content
Glama
Senlo MCP server

Senlo MCP server

README.md
# Senlo MCP server

Your coding agent creates transactional emails in [Senlo](https://senlo.io): 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 never touches a database and doesn't check tokens itself: it passes your key on to Senlo, and Senlo decides what it may do. MIT licensed.

## Tools

| Group | Tool | What it does |
| --- | --- | --- |
| General | `whoami` | The workspace, permissions and instance behind the connection |
| General | `get_guide` | The format rules: design document blocks, automation format, step types, examples |
| Templates | `list_templates` | The workspace's templates |
| Templates | `get_template` | One template with its design document |
| Templates | `create_template` | Creates a template from a design document; `dry_run` only checks it |
| Templates | `update_template` | Changes a template and keeps the previous version; `dry_run` only checks it |
| Templates | `preview_template` | The rendered HTML and text, with your variables |
| Templates | `send_test` | A test email to a member of the organization |
| Triggers | `list_triggers` | Triggers with their ids and variables |
| Triggers | `get_trigger` | One trigger: template, sender, variables |
| Triggers | `create_trigger` | The trigger your code sends, for a template |
| Triggers | `update_trigger` | Changes a trigger |
| Automations | `list_automations` | Automations and their status |
| Automations | `get_automation` | The graph and settings as an export |
| Automations | `create_automation` | Creates a draft; `dry_run` only checks it |
| Automations | `update_automation` | Replaces an automation's draft |
| Automations | `set_automation_status` | Goes live or pauses |
| Automations | `test_automation` | A test run for a member of the organization |
| Automations | `get_automation_run` | How a test run went, step by step |
| Code | `get_send_snippet` | The send call for your backend: 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.

## Connect

You need a Senlo API key with the **manage** permission (create one in the project's API keys and turn on *manage*). 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.

The server's address is `https://<your-senlo>/mcp` on a self-hosted install, see [Self-hosting](#self-hosting). Senlo Cloud gets a hosted server with OAuth sign-in soon.

### Claude Code

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

Add `--scope user` to have it in every project. 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:

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

Check with `/mcp` in Claude Code, then ask: *"Call Senlo whoami."*

### Cursor

`~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (this one):

```json
{
  "mcpServers": {
    "senlo": {
      "url": "https://<your-senlo>/mcp",
      "headers": { "Authorization": "Bearer snl_..." }
    }
  }
}
```

### Other clients

Any client with remote MCP servers over Streamable HTTP and custom headers works: the URL above and the header `Authorization: Bearer snl_...`. Clients that only connect with OAuth (claude.ai, ChatGPT) need Senlo Cloud's OAuth sign-in, which is coming.

## Self-hosting

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

```yaml
services:
  mcp:
    image: ghcr.io/igorfilippov3/senlo-mcp:latest
    container_name: senlo-mcp
    restart: always
    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 senlo-mcp:3000
    }
    handle {
        reverse_proxy senlo-app:3000
    }
}
```

The server answers `GET /health` with `200`; the image's health check uses it.

### Environment variables

| Variable | Default | |
| --- | --- | --- |
| `SENLO_API_URL` | (required) | Where the server calls Senlo's API v1. May be an internal address |
| `SENLO_PUBLIC_URL` | `SENLO_API_URL` | The Senlo address in the send snippets: the one your app reaches |
| `PORT` | `3000` | |
| `HOST` | `0.0.0.0` | |
| `MCP_PATH` | `/mcp` | The 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 |

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.

```bash
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` doesn't read `.env` by itself: `set -a; . ./.env; set +a; pnpm dev`, or pass the variables inline. 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](LICENSE)