MCP¶
listmonk has a built-in Model Context Protocol (MCP) server at /api/mcp that lets AI agents and tools manage subscribers, lists, campaigns, templates, bounces, and transactional messages. The server exposes 26 tools covering these operations; it does not expose every /api/* endpoint. Template changes, media, imports, settings, and user management are not exposed. They work automatically with API users created in Settings -> Users and inherit their permissions.
Setup¶
- Create a User role with the permissions an AI agent should have.
- Create an API user (Admin -> Users -> New, type: API) with the roles and copy its token.
- Add the MCP server to the agent with the
Authorization: token api_user:tokenheader.
The tools listed to the agent are filtered by the API user's permissions.
Requests with an Origin header must match the origin of app.root_url or an explicit URL in security.trusted_urls. The * CORS wildcard does not permit arbitrary origins for MCP. Non-browser clients may omit Origin.
The server supports protocol versions 2025-11-25, 2025-06-18, and 2025-03-26. Requests are limited to 1 MiB and tool arguments must match the advertised schema.
AI agents¶
Instructions for connecting listmonk MCP to various AI agents. Replace api_user and token with the generated tokens.
Claude Code¶
claude mcp add --transport http listmonk https://listmonk.yoursite.com/api/mcp \
--header "Authorization: token api_user:token"
Codex (~/.codex/config.toml)¶
[mcp_servers.listmonk]
url = "https://listmonk.yoursite.com/api/mcp"
http_headers = { "Authorization" = "token api_user:token" }
OpenCode¶
opencode mcp add listmonk --url https://listmonk.yoursite.com/api/mcp \
--header "Authorization=token api_user:token"
Pi¶
pi mcp add listmonk --url https://listmonk.yoursite.com/api/mcp \
--header "Authorization=token api_user:token"
Generic JSON config¶
{
"mcpServers": {
"listmonk": {
"type": "http",
"url": "https://listmonk.yoursite.com/api/mcp",
"headers": {
"Authorization": "token api_user:token"
}
}
}
}
Warning
An agent can do everything that the API user's permissions allow, including destructive actions. Assign relevant permissions carefully.