inboxctl 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/.env.example +14 -0
- package/LICENSE +21 -0
- package/README.md +277 -0
- package/dist/chunk-EY6VV43S.js +4744 -0
- package/dist/chunk-EY6VV43S.js.map +1 -0
- package/dist/cli.js +4668 -0
- package/dist/cli.js.map +1 -0
- package/dist/mcp.js +16 -0
- package/dist/mcp.js.map +1 -0
- package/package.json +83 -0
- package/rules/example.yaml +29 -0
package/.env.example
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Google OAuth2 credentials (from Google Cloud Console)
|
|
2
|
+
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
|
|
3
|
+
GOOGLE_CLIENT_SECRET=your-client-secret
|
|
4
|
+
|
|
5
|
+
# Optional: fixed redirect URI for a Web application OAuth client
|
|
6
|
+
# Default: http://127.0.0.1:3456/callback
|
|
7
|
+
# GOOGLE_REDIRECT_URI=http://127.0.0.1:3456/callback
|
|
8
|
+
|
|
9
|
+
# Optional: choose Gmail transport adapter
|
|
10
|
+
# auto = try @googleapis/gmail first, fall back to REST if the client transport
|
|
11
|
+
# fails authenticated Gmail requests in this environment
|
|
12
|
+
# google-api = force @googleapis/gmail
|
|
13
|
+
# rest = force direct Gmail REST calls
|
|
14
|
+
# INBOXCTL_GMAIL_TRANSPORT=auto
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthew Freeman
|
|
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,277 @@
|
|
|
1
|
+
# inboxctl
|
|
2
|
+
|
|
3
|
+
**An MCP server that gives AI agents structured, safe access to your Gmail inbox, with a CLI and TUI for when you want to inspect or drive the same workflows yourself.**
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Why MCP-native?
|
|
8
|
+
|
|
9
|
+
Most email tools put the intelligence inside the app. `inboxctl` does the opposite: it is the infrastructure layer, and your AI agent is the brain.
|
|
10
|
+
|
|
11
|
+
Connect any MCP client, including Claude Desktop, Claude Code, or another MCP-compatible agent, and it gets structured access to search your inbox, review sender patterns, detect newsletter noise, triage unread mail, apply labels, archive, create Gmail filters, and manage rules. `inboxctl` handles the Gmail plumbing, audit trail, and undo path.
|
|
12
|
+
|
|
13
|
+
The CLI and TUI ship alongside MCP so you can always inspect what an agent did, undo it, or run the same work manually.
|
|
14
|
+
|
|
15
|
+
Emails are never deleted. The tool can label, archive, mark read, and forward, but it does not destroy data.
|
|
16
|
+
|
|
17
|
+
## What the MCP server exposes
|
|
18
|
+
|
|
19
|
+
| | Count | Examples |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **Tools** | 25 | `search_emails`, `archive_emails`, `label_emails`, `mark_read`, `get_top_senders`, `get_newsletter_senders`, `deploy_rule`, `run_rule`, `create_filter`, `undo_run` |
|
|
22
|
+
| **Resources** | 6 | `inbox://recent`, `inbox://summary`, `rules://deployed`, `rules://history`, `stats://senders`, `stats://overview` |
|
|
23
|
+
| **Prompts** | 5 | `summarize-inbox`, `review-senders`, `find-newsletters`, `suggest-rules`, `triage-inbox` |
|
|
24
|
+
|
|
25
|
+
An agent can read your inbox summary, review your noisiest senders, suggest a YAML rule to handle them, deploy it in dry-run, show you the results, and apply it, all through MCP calls.
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
### Published package
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx inboxctl@latest setup
|
|
33
|
+
npx inboxctl@latest sync
|
|
34
|
+
npx inboxctl@latest
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Development checkout
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install
|
|
41
|
+
npm run build
|
|
42
|
+
npm link
|
|
43
|
+
inboxctl setup
|
|
44
|
+
inboxctl sync
|
|
45
|
+
inboxctl
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Connect your AI agent
|
|
49
|
+
|
|
50
|
+
### Claude Desktop
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"inboxctl": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["-y", "inboxctl@latest", "mcp"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Claude Code
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"inboxctl": {
|
|
69
|
+
"command": "npx",
|
|
70
|
+
"args": ["-y", "inboxctl@latest", "mcp"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For a local checkout, replace the command with `node` and point the args at `dist/cli.js`:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"inboxctl": {
|
|
82
|
+
"command": "node",
|
|
83
|
+
"args": ["/absolute/path/to/inboxctl/dist/cli.js", "mcp"]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Then ask your agent things like:
|
|
90
|
+
|
|
91
|
+
- "What are my noisiest unread senders?"
|
|
92
|
+
- "Find all emails that look like receipts and label them Receipts."
|
|
93
|
+
- "Create a Gmail filter to auto-archive future mail from noreply@example.com."
|
|
94
|
+
- "Show me what the label-receipts rule would match, then apply it."
|
|
95
|
+
|
|
96
|
+
## Use the CLI or TUI directly
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
inboxctl # launch the TUI
|
|
100
|
+
inboxctl mcp # start MCP server on stdio
|
|
101
|
+
inboxctl demo # launch the seeded demo mailbox
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Features
|
|
105
|
+
|
|
106
|
+
- **MCP server** with the full feature set exposed as tools, resources, and prompts.
|
|
107
|
+
- **Rules as code** in YAML, with deploy, dry-run, apply, drift detection, audit logging, and undo.
|
|
108
|
+
- **Local-first analytics** on top senders, unread rates, newsletter detection, labels, and volume trends.
|
|
109
|
+
- **Gmail filter management** for always-on server-side rules on future incoming mail.
|
|
110
|
+
- **Full audit trail** with before/after state snapshots for reversible actions.
|
|
111
|
+
- **Interactive TUI** for inbox triage, email detail, stats, rules, and search.
|
|
112
|
+
- **Guided setup wizard** for Google Cloud and local OAuth configuration.
|
|
113
|
+
- **Demo mode** with realistic seeded data for screenshots, recordings, and safe exploration.
|
|
114
|
+
|
|
115
|
+
## Rules as code
|
|
116
|
+
|
|
117
|
+
Rules live in a `rules/` directory. Deploy them, run them against your synced inbox, and undo them if needed.
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
name: label-receipts
|
|
121
|
+
description: Label emails that look like receipts
|
|
122
|
+
enabled: true
|
|
123
|
+
priority: 30
|
|
124
|
+
|
|
125
|
+
conditions:
|
|
126
|
+
operator: OR
|
|
127
|
+
matchers:
|
|
128
|
+
- field: from
|
|
129
|
+
values:
|
|
130
|
+
- "receipts@stripe.com"
|
|
131
|
+
- "no-reply@paypal.com"
|
|
132
|
+
- field: subject
|
|
133
|
+
contains:
|
|
134
|
+
- "receipt"
|
|
135
|
+
- "order confirmation"
|
|
136
|
+
- "invoice"
|
|
137
|
+
|
|
138
|
+
actions:
|
|
139
|
+
- type: label
|
|
140
|
+
label: "Receipts"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Rules default to dry-run. Pass `--apply` to execute them.
|
|
144
|
+
|
|
145
|
+
## CLI reference
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# sync and read
|
|
149
|
+
inboxctl sync
|
|
150
|
+
inboxctl sync --full
|
|
151
|
+
inboxctl inbox -n 20
|
|
152
|
+
inboxctl search "from:github.com"
|
|
153
|
+
inboxctl email <id>
|
|
154
|
+
|
|
155
|
+
# actions
|
|
156
|
+
inboxctl archive <id>
|
|
157
|
+
inboxctl archive --query "label:newsletters"
|
|
158
|
+
inboxctl label <id> Receipts
|
|
159
|
+
inboxctl read <id>
|
|
160
|
+
inboxctl forward <id> you@example.com
|
|
161
|
+
inboxctl undo <run-id>
|
|
162
|
+
inboxctl history
|
|
163
|
+
|
|
164
|
+
# analytics
|
|
165
|
+
inboxctl stats
|
|
166
|
+
inboxctl stats senders --top 20
|
|
167
|
+
inboxctl stats newsletters
|
|
168
|
+
inboxctl stats volume --period week
|
|
169
|
+
|
|
170
|
+
# rules
|
|
171
|
+
inboxctl rules deploy
|
|
172
|
+
inboxctl rules run label-receipts
|
|
173
|
+
inboxctl rules run label-receipts --apply
|
|
174
|
+
inboxctl rules diff
|
|
175
|
+
inboxctl rules undo <run-id>
|
|
176
|
+
|
|
177
|
+
# filters
|
|
178
|
+
inboxctl filters list
|
|
179
|
+
inboxctl filters create --from newsletter@example.com --label Newsletters --archive
|
|
180
|
+
inboxctl filters delete <id>
|
|
181
|
+
|
|
182
|
+
# labels
|
|
183
|
+
inboxctl labels list
|
|
184
|
+
inboxctl labels create Receipts
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Configuration
|
|
188
|
+
|
|
189
|
+
`inboxctl` reads from environment variables in `.env` and persistent settings in `~/.config/inboxctl/config.json`.
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
|
|
193
|
+
GOOGLE_CLIENT_SECRET=your-client-secret
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Optional:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
GOOGLE_REDIRECT_URI=http://127.0.0.1:3456/callback
|
|
200
|
+
INBOXCTL_GMAIL_TRANSPORT=auto
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Run `inboxctl setup` for a guided walkthrough.
|
|
204
|
+
|
|
205
|
+
If you want to configure Google manually:
|
|
206
|
+
|
|
207
|
+
1. Create or select a Google Cloud project.
|
|
208
|
+
2. Enable the Gmail API.
|
|
209
|
+
3. Configure the OAuth consent screen.
|
|
210
|
+
4. Create a Web application OAuth client.
|
|
211
|
+
5. Add `http://127.0.0.1:3456/callback` as an authorized redirect URI.
|
|
212
|
+
6. Copy the client ID and client secret into `.env` or `~/.config/inboxctl/config.json`.
|
|
213
|
+
|
|
214
|
+
Required scopes:
|
|
215
|
+
|
|
216
|
+
- `https://www.googleapis.com/auth/gmail.modify`
|
|
217
|
+
- `https://www.googleapis.com/auth/gmail.labels`
|
|
218
|
+
- `https://www.googleapis.com/auth/gmail.settings.basic`
|
|
219
|
+
- `https://www.googleapis.com/auth/userinfo.email`
|
|
220
|
+
|
|
221
|
+
Helpful console links:
|
|
222
|
+
|
|
223
|
+
- [Google Cloud APIs dashboard](https://console.cloud.google.com/apis/dashboard)
|
|
224
|
+
- [Gmail API](https://console.cloud.google.com/apis/library/gmail.googleapis.com)
|
|
225
|
+
- [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent)
|
|
226
|
+
- [Credentials page](https://console.cloud.google.com/apis/credentials)
|
|
227
|
+
|
|
228
|
+
| Path | Purpose |
|
|
229
|
+
|------|---------|
|
|
230
|
+
| `~/.config/inboxctl/config.json` | Persistent settings |
|
|
231
|
+
| `~/.config/inboxctl/emails.db` | SQLite cache |
|
|
232
|
+
| `~/.config/inboxctl/tokens.json` | OAuth tokens |
|
|
233
|
+
| `./rules/` | YAML rule definitions |
|
|
234
|
+
|
|
235
|
+
## Requirements
|
|
236
|
+
|
|
237
|
+
- Node.js 20 or newer
|
|
238
|
+
- A Google Cloud project with OAuth credentials and the Gmail API enabled
|
|
239
|
+
- A Gmail or Google Workspace account
|
|
240
|
+
- Build tooling for `better-sqlite3`
|
|
241
|
+
|
|
242
|
+
Native dependency note:
|
|
243
|
+
|
|
244
|
+
- macOS: install Xcode Command Line Tools with `xcode-select --install`
|
|
245
|
+
- Debian or Ubuntu: install `build-essential`
|
|
246
|
+
- Windows: install Visual Studio Build Tools with C++ support
|
|
247
|
+
|
|
248
|
+
## Safety
|
|
249
|
+
|
|
250
|
+
- No deletion. There is no code path that calls `messages.delete` or `messages.trash`.
|
|
251
|
+
- Minimal OAuth scopes: `gmail.modify`, `gmail.labels`, `gmail.settings.basic`, and `userinfo.email`.
|
|
252
|
+
- Dry-run by default for rules.
|
|
253
|
+
- Audit trail for every reversible mutation.
|
|
254
|
+
- Undo support for reversible actions.
|
|
255
|
+
|
|
256
|
+
## Development
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
npm install
|
|
260
|
+
npm run build
|
|
261
|
+
npm run lint
|
|
262
|
+
npm test
|
|
263
|
+
npm run test:coverage
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Regenerating the demo recording
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
npm run build
|
|
270
|
+
vhs demo.tape
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
This writes `demo.gif` at the repo root. It requires [VHS](https://github.com/charmbracelet/vhs).
|
|
274
|
+
|
|
275
|
+
## License
|
|
276
|
+
|
|
277
|
+
MIT
|