langmail-mcp 0.0.0-stage → 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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +211 -2
  3. package/THIRD_PARTY_NOTICES.md +388 -0
  4. package/dist/attachments/download.js +69 -0
  5. package/dist/attachments/routes.js +42 -0
  6. package/dist/attachments/tickets.js +45 -0
  7. package/dist/attachments/upload-tickets.js +43 -0
  8. package/dist/attachments/upload.js +136 -0
  9. package/dist/caldav/account-settings.js +92 -0
  10. package/dist/caldav/agenda.js +277 -0
  11. package/dist/caldav/alarm.js +97 -0
  12. package/dist/caldav/client.js +408 -0
  13. package/dist/caldav/ical.js +248 -0
  14. package/dist/caldav/occurrence.js +534 -0
  15. package/dist/caldav/recurrence.js +313 -0
  16. package/dist/caldav/rsvp.js +107 -0
  17. package/dist/caldav/scheduling-handover.js +22 -0
  18. package/dist/caldav/timezone.js +103 -0
  19. package/dist/caldav/types.js +5 -0
  20. package/dist/config.js +219 -0
  21. package/dist/contacts/address-class.js +79 -0
  22. package/dist/contacts/birthdays.js +81 -0
  23. package/dist/contacts/card.js +58 -0
  24. package/dist/contacts/constants.js +46 -0
  25. package/dist/contacts/fold.js +309 -0
  26. package/dist/contacts/index.js +10 -0
  27. package/dist/contacts/merge.js +388 -0
  28. package/dist/contacts/observations.js +115 -0
  29. package/dist/contacts/profile.js +402 -0
  30. package/dist/contacts/scoring.js +146 -0
  31. package/dist/contacts/types.js +7 -0
  32. package/dist/contacts/upsert.js +131 -0
  33. package/dist/drafts/attachments.js +254 -0
  34. package/dist/drafts/idempotency.js +60 -0
  35. package/dist/drafts/send-guard.js +184 -0
  36. package/dist/email-render/email-viewer.html +143 -0
  37. package/dist/email-render/image-proxy.js +389 -0
  38. package/dist/email-render/meta.js +48 -0
  39. package/dist/email-render/sanitize.js +93 -0
  40. package/dist/email-render/viewer-resource.js +104 -0
  41. package/dist/http/bearer.js +30 -0
  42. package/dist/http/guard.js +57 -0
  43. package/dist/http/hosts.js +10 -0
  44. package/dist/http/listener.js +170 -0
  45. package/dist/http/routes.js +72 -0
  46. package/dist/ical/ical-parse.js +357 -0
  47. package/dist/ical/index.js +4 -0
  48. package/dist/ical/timezone.js +22 -0
  49. package/dist/ical/windows-zones.js +155 -0
  50. package/dist/index.js +79 -0
  51. package/dist/jmap/blob.js +49 -0
  52. package/dist/jmap/contacts.js +226 -0
  53. package/dist/jmap/drafts.js +480 -0
  54. package/dist/jmap/email.js +668 -0
  55. package/dist/jmap/index.js +12 -0
  56. package/dist/jmap/keywords.js +22 -0
  57. package/dist/jmap/live.js +21 -0
  58. package/dist/jmap/origin.js +113 -0
  59. package/dist/jmap/patch.js +29 -0
  60. package/dist/jmap/request.js +37 -0
  61. package/dist/jmap/session.js +89 -0
  62. package/dist/jmap/sieve.js +71 -0
  63. package/dist/jmap/submission.js +107 -0
  64. package/dist/jmap/timeout.js +30 -0
  65. package/dist/jmap/types.js +6 -0
  66. package/dist/logger.js +48 -0
  67. package/dist/mcp/handler.js +255 -0
  68. package/dist/mcp/http.js +29 -0
  69. package/dist/mcp/instructions.js +44 -0
  70. package/dist/mcp/links.js +64 -0
  71. package/dist/mcp/tool-logging.js +67 -0
  72. package/dist/observability/errors.js +41 -0
  73. package/dist/rules/apply.js +236 -0
  74. package/dist/rules/rule.js +280 -0
  75. package/dist/rules/store.js +92 -0
  76. package/dist/tools/annotations.js +71 -0
  77. package/dist/tools/archive-emails.js +40 -0
  78. package/dist/tools/calendar-lookup.js +64 -0
  79. package/dist/tools/contact-common.js +146 -0
  80. package/dist/tools/contact-format.js +72 -0
  81. package/dist/tools/contact-write-through.js +37 -0
  82. package/dist/tools/create-calendar-event.js +231 -0
  83. package/dist/tools/create-calendar.js +54 -0
  84. package/dist/tools/create-contact.js +172 -0
  85. package/dist/tools/create-draft.js +369 -0
  86. package/dist/tools/create-mail-rule.js +101 -0
  87. package/dist/tools/delete-calendar-event.js +165 -0
  88. package/dist/tools/delete-contact.js +60 -0
  89. package/dist/tools/delete-draft.js +129 -0
  90. package/dist/tools/delete-mail-rule.js +38 -0
  91. package/dist/tools/download-attachment.js +90 -0
  92. package/dist/tools/download-email.js +112 -0
  93. package/dist/tools/draft-common.js +600 -0
  94. package/dist/tools/email-types.js +58 -0
  95. package/dist/tools/error-detail.js +10 -0
  96. package/dist/tools/file-emails-common.js +75 -0
  97. package/dist/tools/format.js +131 -0
  98. package/dist/tools/forward-message.js +237 -0
  99. package/dist/tools/forward-quote.js +179 -0
  100. package/dist/tools/get-draft.js +61 -0
  101. package/dist/tools/get-email.js +164 -0
  102. package/dist/tools/get-thread.js +67 -0
  103. package/dist/tools/keywords.js +43 -0
  104. package/dist/tools/list-calendar-events.js +180 -0
  105. package/dist/tools/list-calendars.js +44 -0
  106. package/dist/tools/list-drafts.js +134 -0
  107. package/dist/tools/list-mail-rules.js +28 -0
  108. package/dist/tools/list-unsubscribe.js +152 -0
  109. package/dist/tools/list-upcoming-birthdays.js +165 -0
  110. package/dist/tools/mail-rule-common.js +43 -0
  111. package/dist/tools/mail-rule-format.js +79 -0
  112. package/dist/tools/mailbox-lookup.js +13 -0
  113. package/dist/tools/mark-emails.js +78 -0
  114. package/dist/tools/merge-contacts.js +145 -0
  115. package/dist/tools/move-calendar-events.js +340 -0
  116. package/dist/tools/move-emails.js +64 -0
  117. package/dist/tools/one-click-post.js +275 -0
  118. package/dist/tools/preview-email.js +204 -0
  119. package/dist/tools/preview-mail-rule.js +79 -0
  120. package/dist/tools/reply-quote.js +426 -0
  121. package/dist/tools/reply-to-message.js +292 -0
  122. package/dist/tools/respond-to-event.js +110 -0
  123. package/dist/tools/result.js +9 -0
  124. package/dist/tools/search-contacts.js +431 -0
  125. package/dist/tools/search-emails.js +570 -0
  126. package/dist/tools/send-draft.js +308 -0
  127. package/dist/tools/trash-emails.js +36 -0
  128. package/dist/tools/unsubscribe-from-list.js +249 -0
  129. package/dist/tools/update-calendar-event.js +973 -0
  130. package/dist/tools/update-calendar.js +100 -0
  131. package/dist/tools/update-contact.js +382 -0
  132. package/dist/tools/update-draft.js +714 -0
  133. package/dist/tools/update-mail-rule.js +103 -0
  134. package/dist/tools/upload-attachments.js +126 -0
  135. package/package.json +99 -5
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Langmail
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 CHANGED
@@ -1,3 +1,212 @@
1
- # Temporary Holding Version
1
+ # Langmail MCP for your own Stalwart: email, calendar and contacts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `langmail-mcp` is an open-source MCP server ([Model Context Protocol](https://modelcontextprotocol.io)) for people who run a self-hosted [Stalwart](https://stalw.art) mail server. It gives an AI agent the email, calendar and contacts tools of [Langmail](https://langmail.me)'s hosted MCP server, and works against your own Stalwart over JMAP, CalDAV and CardDAV. It runs on your computer or on your server and talks only to your Stalwart; no Langmail service is involved.
4
+
5
+ Not affiliated with Stalwart Labs.
6
+
7
+ > **The first release is pending.** `langmail-mcp` is not on npm yet, so `npx -y langmail-mcp` does not work today. Until it is, run the server from a clone: `git clone https://github.com/langmail/langmail-mcp.git`, `cd langmail-mcp`, `npm ci`, `npm run build`, and use `node /path/to/langmail-mcp/dist/index.js` wherever this document says `npx -y langmail-mcp`.
8
+
9
+ ## What you can ask an agent to do with it
10
+
11
+ An agent connected to this server can search and read your mail, write drafts and send them, file and label messages, manage mail rules, and work with your calendars and contacts. The following prompts are examples of what that makes possible:
12
+
13
+ - "Find the email from the landlord about the heating repair. It was some time in 2023 and I cannot find it."
14
+ - "Summarise the conversation with the accountant about the tax return: what is done, what is still open, and what is waiting on my reply."
15
+ - "Draft a reply to Anna that proposes two free slots next week, and leave it in my drafts for me to review."
16
+
17
+ Reading mail does not mark it as read. Sending mail, unsubscribing and changing a meeting that other people are invited to cannot be undone, so it is sensible to have the agent confirm those with you first.
18
+
19
+ ## Install
20
+
21
+ The server needs Node.js 22 or later. There is nothing to install by hand: an MCP client starts the server with `npx -y langmail-mcp`, which downloads the package on first use. To have the `langmail-mcp` command available permanently, for example on a server, install it globally:
22
+
23
+ ```sh
24
+ npm install -g langmail-mcp
25
+ ```
26
+
27
+ ## Configure
28
+
29
+ All configuration comes from environment variables. The server checks them when it starts and refuses to start with a message that names what to set. Nothing has a default that points to a host other than your own.
30
+
31
+ | Variable | Required | Default | Meaning |
32
+ | --- | --- | --- | --- |
33
+ | `STALWART_URL` | yes | | Base URL of your Stalwart, for example `https://mail.example.com`. JMAP, CalDAV and CardDAV are reached under it. Use `https://`; the server warns about `http://` to any host but the local machine. |
34
+ | `STALWART_USERNAME` | with `STALWART_PASSWORD` | | The account's login name, usually its mail address. |
35
+ | `STALWART_PASSWORD` | with `STALWART_USERNAME` | | An app password for that account (see [Creating a Stalwart app password](#creating-a-stalwart-app-password)). |
36
+ | `STALWART_TOKEN` | instead of username and password | | A bearer token, for example a Stalwart API key. Set either this or the username and password, not both. |
37
+ | `MCP_TRANSPORT` | no | `stdio` | `stdio` or `http`. The command-line arguments `--http` and `--stdio` do the same and take precedence. |
38
+ | `MCP_AUTH_TOKEN` | in HTTP mode | | The secret callers must send as `Authorization: Bearer <secret>`. At least 16 printable ASCII characters without spaces. |
39
+ | `MCP_HOST` | no | `127.0.0.1` | HTTP mode: the address to listen on. |
40
+ | `MCP_PORT` | no | `8080` | HTTP mode: the port to listen on. |
41
+ | `MCP_PUBLIC_URL` | behind a reverse proxy | `http://<MCP_HOST>:<MCP_PORT>` | HTTP mode: the address callers reach the server under, for example `https://mcp.example.com`. |
42
+ | `LOG_LEVEL` | no | `warn` | `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`. `info` adds one line per tool call. Logs go to stderr. |
43
+ | `LANGMAIL_MCP_ALLOW_UNSUBSCRIBE_POST` | no | off | Set to `1` to let `unsubscribe_from_list` send a one-click unsubscribe request to the sender's URL. |
44
+ | `LANGMAIL_MCP_ALLOW_REMOTE_IMAGES` | no | off | Set to `1` to let `preview_email` load a message's remote images through this server. |
45
+
46
+ [`.env.example`](.env.example) lists the same settings with comments.
47
+
48
+ Your Stalwart must advertise the same public URL you set as `STALWART_URL` (same scheme, hostname and port). The server sends your credential to that address only: if Stalwart names another one for its JMAP or CalDAV endpoints, for example `http://` behind a TLS proxy or an internal hostname, the tool call fails with a message naming both addresses and nothing is sent to the other one.
49
+
50
+ ## Connect an agent
51
+
52
+ The server speaks MCP over two transports. Over **stdio**, the MCP client starts the server as a child process, which fits an agent that runs on the same computer. Over **Streamable HTTP**, the server runs on its own and the agent connects to it by URL, which fits an agent on a server.
53
+
54
+ ### On the same computer, over stdio
55
+
56
+ Most MCP clients read a JSON configuration of this shape. The file's name and location depend on the client.
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "langmail": {
62
+ "command": "npx",
63
+ "args": ["-y", "langmail-mcp"],
64
+ "env": {
65
+ "STALWART_URL": "https://mail.example.com",
66
+ "STALWART_USERNAME": "you@example.com",
67
+ "STALWART_PASSWORD": "your-app-password"
68
+ }
69
+ }
70
+ }
71
+ }
72
+ ```
73
+
74
+ For **Claude Desktop**, this is the content of `claude_desktop_config.json`, which opens from Settings, Developer, Edit Config. For **Claude Code**, one command adds the server:
75
+
76
+ ```sh
77
+ claude mcp add langmail \
78
+ -e STALWART_URL=https://mail.example.com \
79
+ -e STALWART_USERNAME=you@example.com \
80
+ -e STALWART_PASSWORD=your-app-password \
81
+ -- npx -y langmail-mcp
82
+ ```
83
+
84
+ The server does not contact Stalwart when it starts. A wrong URL or password therefore shows up on the agent's first tool call, not at start-up.
85
+
86
+ ### On a server, over Streamable HTTP
87
+
88
+ In HTTP mode the server listens at `/mcp`, on `127.0.0.1:8080` by default. It refuses to start without `MCP_AUTH_TOKEN`, and every caller must send that secret as `Authorization: Bearer <token>`. Any other request to `/mcp` is answered with `401` and no data. `openssl rand -hex 32` generates a suitable secret.
89
+
90
+ ```sh
91
+ export STALWART_URL=https://mail.example.com
92
+ export STALWART_USERNAME=you@example.com
93
+ export STALWART_PASSWORD=your-app-password
94
+ export MCP_AUTH_TOKEN="$(openssl rand -hex 32)"
95
+ npx langmail-mcp --http
96
+ # langmail-mcp: listening on http://127.0.0.1:8080/mcp
97
+ ```
98
+
99
+ `GET /healthz` answers `ok` without the token, for a process supervisor or a load balancer to check.
100
+
101
+ To keep the server running, a systemd unit along these lines can be used. The environment file holds the variables above, one `NAME=value` per line, and should be readable only by the service's user (`chmod 600`).
102
+
103
+ ```ini
104
+ # /etc/systemd/system/langmail-mcp.service
105
+ [Unit]
106
+ Description=Langmail MCP for Stalwart
107
+ After=network-online.target
108
+ Wants=network-online.target
109
+
110
+ [Service]
111
+ EnvironmentFile=/etc/langmail-mcp.env
112
+ ExecStart=/usr/bin/npx -y langmail-mcp --http
113
+ Restart=on-failure
114
+ User=langmail-mcp
115
+
116
+ [Install]
117
+ WantedBy=multi-user.target
118
+ ```
119
+
120
+ The default address is reachable from the same machine only, which is enough for an agent that runs on that machine. The server speaks plain HTTP. For that reason, TLS must be terminated by a reverse proxy before the server is exposed beyond loopback; otherwise the token and your mail travel unencrypted. With [Caddy](https://caddyserver.com), which obtains the certificate itself, the configuration is:
121
+
122
+ ```
123
+ mcp.example.com {
124
+ reverse_proxy 127.0.0.1:8080
125
+ }
126
+ ```
127
+
128
+ Behind a reverse proxy, `MCP_PUBLIC_URL` must be set to the address callers use, here `https://mcp.example.com`. The server only accepts requests addressed to a loopback name or to the host of `MCP_PUBLIC_URL`, as a protection against DNS rebinding, and answers `403` to a proxied request when the variable is missing. The links the attachment tools hand out are created under the same address.
129
+
130
+ A client then connects to a remote HTTP server with a bearer header. In Claude Code's `.mcp.json` format, which several other clients share:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "langmail": {
136
+ "type": "http",
137
+ "url": "https://mcp.example.com/mcp",
138
+ "headers": {
139
+ "Authorization": "Bearer your-mcp-auth-token"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ```
145
+
146
+ The equivalent Claude Code command is:
147
+
148
+ ```sh
149
+ claude mcp add --transport http langmail https://mcp.example.com/mcp \
150
+ --header "Authorization: Bearer your-mcp-auth-token"
151
+ ```
152
+
153
+ There is no OAuth flow. A client that can only connect to remote servers through OAuth, and cannot send a fixed header, cannot use this server over HTTP.
154
+
155
+ ## Creating a Stalwart app password
156
+
157
+ An **app password** is a separate password for one application, which can be revoked without changing the account's main password. Stalwart calls it by that name. Each user creates their own in Stalwart's account manager, which is served under `/account` on your Stalwart (for example `https://mail.example.com/account`). Stalwart shows the generated password once, so copy it when it is created. Stalwart's documentation describes the steps and the options: [App passwords](https://stalw.art/docs/auth/authentication/app-password/).
158
+
159
+ Set `STALWART_USERNAME` to the account's login name and `STALWART_PASSWORD` to the app password. The server signs in with HTTP Basic authentication. Alternatively, set `STALWART_TOKEN` to a Stalwart API key, which is sent as a bearer token.
160
+
161
+ ## Tools
162
+
163
+ The server registers 40 tools. Their names and inputs are the same as on Langmail's hosted server, so the Langmail documentation describes what each one does and how they fit together: <https://docs.langmail.me/reference/mcp/overview>. Their descriptions are the same too, except for a few sentences that are only true of the hosted service. A test compares every definition with the hosted server's and lists each of those rewordings: [`src/mcp/hosted-parity.test.ts`](src/mcp/hosted-parity.test.ts).
164
+
165
+ | Group | Tools |
166
+ | --- | --- |
167
+ | Mail | `search_emails`, `get_email`, `get_thread`, `preview_email`, `archive_emails`, `move_emails`, `trash_emails`, `mark_emails`, `unsubscribe_from_list` |
168
+ | Drafts and sending | `create_draft`, `get_draft`, `list_drafts`, `update_draft`, `delete_draft`, `send_draft`, `reply_to_message`, `forward_message` |
169
+ | Attachments | `download_attachment`, `download_email`, `upload_attachments` |
170
+ | Mail rules | `preview_mail_rule`, `create_mail_rule`, `list_mail_rules`, `update_mail_rule`, `delete_mail_rule` |
171
+ | Calendar | `list_calendars`, `create_calendar`, `update_calendar`, `list_calendar_events`, `create_calendar_event`, `update_calendar_event`, `delete_calendar_event`, `move_calendar_events`, `respond_to_event` |
172
+ | Contacts | `search_contacts`, `list_upcoming_birthdays`, `create_contact`, `update_contact`, `delete_contact`, `merge_contacts` |
173
+
174
+ ## Differences from Langmail's hosted server
175
+
176
+ The tools behave as they do on the hosted server wherever a plain Stalwart allows it. The differences below follow from two facts: this server has no Langmail service behind it, and it sends nothing to a third party unless you turn that on.
177
+
178
+ - **Calendar sharing is left out.** `share_calendar` and `stop_sharing_calendar` hand out calendar feed links that Langmail's hosted service and database serve. This server has neither, so the two tools do not exist here, and `list_calendars` shows no sharing information.
179
+ - **One-click unsubscribe is off by default.** The one-click request of RFC 8058 goes to a URL the sender chose. `unsubscribe_from_list` sends it only when `LANGMAIL_MCP_ALLOW_UNSUBSCRIBE_POST=1` is set. Otherwise the tool returns the unsubscribe link or address for you to use yourself.
180
+ - **Remote images are not loaded by default.** `preview_email` renders a message without its remote images unless `LANGMAIL_MCP_ALLOW_REMOTE_IMAGES=1` is set. When it is, this server fetches the images and passes them on, so the sender sees the server's address and not the address of the device that shows the preview.
181
+ - **Attachment links are served by this server.** `download_attachment`, `download_email` and `upload_attachments` hand out short-lived URLs. In HTTP mode they are under `MCP_PUBLIC_URL`. In stdio mode the server listens on a local port on `127.0.0.1` for them, so they only work on the same computer.
182
+ - **Searching by email type needs a classifier.** Langmail's hosted classifier labels each message with a type (invoice, ticket, newsletter and so on), and the `keywords` filter of `search_emails` matches those labels. Nothing writes them on a plain Stalwart mailbox, so a type filter matches nothing there. The to-do label is different: `mark_emails` sets it itself, so the agent finds what it marked. Search by text, sender, date, folder, read state and star works as usual.
183
+ - **`archive_emails` needs an Archive folder.** Langmail creates one for every account. A new Stalwart account may not have one, and the tool then says so. Create a folder with the Archive role once, in your mail client or in Stalwart.
184
+ - **Contacts are not collected from mail.** Hosted Langmail collects the people you correspond with from mail headers in a background service, which this server does not have. The Collected address book grows only from the calendar tools, i.e. from the people you schedule with or reply to an invitation from. Contacts that you or the agent create, and anything synced over CardDAV, work the same.
185
+ - **You sign in with your own Stalwart login.** The hosted server uses Langmail's OAuth. This server uses an app password or a bearer token for your Stalwart account.
186
+
187
+ ## Privacy: what leaves your machine
188
+
189
+ The server's invariant is that nothing leaves your computer or server except traffic to your own Stalwart, unless you turn it on. Two settings turn something on, and both default to off: `LANGMAIL_MCP_ALLOW_UNSUBSCRIBE_POST` (a request to a sender's unsubscribe URL) and `LANGMAIL_MCP_ALLOW_REMOTE_IMAGES` (requests to the hosts a message's images are on). Your Stalwart credential is sent only to the origin of `STALWART_URL`, never to another address a server answer or a redirect names. A previewed email is shown under a content security policy that lets it load images from this server and nothing from anywhere else, so the sender's CSS cannot make your client fetch from the sender. There is no telemetry, no error reporting service and no update check. Logs go to stderr only and carry neither credentials nor message content.
190
+
191
+ However, this covers the server and not the agent. Whatever a tool returns goes to the MCP client that asked for it, and from there to the model that client uses. If that model runs at a provider, the mail the agent reads passes through that provider.
192
+
193
+ ## Requirements
194
+
195
+ - Node.js 22 or later.
196
+ - A Stalwart server with an account you can sign in to. The server is tested end-to-end in CI against a real Stalwart at the version in [`.stalwart-version`](.stalwart-version), currently 1.1.1. Other versions may work but are not tested.
197
+
198
+ ## Development
199
+
200
+ ```sh
201
+ git clone https://github.com/langmail/langmail-mcp.git
202
+ cd langmail-mcp
203
+ npm ci
204
+ cp .env.example .env # then fill in your own values
205
+ npm run dev # runs src/index.ts with .env, restarting on changes
206
+ ```
207
+
208
+ `npm run build` compiles to `dist/`, `npm test` runs the unit tests, and `npm run check:fix` formats and lints with Biome. `npm run validate` runs everything CI checks except the end-to-end suites: lint, unit tests, unused-code check and build. `npm run test:e2e` runs the suites in `e2e/` against a real Stalwart; [`e2e/README.md`](e2e/README.md) describes how to start one locally, with or without docker.
209
+
210
+ ## Contributing, security and license
211
+
212
+ Contributions are welcome; [CONTRIBUTING.md](CONTRIBUTING.md) describes the workflow and the commit convention, and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) applies. Please report vulnerabilities privately as described in [SECURITY.md](SECURITY.md), not in a public issue. The code is released under the [MIT license](LICENSE).
@@ -0,0 +1,388 @@
1
+ # Third-party notices
2
+
3
+ The published package contains `dist/email-render/email-viewer.html`, the view an MCP Apps host shows a previewed email in. That one file has the code of the packages below compiled into it, so their copyright and license notices are reproduced here.
4
+
5
+ This file is generated from what the bundler put into the viewer (`npm run notices`, `scripts/third-party.ts`). Do not edit it by hand; `npm test` fails when it no longer matches the bundle.
6
+
7
+ The packages this server depends on at run time are not in this list: npm installs them next to it, each with its own license file.
8
+
9
+ | Package | Version | License |
10
+ | --- | --- | --- |
11
+ | @cfworker/json-schema | 4.1.1 | MIT |
12
+ | @modelcontextprotocol/client | 2.4.0 | Apache-2.0 |
13
+ | @modelcontextprotocol/core | 2.4.0 | Apache-2.0 |
14
+ | @modelcontextprotocol/ext-apps | 2.0.4 | MIT |
15
+ | content-type | 1.0.5 | MIT |
16
+ | pkce-challenge | 5.0.1 | MIT |
17
+ | zod | 4.6.7 | MIT |
18
+
19
+ ## @cfworker/json-schema 4.1.1
20
+
21
+ - License: MIT
22
+ - Copyright (c) 2020 Jeremy Danyow
23
+ - Source: <https://github.com/cfworker/cfworker>
24
+ - Compiled into the published files of @modelcontextprotocol/client@2.4.0, and bundled from there.
25
+ - NOTICE file: the package ships none.
26
+
27
+ ```text
28
+ MIT License
29
+
30
+ Copyright (c) 2020 Jeremy Danyow
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy
33
+ of this software and associated documentation files (the "Software"), to deal
34
+ in the Software without restriction, including without limitation the rights
35
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ copies of the Software, and to permit persons to whom the Software is
37
+ furnished to do so, subject to the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be included in all
40
+ copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48
+ SOFTWARE.
49
+ ```
50
+
51
+ ## @modelcontextprotocol/client 2.4.0
52
+
53
+ - License: Apache-2.0
54
+ - Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
55
+ - Source: <https://github.com/modelcontextprotocol/typescript-sdk>
56
+ - NOTICE file: the package ships none.
57
+
58
+ ```text
59
+ The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
60
+
61
+ Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
62
+
63
+ No rights beyond those granted by the applicable original license are conveyed for such contributions.
64
+
65
+ ---
66
+
67
+ Apache License
68
+ Version 2.0, January 2004
69
+ http://www.apache.org/licenses/
70
+
71
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
72
+
73
+ 1. Definitions.
74
+
75
+ "License" shall mean the terms and conditions for use, reproduction,
76
+ and distribution as defined by Sections 1 through 9 of this document.
77
+
78
+ "Licensor" shall mean the copyright owner or entity authorized by
79
+ the copyright owner that is granting the License.
80
+
81
+ "Legal Entity" shall mean the union of the acting entity and all
82
+ other entities that control, are controlled by, or are under common
83
+ control with that entity. For the purposes of this definition,
84
+ "control" means (i) the power, direct or indirect, to cause the
85
+ direction or management of such entity, whether by contract or
86
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
87
+ outstanding shares, or (iii) beneficial ownership of such entity.
88
+
89
+ "You" (or "Your") shall mean an individual or Legal Entity
90
+ exercising permissions granted by this License.
91
+
92
+ "Source" form shall mean the preferred form for making modifications,
93
+ including but not limited to software source code, documentation
94
+ source, and configuration files.
95
+
96
+ "Object" form shall mean any form resulting from mechanical
97
+ transformation or translation of a Source form, including but
98
+ not limited to compiled object code, generated documentation,
99
+ and conversions to other media types.
100
+
101
+ "Work" shall mean the work of authorship, whether in Source or
102
+ Object form, made available under the License, as indicated by a
103
+ copyright notice that is included in or attached to the work
104
+ (an example is provided in the Appendix below).
105
+
106
+ "Derivative Works" shall mean any work, whether in Source or Object
107
+ form, that is based on (or derived from) the Work and for which the
108
+ editorial revisions, annotations, elaborations, or other modifications
109
+ represent, as a whole, an original work of authorship. For the purposes
110
+ of this License, Derivative Works shall not include works that remain
111
+ separable from, or merely link (or bind by name) to the interfaces of,
112
+ the Work and Derivative Works thereof.
113
+
114
+ "Contribution" shall mean any work of authorship, including
115
+ the original version of the Work and any modifications or additions
116
+ to that Work or Derivative Works thereof, that is intentionally
117
+ submitted to the Licensor for inclusion in the Work by the copyright
118
+ owner or by an individual or Legal Entity authorized to submit on behalf
119
+ of the copyright owner. For the purposes of this definition, "submitted"
120
+ means any form of electronic, verbal, or written communication sent
121
+ to the Licensor or its representatives, including but not limited to
122
+ communication on electronic mailing lists, source code control systems,
123
+ and issue tracking systems that are managed by, or on behalf of, the
124
+ Licensor for the purpose of discussing and improving the Work, but
125
+ excluding communication that is conspicuously marked or otherwise
126
+ designated in writing by the copyright owner as "Not a Contribution."
127
+
128
+ "Contributor" shall mean Licensor and any individual or Legal Entity
129
+ on behalf of whom a Contribution has been received by Licensor and
130
+ subsequently incorporated within the Work.
131
+
132
+ 2. Grant of Copyright License. Subject to the terms and conditions of
133
+ this License, each Contributor hereby grants to You a perpetual,
134
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
135
+ copyright license to reproduce, prepare Derivative Works of,
136
+ publicly display, publicly perform, sublicense, and distribute the
137
+ Work and such Derivative Works in Source or Object form.
138
+
139
+ 3. Grant of Patent License. Subject to the terms and conditions of
140
+ this License, each Contributor hereby grants to You a perpetual,
141
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
142
+ (except as stated in this section) patent license to make, have made,
143
+ use, offer to sell, sell, import, and otherwise transfer the Work,
144
+ where such license applies only to those patent claims licensable
145
+ by such Contributor that are necessarily infringed by their
146
+ Contribution(s) alone or by combination of their Contribution(s)
147
+ with the Work to which such Contribution(s) was submitted. If You
148
+ institute patent litigation against any entity (including a
149
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
150
+ or a Contribution incorporated within the Work constitutes direct
151
+ or contributory patent infringement, then any patent licenses
152
+ granted to You under this License for that Work shall terminate
153
+ as of the date such litigation is filed.
154
+
155
+ 4. Redistribution. You may reproduce and distribute copies of the
156
+ Work or Derivative Works thereof in any medium, with or without
157
+ modifications, and in Source or Object form, provided that You
158
+ meet the following conditions:
159
+
160
+ (a) You must give any other recipients of the Work or
161
+ Derivative Works a copy of this License; and
162
+
163
+ (b) You must cause any modified files to carry prominent notices
164
+ stating that You changed the files; and
165
+
166
+ (c) You must retain, in the Source form of any Derivative Works
167
+ that You distribute, all copyright, patent, trademark, and
168
+ attribution notices from the Source form of the Work,
169
+ excluding those notices that do not pertain to any part of
170
+ the Derivative Works; and
171
+
172
+ (d) If the Work includes a "NOTICE" text file as part of its
173
+ distribution, then any Derivative Works that You distribute must
174
+ include a readable copy of the attribution notices contained
175
+ within such NOTICE file, excluding those notices that do not
176
+ pertain to any part of the Derivative Works, in at least one
177
+ of the following places: within a NOTICE text file distributed
178
+ as part of the Derivative Works; within the Source form or
179
+ documentation, if provided along with the Derivative Works; or,
180
+ within a display generated by the Derivative Works, if and
181
+ wherever such third-party notices normally appear. The contents
182
+ of the NOTICE file are for informational purposes only and
183
+ do not modify the License. You may add Your own attribution
184
+ notices within Derivative Works that You distribute, alongside
185
+ or as an addendum to the NOTICE text from the Work, provided
186
+ that such additional attribution notices cannot be construed
187
+ as modifying the License.
188
+
189
+ You may add Your own copyright statement to Your modifications and
190
+ may provide additional or different license terms and conditions
191
+ for use, reproduction, or distribution of Your modifications, or
192
+ for any such Derivative Works as a whole, provided Your use,
193
+ reproduction, and distribution of the Work otherwise complies with
194
+ the conditions stated in this License.
195
+
196
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
197
+ any Contribution intentionally submitted for inclusion in the Work
198
+ by You to the Licensor shall be under the terms and conditions of
199
+ this License, without any additional terms or conditions.
200
+ Notwithstanding the above, nothing herein shall supersede or modify
201
+ the terms of any separate license agreement you may have executed
202
+ with Licensor regarding such Contributions.
203
+
204
+ 6. Trademarks. This License does not grant permission to use the trade
205
+ names, trademarks, service marks, or product names of the Licensor,
206
+ except as required for reasonable and customary use in describing the
207
+ origin of the Work and reproducing the content of the NOTICE file.
208
+
209
+ 7. Disclaimer of Warranty. Unless required by applicable law or
210
+ agreed to in writing, Licensor provides the Work (and each
211
+ Contributor provides its Contributions) on an "AS IS" BASIS,
212
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
213
+ implied, including, without limitation, any warranties or conditions
214
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
215
+ PARTICULAR PURPOSE. You are solely responsible for determining the
216
+ appropriateness of using or redistributing the Work and assume any
217
+ risks associated with Your exercise of permissions under this License.
218
+
219
+ 8. Limitation of Liability. In no event and under no legal theory,
220
+ whether in tort (including negligence), contract, or otherwise,
221
+ unless required by applicable law (such as deliberate and grossly
222
+ negligent acts) or agreed to in writing, shall any Contributor be
223
+ liable to You for damages, including any direct, indirect, special,
224
+ incidental, or consequential damages of any character arising as a
225
+ result of this License or out of the use or inability to use the
226
+ Work (including but not limited to damages for loss of goodwill,
227
+ work stoppage, computer failure or malfunction, or any and all
228
+ other commercial damages or losses), even if such Contributor
229
+ has been advised of the possibility of such damages.
230
+
231
+ 9. Accepting Warranty or Additional Liability. While redistributing
232
+ the Work or Derivative Works thereof, You may choose to offer,
233
+ and charge a fee for, acceptance of support, warranty, indemnity,
234
+ or other liability obligations and/or rights consistent with this
235
+ License. However, in accepting such obligations, You may act only
236
+ on Your own behalf and on Your sole responsibility, not on behalf
237
+ of any other Contributor, and only if You agree to indemnify,
238
+ defend, and hold each Contributor harmless for any liability
239
+ incurred by, or claims asserted against, such Contributor by reason
240
+ of your accepting any such warranty or additional liability.
241
+
242
+ END OF TERMS AND CONDITIONS
243
+
244
+ ---
245
+
246
+ MIT License
247
+
248
+ Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
249
+
250
+ Permission is hereby granted, free of charge, to any person obtaining a copy
251
+ of this software and associated documentation files (the "Software"), to deal
252
+ in the Software without restriction, including without limitation the rights
253
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
254
+ copies of the Software, and to permit persons to whom the Software is
255
+ furnished to do so, subject to the following conditions:
256
+
257
+ The above copyright notice and this permission notice shall be included in all
258
+ copies or substantial portions of the Software.
259
+
260
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
261
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
262
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
263
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
264
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
265
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
266
+ SOFTWARE.
267
+
268
+ ---
269
+
270
+ Creative Commons Attribution 4.0 International (CC-BY-4.0)
271
+
272
+ Documentation in this project (excluding specifications) is licensed under
273
+ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
274
+ the full license text.
275
+ ```
276
+
277
+ ## @modelcontextprotocol/core 2.4.0
278
+
279
+ - License: Apache-2.0
280
+ - Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
281
+ - Source: <https://github.com/modelcontextprotocol/typescript-sdk>
282
+ - NOTICE file: the package ships none.
283
+
284
+ License text: identical to the one under "@modelcontextprotocol/client 2.4.0" above.
285
+
286
+ ## @modelcontextprotocol/ext-apps 2.0.4
287
+
288
+ - License: MIT
289
+ - Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
290
+ - Source: <https://github.com/modelcontextprotocol/ext-apps>
291
+ - NOTICE file: the package ships none.
292
+
293
+ License text: identical to the one under "@modelcontextprotocol/client 2.4.0" above.
294
+
295
+ ## content-type 1.0.5
296
+
297
+ - License: MIT
298
+ - Copyright (c) 2015 Douglas Christopher Wilson
299
+ - Source: <https://github.com/jshttp/content-type>
300
+ - Compiled into the published files of @modelcontextprotocol/client@2.4.0, and bundled from there.
301
+ - NOTICE file: the package ships none.
302
+
303
+ ```text
304
+ (The MIT License)
305
+
306
+ Copyright (c) 2015 Douglas Christopher Wilson
307
+
308
+ Permission is hereby granted, free of charge, to any person obtaining
309
+ a copy of this software and associated documentation files (the
310
+ 'Software'), to deal in the Software without restriction, including
311
+ without limitation the rights to use, copy, modify, merge, publish,
312
+ distribute, sublicense, and/or sell copies of the Software, and to
313
+ permit persons to whom the Software is furnished to do so, subject to
314
+ the following conditions:
315
+
316
+ The above copyright notice and this permission notice shall be
317
+ included in all copies or substantial portions of the Software.
318
+
319
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
320
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
321
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
322
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
323
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
324
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
325
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
326
+ ```
327
+
328
+ ## pkce-challenge 5.0.1
329
+
330
+ - License: MIT
331
+ - Copyright (c) 2019
332
+ - Source: <https://github.com/crouchcd/pkce-challenge>
333
+ - NOTICE file: the package ships none.
334
+
335
+ ```text
336
+ MIT License
337
+
338
+ Copyright (c) 2019
339
+
340
+ Permission is hereby granted, free of charge, to any person obtaining a copy
341
+ of this software and associated documentation files (the "Software"), to deal
342
+ in the Software without restriction, including without limitation the rights
343
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
344
+ copies of the Software, and to permit persons to whom the Software is
345
+ furnished to do so, subject to the following conditions:
346
+
347
+ The above copyright notice and this permission notice shall be included in all
348
+ copies or substantial portions of the Software.
349
+
350
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
351
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
352
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
353
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
354
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
355
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
356
+ SOFTWARE.
357
+ ```
358
+
359
+ ## zod 4.6.7
360
+
361
+ - License: MIT
362
+ - Copyright (c) 2025 Colin McDonnell
363
+ - Source: <https://github.com/colinhacks/zod>
364
+ - NOTICE file: the package ships none.
365
+
366
+ ```text
367
+ MIT License
368
+
369
+ Copyright (c) 2025 Colin McDonnell
370
+
371
+ Permission is hereby granted, free of charge, to any person obtaining a copy
372
+ of this software and associated documentation files (the "Software"), to deal
373
+ in the Software without restriction, including without limitation the rights
374
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
375
+ copies of the Software, and to permit persons to whom the Software is
376
+ furnished to do so, subject to the following conditions:
377
+
378
+ The above copyright notice and this permission notice shall be included in all
379
+ copies or substantial portions of the Software.
380
+
381
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
382
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
383
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
384
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
385
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
386
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
387
+ SOFTWARE.
388
+ ```