fastmail-mcp-server 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 +21 -0
- package/README.md +171 -0
- package/package.json +46 -0
- package/src/index.ts +525 -0
- package/src/jmap/client.ts +149 -0
- package/src/jmap/methods.ts +500 -0
- package/src/jmap/types.ts +198 -0
- package/src/test.ts +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 James Cleveland
|
|
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,171 @@
|
|
|
1
|
+
# fastmail-mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for Fastmail. Read, search, organize, and send emails through Claude Desktop.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Requires [Bun](https://bun.sh) runtime:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install Bun
|
|
11
|
+
curl -fsSL https://bun.sh/install | bash
|
|
12
|
+
|
|
13
|
+
# Or via mise
|
|
14
|
+
mise use -g bun
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### 1. Generate Fastmail API Token
|
|
20
|
+
|
|
21
|
+
1. Open [Fastmail Settings → Privacy & Security → Integrations](https://app.fastmail.com/settings/security/integrations)
|
|
22
|
+
2. Scroll to **API tokens** and click **Manage**
|
|
23
|
+
3. Click **New API token**
|
|
24
|
+
4. Name it something like "Claude MCP"
|
|
25
|
+
5. Under **Access**, enable:
|
|
26
|
+
- **Mail** - required (read and write)
|
|
27
|
+
6. Click **Generate**
|
|
28
|
+
7. **Copy the token immediately** - you won't see it again
|
|
29
|
+
|
|
30
|
+
Token format: `fmu1-xxxxxxxx-xxxxxxxxxxxx...`
|
|
31
|
+
|
|
32
|
+
### 2. Configure Claude Desktop
|
|
33
|
+
|
|
34
|
+
Open the Claude Desktop config file:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# macOS
|
|
38
|
+
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
39
|
+
|
|
40
|
+
# Or create it if it doesn't exist
|
|
41
|
+
mkdir -p ~/Library/Application\ Support/Claude
|
|
42
|
+
touch ~/Library/Application\ Support/Claude/claude_desktop_config.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Add the fastmail server config:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"fastmail": {
|
|
51
|
+
"command": "bunx",
|
|
52
|
+
"args": ["-y", "fastmail-mcp-server"],
|
|
53
|
+
"env": {
|
|
54
|
+
"FASTMAIL_API_TOKEN": "fmu1-your-token-here"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Restart Claude Desktop
|
|
62
|
+
|
|
63
|
+
Quit Claude Desktop completely (Cmd+Q) and reopen it. The Fastmail tools should now appear.
|
|
64
|
+
|
|
65
|
+
## Security
|
|
66
|
+
|
|
67
|
+
**Token storage:** The token lives in `claude_desktop_config.json` in your user directory. This file is only readable by your user account. For additional security:
|
|
68
|
+
|
|
69
|
+
- **Don't commit** the config file to version control
|
|
70
|
+
- **Rotate tokens** periodically via Fastmail settings
|
|
71
|
+
- **Use minimal scopes** - only enable Mail access unless you need more
|
|
72
|
+
- **Revoke immediately** if compromised via Fastmail settings
|
|
73
|
+
|
|
74
|
+
**Send protection:** All email-sending operations require explicit two-step confirmation:
|
|
75
|
+
|
|
76
|
+
1. `action: "preview"` - shows exactly what will be sent
|
|
77
|
+
2. `action: "confirm"` - actually sends
|
|
78
|
+
|
|
79
|
+
No emails can be sent accidentally.
|
|
80
|
+
|
|
81
|
+
## Available Tools
|
|
82
|
+
|
|
83
|
+
### Read Operations (no confirmation needed)
|
|
84
|
+
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
| ------------------ | -------------------------------------------- |
|
|
87
|
+
| `list_mailboxes` | List all folders with unread counts |
|
|
88
|
+
| `list_emails` | List emails in a mailbox (returns summaries) |
|
|
89
|
+
| `get_email` | Get full email content by ID |
|
|
90
|
+
| `search_emails` | Search across all mailboxes |
|
|
91
|
+
| `list_attachments` | List attachments on an email |
|
|
92
|
+
| `get_attachment` | Download and read attachment content |
|
|
93
|
+
|
|
94
|
+
### Write Operations
|
|
95
|
+
|
|
96
|
+
| Tool | Description | Confirmation |
|
|
97
|
+
| ---------------- | ---------------------------- | ------------ |
|
|
98
|
+
| `move_email` | Move email to another folder | No |
|
|
99
|
+
| `mark_as_read` | Mark email read/unread | No |
|
|
100
|
+
| `mark_as_spam` | Move to Junk + train filter | **Yes** |
|
|
101
|
+
| `send_email` | Send a new email | **Yes** |
|
|
102
|
+
| `reply_to_email` | Reply to an email thread | **Yes** |
|
|
103
|
+
|
|
104
|
+
## Example Prompts
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
"What's in my inbox?"
|
|
108
|
+
|
|
109
|
+
"Check the met-police folder - anything urgent?"
|
|
110
|
+
|
|
111
|
+
"Search for emails from john@example.com"
|
|
112
|
+
|
|
113
|
+
"What would be a good response to the latest email from the solicitor?"
|
|
114
|
+
|
|
115
|
+
"Draft a reply to that insurance email explaining the situation"
|
|
116
|
+
|
|
117
|
+
"Move all the newsletters to Archive"
|
|
118
|
+
|
|
119
|
+
"Mark that spam email as junk"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Troubleshooting
|
|
123
|
+
|
|
124
|
+
**"FASTMAIL_API_TOKEN environment variable is required"**
|
|
125
|
+
|
|
126
|
+
- Check your Claude Desktop config has the token in the `env` section
|
|
127
|
+
- Make sure the JSON is valid (no trailing commas)
|
|
128
|
+
- Restart Claude Desktop completely (Cmd+Q)
|
|
129
|
+
|
|
130
|
+
**"Failed to get JMAP session: 401"**
|
|
131
|
+
|
|
132
|
+
- Token is invalid or expired
|
|
133
|
+
- Generate a new token in Fastmail settings
|
|
134
|
+
- Make sure you copied the full token
|
|
135
|
+
|
|
136
|
+
**"Mailbox not found"**
|
|
137
|
+
|
|
138
|
+
- Run `list_mailboxes` first to see exact folder names
|
|
139
|
+
- Names are case-sensitive
|
|
140
|
+
|
|
141
|
+
**Tools not appearing in Claude**
|
|
142
|
+
|
|
143
|
+
- Check logs: `~/Library/Logs/Claude/mcp*.log`
|
|
144
|
+
- Make sure bun is installed: `bun --version`
|
|
145
|
+
- Try running directly: `bunx fastmail-mcp-server`
|
|
146
|
+
|
|
147
|
+
## How It Works
|
|
148
|
+
|
|
149
|
+
Uses [JMAP](https://jmap.io/) (JSON Meta Application Protocol) - a modern, stateless replacement for IMAP. The server implements [Model Context Protocol](https://modelcontextprotocol.io/) for Claude integration.
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/radiosilence/fastmail-mcp-server
|
|
155
|
+
cd fastmail-mcp-server
|
|
156
|
+
bun install
|
|
157
|
+
|
|
158
|
+
# Test with your token
|
|
159
|
+
FASTMAIL_API_TOKEN=fmu1-... bun run test
|
|
160
|
+
|
|
161
|
+
# Run server directly
|
|
162
|
+
FASTMAIL_API_TOKEN=fmu1-... bun run start
|
|
163
|
+
|
|
164
|
+
# Format & lint
|
|
165
|
+
bun run format
|
|
166
|
+
bun run lint
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fastmail-mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Fastmail - read, search, and send emails via Claude",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "bun run src/index.ts",
|
|
12
|
+
"test": "bun run src/test.ts",
|
|
13
|
+
"format": "biome check --write",
|
|
14
|
+
"lint": "biome check"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"fastmail",
|
|
19
|
+
"jmap",
|
|
20
|
+
"email",
|
|
21
|
+
"claude",
|
|
22
|
+
"ai",
|
|
23
|
+
"model-context-protocol"
|
|
24
|
+
],
|
|
25
|
+
"author": "James Cleveland <jc@blit.cc>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/radiosilence/fastmail-mcp-server.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/radiosilence/fastmail-mcp-server/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/radiosilence/fastmail-mcp-server#readme",
|
|
35
|
+
"engines": {
|
|
36
|
+
"bun": ">=1.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
40
|
+
"zod": "^4.3.4"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@biomejs/biome": "^2.3.10",
|
|
44
|
+
"@types/bun": "latest"
|
|
45
|
+
}
|
|
46
|
+
}
|