langmail-mcp 0.1.0 → 0.2.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 +1 -1
- package/README.md +89 -169
- package/dist/chunk-0fxfqny0.js +12642 -0
- package/dist/langmail-mcp.js +7 -0
- package/package.json +93 -98
- package/THIRD_PARTY_NOTICES.md +0 -388
- package/dist/attachments/download.js +0 -69
- package/dist/attachments/routes.js +0 -42
- package/dist/attachments/tickets.js +0 -45
- package/dist/attachments/upload-tickets.js +0 -43
- package/dist/attachments/upload.js +0 -136
- package/dist/caldav/account-settings.js +0 -92
- package/dist/caldav/agenda.js +0 -277
- package/dist/caldav/alarm.js +0 -97
- package/dist/caldav/client.js +0 -408
- package/dist/caldav/ical.js +0 -248
- package/dist/caldav/occurrence.js +0 -534
- package/dist/caldav/recurrence.js +0 -313
- package/dist/caldav/rsvp.js +0 -107
- package/dist/caldav/scheduling-handover.js +0 -22
- package/dist/caldav/timezone.js +0 -103
- package/dist/caldav/types.js +0 -5
- package/dist/config.js +0 -219
- package/dist/contacts/address-class.js +0 -79
- package/dist/contacts/birthdays.js +0 -81
- package/dist/contacts/card.js +0 -58
- package/dist/contacts/constants.js +0 -46
- package/dist/contacts/fold.js +0 -309
- package/dist/contacts/index.js +0 -10
- package/dist/contacts/merge.js +0 -388
- package/dist/contacts/observations.js +0 -115
- package/dist/contacts/profile.js +0 -402
- package/dist/contacts/scoring.js +0 -146
- package/dist/contacts/types.js +0 -7
- package/dist/contacts/upsert.js +0 -131
- package/dist/drafts/attachments.js +0 -254
- package/dist/drafts/idempotency.js +0 -60
- package/dist/drafts/send-guard.js +0 -184
- package/dist/email-render/email-viewer.html +0 -143
- package/dist/email-render/image-proxy.js +0 -389
- package/dist/email-render/meta.js +0 -48
- package/dist/email-render/sanitize.js +0 -93
- package/dist/email-render/viewer-resource.js +0 -104
- package/dist/http/bearer.js +0 -30
- package/dist/http/guard.js +0 -57
- package/dist/http/hosts.js +0 -10
- package/dist/http/listener.js +0 -170
- package/dist/http/routes.js +0 -72
- package/dist/ical/ical-parse.js +0 -357
- package/dist/ical/index.js +0 -4
- package/dist/ical/timezone.js +0 -22
- package/dist/ical/windows-zones.js +0 -155
- package/dist/index.js +0 -79
- package/dist/jmap/blob.js +0 -49
- package/dist/jmap/contacts.js +0 -226
- package/dist/jmap/drafts.js +0 -480
- package/dist/jmap/email.js +0 -668
- package/dist/jmap/index.js +0 -12
- package/dist/jmap/keywords.js +0 -22
- package/dist/jmap/live.js +0 -21
- package/dist/jmap/origin.js +0 -113
- package/dist/jmap/patch.js +0 -29
- package/dist/jmap/request.js +0 -37
- package/dist/jmap/session.js +0 -89
- package/dist/jmap/sieve.js +0 -71
- package/dist/jmap/submission.js +0 -107
- package/dist/jmap/timeout.js +0 -30
- package/dist/jmap/types.js +0 -6
- package/dist/logger.js +0 -48
- package/dist/mcp/handler.js +0 -255
- package/dist/mcp/http.js +0 -29
- package/dist/mcp/instructions.js +0 -44
- package/dist/mcp/links.js +0 -64
- package/dist/mcp/tool-logging.js +0 -67
- package/dist/observability/errors.js +0 -41
- package/dist/rules/apply.js +0 -236
- package/dist/rules/rule.js +0 -280
- package/dist/rules/store.js +0 -92
- package/dist/tools/annotations.js +0 -71
- package/dist/tools/archive-emails.js +0 -40
- package/dist/tools/calendar-lookup.js +0 -64
- package/dist/tools/contact-common.js +0 -146
- package/dist/tools/contact-format.js +0 -72
- package/dist/tools/contact-write-through.js +0 -37
- package/dist/tools/create-calendar-event.js +0 -231
- package/dist/tools/create-calendar.js +0 -54
- package/dist/tools/create-contact.js +0 -172
- package/dist/tools/create-draft.js +0 -369
- package/dist/tools/create-mail-rule.js +0 -101
- package/dist/tools/delete-calendar-event.js +0 -165
- package/dist/tools/delete-contact.js +0 -60
- package/dist/tools/delete-draft.js +0 -129
- package/dist/tools/delete-mail-rule.js +0 -38
- package/dist/tools/download-attachment.js +0 -90
- package/dist/tools/download-email.js +0 -112
- package/dist/tools/draft-common.js +0 -600
- package/dist/tools/email-types.js +0 -58
- package/dist/tools/error-detail.js +0 -10
- package/dist/tools/file-emails-common.js +0 -75
- package/dist/tools/format.js +0 -131
- package/dist/tools/forward-message.js +0 -237
- package/dist/tools/forward-quote.js +0 -179
- package/dist/tools/get-draft.js +0 -61
- package/dist/tools/get-email.js +0 -164
- package/dist/tools/get-thread.js +0 -67
- package/dist/tools/keywords.js +0 -43
- package/dist/tools/list-calendar-events.js +0 -180
- package/dist/tools/list-calendars.js +0 -44
- package/dist/tools/list-drafts.js +0 -134
- package/dist/tools/list-mail-rules.js +0 -28
- package/dist/tools/list-unsubscribe.js +0 -152
- package/dist/tools/list-upcoming-birthdays.js +0 -165
- package/dist/tools/mail-rule-common.js +0 -43
- package/dist/tools/mail-rule-format.js +0 -79
- package/dist/tools/mailbox-lookup.js +0 -13
- package/dist/tools/mark-emails.js +0 -78
- package/dist/tools/merge-contacts.js +0 -145
- package/dist/tools/move-calendar-events.js +0 -340
- package/dist/tools/move-emails.js +0 -64
- package/dist/tools/one-click-post.js +0 -275
- package/dist/tools/preview-email.js +0 -204
- package/dist/tools/preview-mail-rule.js +0 -79
- package/dist/tools/reply-quote.js +0 -426
- package/dist/tools/reply-to-message.js +0 -292
- package/dist/tools/respond-to-event.js +0 -110
- package/dist/tools/result.js +0 -9
- package/dist/tools/search-contacts.js +0 -431
- package/dist/tools/search-emails.js +0 -570
- package/dist/tools/send-draft.js +0 -308
- package/dist/tools/trash-emails.js +0 -36
- package/dist/tools/unsubscribe-from-list.js +0 -249
- package/dist/tools/update-calendar-event.js +0 -973
- package/dist/tools/update-calendar.js +0 -100
- package/dist/tools/update-contact.js +0 -382
- package/dist/tools/update-draft.js +0 -714
- package/dist/tools/update-mail-rule.js +0 -103
- package/dist/tools/upload-attachments.js +0 -126
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,212 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# langmail-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server that gives an AI agent the mail, calendar and contacts of one
|
|
4
|
+
mailbox on your own [Stalwart](https://stalw.art) server. It talks to Stalwart
|
|
5
|
+
over JMAP, CalDAV and CardDAV, with a username and an app password, and needs
|
|
6
|
+
no other service.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
This is the server Langmail runs at `mcp.langmail.me`, from the same code. The
|
|
9
|
+
hosted server adds a few features that need Langmail's own services, listed
|
|
10
|
+
under [Hosted and self-hosted](#hosted-and-self-hosted).
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
## What your agent can do with it
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
- **Mail:** search, read whole conversations, file, mark, archive and trash
|
|
15
|
+
messages, download attachments, preview a message as a rendered page and
|
|
16
|
+
unsubscribe from mailing lists.
|
|
17
|
+
- **Writing:** stage drafts with attachments, then send them, reply or
|
|
18
|
+
forward. A staged draft waits in the Drafts folder, so you can also review
|
|
19
|
+
and send it from your mail app.
|
|
20
|
+
- **Calendar:** list calendars and events, create, update, move and delete
|
|
21
|
+
events, and answer invitations.
|
|
22
|
+
- **Contacts:** search the address books, create, update, merge and delete
|
|
23
|
+
contacts, and list upcoming birthdays.
|
|
24
|
+
- **Mail rules:** list, preview, create, update and delete the Sieve rules that
|
|
25
|
+
file incoming mail.
|
|
10
26
|
|
|
11
|
-
|
|
27
|
+
The [tool reference](https://docs.langmail.me/reference/mcp/overview)
|
|
28
|
+
describes every tool. It is written for the hosted server, and the
|
|
29
|
+
differences are in [`docs/self-hosted.md`](docs/self-hosted.md).
|
|
12
30
|
|
|
13
|
-
|
|
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."
|
|
31
|
+
## Start it
|
|
16
32
|
|
|
17
|
-
|
|
33
|
+
You need Node 22.12 or later (not 23) or Bun, a Stalwart account and an app
|
|
34
|
+
password for it.
|
|
18
35
|
|
|
19
|
-
|
|
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:
|
|
36
|
+
On the same computer as the agent, the MCP client starts the server and talks
|
|
37
|
+
to it over stdio:
|
|
22
38
|
|
|
23
39
|
```sh
|
|
24
|
-
|
|
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
|
-
}
|
|
40
|
+
STALWART_URL=https://mail.example.com STALWART_USERNAME=alice \
|
|
41
|
+
STALWART_PASSWORD=<app password> npx langmail-mcp
|
|
72
42
|
```
|
|
73
43
|
|
|
74
|
-
|
|
44
|
+
Over the network, the server listens for Streamable HTTP and every request
|
|
45
|
+
must carry the secret you set:
|
|
75
46
|
|
|
76
47
|
```sh
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
-e STALWART_PASSWORD=your-app-password \
|
|
81
|
-
-- npx -y langmail-mcp
|
|
48
|
+
STALWART_URL=https://mail.example.com STALWART_USERNAME=alice \
|
|
49
|
+
STALWART_PASSWORD=<app password> MCP_AUTH_TOKEN=<long random secret> \
|
|
50
|
+
npx langmail-mcp --transport http --host 0.0.0.0 --port 8080
|
|
82
51
|
```
|
|
83
52
|
|
|
84
|
-
|
|
53
|
+
Under Bun, use `bunx --bun langmail-mcp`. `langmail-mcp --help` lists every
|
|
54
|
+
setting with its variable.
|
|
85
55
|
|
|
86
|
-
###
|
|
56
|
+
### Connect an MCP client
|
|
87
57
|
|
|
88
|
-
|
|
58
|
+
Claude Code, over stdio:
|
|
89
59
|
|
|
90
60
|
```sh
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
npx langmail-mcp
|
|
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
|
-
}
|
|
61
|
+
claude mcp add langmail \
|
|
62
|
+
--env STALWART_URL=https://mail.example.com \
|
|
63
|
+
--env STALWART_USERNAME=alice \
|
|
64
|
+
--env STALWART_PASSWORD=<app password> \
|
|
65
|
+
-- npx -y langmail-mcp
|
|
126
66
|
```
|
|
127
67
|
|
|
128
|
-
|
|
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:
|
|
68
|
+
A client configured with JSON, such as Claude Desktop:
|
|
131
69
|
|
|
132
70
|
```json
|
|
133
71
|
{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"langmail": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "langmail-mcp"],
|
|
76
|
+
"env": {
|
|
77
|
+
"STALWART_URL": "https://mail.example.com",
|
|
78
|
+
"STALWART_USERNAME": "alice",
|
|
79
|
+
"STALWART_PASSWORD": "<app password>"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
143
83
|
}
|
|
144
84
|
```
|
|
145
85
|
|
|
146
|
-
|
|
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.
|
|
86
|
+
## Settings
|
|
186
87
|
|
|
187
|
-
|
|
88
|
+
| Variable | Flag | Default | Meaning |
|
|
89
|
+
|---|---|---|---|
|
|
90
|
+
| `STALWART_URL` | `--stalwart-url` | required | Stalwart's base URL; JMAP, CalDAV and CardDAV are reached under it |
|
|
91
|
+
| `STALWART_USERNAME` | `--username` | required | The account name to sign in with |
|
|
92
|
+
| `STALWART_PASSWORD` | none | required | An app password for that account |
|
|
93
|
+
| `STALWART_EMAIL` | `--email` | the login Stalwart reports | The address to send mail as |
|
|
94
|
+
| `MCP_TRANSPORT` | `--transport` | `stdio` | `stdio` or `http` (Streamable HTTP) |
|
|
95
|
+
| `MCP_HOST` | `--host` | `127.0.0.1` | Where the HTTP listener binds |
|
|
96
|
+
| `MCP_PORT` | `--port` | `8080` for http | The HTTP listener's port |
|
|
97
|
+
| `MCP_PUBLIC_URL` | `--public-url` | `http://<host>:<port>` | Base URL for the attachment and image links the server creates |
|
|
98
|
+
| `MCP_AUTH_TOKEN` | none | required for http | The bearer every `/mcp` request must carry |
|
|
188
99
|
|
|
189
|
-
The
|
|
100
|
+
The secrets have no flag, because a flag shows in the process list. What each
|
|
101
|
+
setting does, the checks at startup and what the server sends where:
|
|
102
|
+
[`docs/self-hosted.md`](docs/self-hosted.md).
|
|
190
103
|
|
|
191
|
-
|
|
104
|
+
## Hosted and self-hosted
|
|
192
105
|
|
|
193
|
-
|
|
106
|
+
| Feature | Hosted at `mcp.langmail.me` | Self-hosted |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| Sign-in | OAuth with a Langmail account | Stalwart username and app password |
|
|
109
|
+
| Calendar sharing (`share_calendar`, `stop_sharing_calendar`) | Yes | No |
|
|
110
|
+
| Filter mail by classified type | Yes | No; a `todo` flag instead |
|
|
111
|
+
| Address book collected from mail and invitations | Yes | No; `search_contacts` also looks at recent mail headers |
|
|
194
112
|
|
|
195
|
-
|
|
196
|
-
|
|
113
|
+
The details and reasons are in [`docs/self-hosted.md`](docs/self-hosted.md)
|
|
114
|
+
§ What the mode leaves out.
|
|
197
115
|
|
|
198
116
|
## Development
|
|
199
117
|
|
|
200
118
|
```sh
|
|
201
119
|
git clone https://github.com/langmail/langmail-mcp.git
|
|
202
120
|
cd langmail-mcp
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
npm run dev # runs src/index.ts with .env, restarting on changes
|
|
121
|
+
bun install
|
|
122
|
+
bun test
|
|
206
123
|
```
|
|
207
124
|
|
|
208
|
-
`
|
|
125
|
+
`CONTRIBUTING.md` covers the checks, the integration tests against Radicale
|
|
126
|
+
and a dev Stalwart, and how releases work. `docs/evals.md` covers the agent
|
|
127
|
+
evals. Report bugs in [GitHub issues](https://github.com/langmail/langmail-mcp/issues)
|
|
128
|
+
and vulnerabilities as `SECURITY.md` describes.
|
|
209
129
|
|
|
210
|
-
##
|
|
130
|
+
## License
|
|
211
131
|
|
|
212
|
-
|
|
132
|
+
[MIT](LICENSE)
|