mailtea-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mailtea
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,165 @@
1
+ # `mailtea-mcp`
2
+
3
+ Mailtea MCP server — let AI agents (Claude Code, Cursor, Codex, …) **send, schedule, and manage email** over the Model Context Protocol. MIT-licensed.
4
+
5
+ ## Quick start
6
+
7
+ Connect Claude Code in one command:
8
+
9
+ ```bash
10
+ claude mcp add mailtea \
11
+ -e MAILTEA_API_TOKEN=mt_pat_xxxxxxxx \
12
+ -- npx -y mailtea-mcp
13
+ ```
14
+
15
+ Create the token (prefix `mt_pat_`) in **Settings → API keys**, then ask your agent to send an email. It calls `email.send` and the message goes out through Mailtea.
16
+
17
+ The server defaults to the Mailtea cloud API. Self-hosting or running locally? Add `-e MAILTEA_API_BASE_URL=http://localhost:8787` (and optional `-e MAILTEA_PUBLICATION_ID=pub_demo`).
18
+
19
+ ## Tool families
20
+
21
+ - `email.*` — `email.send`, `email.batch`, `email.get`, `email.list`, `email.analytics`, `email.reschedule`, `email.cancel`, `email.resend` (transactional, one-shot to specific recipients; `resend` retries a failed/bounced email)
22
+ - `email.inbound_*` — received email: `inbound_list`, `inbound_get`, `inbound_list_attachments`, `inbound_get_attachment`, `inbound_reply` (auto-threaded; only `inbound_list` needs publicationId)
23
+ - `auth.*`
24
+ - `issue.*` — newsletter drafts + sends to the whole list, plus `publish_to_web` / `unpublish_from_web`
25
+ - `template.*` — reusable email templates: `create`, `list`, `get`, `update`, `publish`, `duplicate`, `delete`
26
+ - `publication.*`
27
+ - `domain.*` — sending domains: add, read DNS records, verify, then send from it
28
+ - `contact.*` — incl. `get`, `delete`, `get_properties`, `set_properties`
29
+ - `contact_property.*` — custom contact fields
30
+ - `segment.*` — saved, filter-based audience segments
31
+ - `tag.*` — tag definitions
32
+ - `webhook.*` — outbound event subscriptions
33
+ - `api_key.*` — manage API keys (requires `settings:write`)
34
+ - `analytics.*`
35
+ - `section.*`
36
+
37
+ Current resources:
38
+
39
+ - `publication://current/brand-guidelines`
40
+ - `mailtea://capabilities`
41
+ - `analytics://current/latest-summary`
42
+
43
+ Current prompts:
44
+
45
+ - `newsletter.draft_from_brief`
46
+ - `newsletter.subject_line_pack`
47
+
48
+ ## Build
49
+
50
+ ```bash
51
+ pnpm --filter mailtea-mcp build
52
+ ```
53
+
54
+ ## Run locally over stdio
55
+
56
+ ```bash
57
+ export MAILTEA_API_BASE_URL=http://localhost:8787
58
+ export MAILTEA_API_TOKEN=<BETTER_AUTH_SESSION_OR_PAT_TOKEN>
59
+ export MAILTEA_PUBLICATION_ID=pub_demo
60
+
61
+ node packages/mcp/dist/stdio.js
62
+ ```
63
+
64
+ Required env:
65
+
66
+ - `MAILTEA_API_BASE_URL`
67
+ - `MAILTEA_API_TOKEN`
68
+
69
+ Optional env:
70
+
71
+ - `MAILTEA_PUBLICATION_ID`
72
+
73
+ ## Copy-paste stdio config pattern
74
+
75
+ If your MCP client accepts a stdio server definition, this is the minimal pattern:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "mailtea": {
81
+ "command": "node",
82
+ "args": ["/absolute/path/to/mailtea/packages/mcp/dist/stdio.js"],
83
+ "env": {
84
+ "MAILTEA_API_BASE_URL": "http://localhost:8787",
85
+ "MAILTEA_API_TOKEN": "<BETTER_AUTH_SESSION_OR_PAT_TOKEN>",
86
+ "MAILTEA_PUBLICATION_ID": "pub_demo"
87
+ }
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ Use this as the starting point for:
94
+
95
+ - Codex-style MCP clients
96
+ - Claude Code-style MCP clients
97
+ - Cursor/OpenCode-style MCP clients
98
+ - internal agent launchers
99
+
100
+ The exact config file location varies by client, but the process contract above stays the same.
101
+
102
+ ## Copy-paste remote MCP pattern
103
+
104
+ If your client supports remote MCP over HTTP, point it at Mailtea API:
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "mailtea": {
110
+ "url": "http://localhost:8787/mcp",
111
+ "headers": {
112
+ "Authorization": "Bearer <BETTER_AUTH_SESSION_OR_PAT_TOKEN>"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
119
+ Remote MCP is useful when:
120
+
121
+ - the agent runtime cannot launch a local stdio process
122
+ - you want one shared Mailtea control plane for multiple clients
123
+ - you are testing integrations from another machine or container
124
+
125
+ Safe remote smoke:
126
+
127
+ ```bash
128
+ MAILTEA_API_BASE_URL=http://localhost:8787 \
129
+ MAILTEA_API_TOKEN=<BETTER_AUTH_SESSION_OR_PAT_TOKEN> \
130
+ pnpm deploy:smoke:mcp
131
+ ```
132
+
133
+ ## First useful calls
134
+
135
+ Start with this sequence:
136
+
137
+ 1. `email.send`
138
+ 2. `publication.list`
139
+ 3. `issue.create_draft`
140
+ 4. `issue.update_draft`
141
+ 5. `contact.list`
142
+ 6. `analytics.latest_summary`
143
+
144
+ That verifies the full loop:
145
+
146
+ - discover workspace
147
+ - draft content
148
+ - inspect audience
149
+ - inspect outcomes
150
+
151
+ ## When to use MCP instead of direct API calls
152
+
153
+ Use `mailtea-mcp` when you want:
154
+
155
+ - a compact tool catalog
156
+ - prompt and resource support
157
+ - less custom tool-wrapping work
158
+ - better interoperability across coding agents
159
+
160
+ Use the API directly when you need:
161
+
162
+ - a browser action layer
163
+ - a non-MCP builder
164
+ - full transport control
165
+ - custom HTTP orchestration
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ // Executable entry for `npx mailtea-mcp` / the `mailtea-mcp` bin. Importing the
3
+ // built stdio server starts it (it wires up the readline JSON-RPC loop on load).
4
+ import "../dist/stdio.js";