@mailkite/mcp 0.8.0 → 0.10.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/README.md CHANGED
@@ -1,38 +1,30 @@
1
- # @mailkite/mcp
2
-
3
- [Model Context Protocol](https://modelcontextprotocol.io) server for
4
- [MailKite](https://mailkite.dev). It exposes the MailKite API to LLM agents
5
- (Claude Desktop, Claude Code, Cursor, …) as tools — send mail, manage domains,
6
- webhooks, routes, and inbound messages, all from a chat.
7
-
8
- > **Read-only mirror.** This repo is a generated, release-time mirror of the MailKite
9
- > monorepo (the private source of truth); the source isn't developed here. Install
10
- > `@mailkite/mcp` from npm rather than cloning, and see the docs at
11
- > <https://mailkite.dev/docs/libraries#mcp>.
12
-
13
- It's a **thin layer**. The tools, their input schemas, and validation all come
14
- from the shared SDK contract in [`../spec`](../spec); transport, auth, and error
15
- handling come from the [MailKite Node SDK](https://github.com/mailkite/mailkite-node). Nothing about the API is
16
- duplicated here — update the spec and the MCP follows.
17
-
18
- > ### Hosted vs local — which should I use?
19
- >
20
- > Most users should connect to the **hosted remote MCP** instead of running this
21
- > package: `https://mcp.mailkite.dev/mcp` (Streamable HTTP, one-click **OAuth** — no
22
- > key to copy, no local process). In Claude Code that's the **plugin**
23
- > (`/plugin marketplace add mailkite/claude-code` → `/plugin install mailkite@mailkite`)
24
- > or `claude mcp add --transport http mailkite https://mcp.mailkite.dev/mcp`. See
25
- > <https://mailkite.dev/docs/ai-agents>.
26
- >
27
- > Run **this local server** when you want a **static key** (no browser OAuth), **offline /
28
- > CI** use, a stdio-only client, a custom `MAILKITE_BASE_URL`, or `verifyWebhook` to run
29
- > fully locally. Both expose the exact same tools (same `../spec`).
30
-
31
- ## Install / configure
32
-
33
- Point your MCP client at the server and give it your MailKite credential. The
34
- token is the same one the SDKs take: an `mk_live_…` API key (for sending) or a
35
- management session token.
1
+ <p align="center">
2
+ <a href="https://mailkite.dev">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://mailkite.dev/brand/logo-email-dark.png">
5
+ <img src="https://mailkite.dev/brand/logo-email.png" alt="MailKite" height="56">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ <h1 align="center">@mailkite/mcp</h1>
11
+
12
+ <p align="center">
13
+ <b>Email for every product you ship</b> — receive email as a webhook, send over a verified domain, give an AI agent its own inbox.
14
+ <br>The official <a href="https://mailkite.dev">MailKite</a> library for AI agents (MCP).
15
+ </p>
16
+
17
+ <p align="center">
18
+ <a href="https://mailkite.dev/docs">Docs</a> ·
19
+ <a href="https://mailkite.dev/docs/libraries#mcp">Library guide</a> ·
20
+ <a href="https://mailkite.dev">mailkite.dev</a> ·
21
+ <a href="https://mailkite.dev/docs/ai-agents">AI agents</a>
22
+ </p>
23
+ <p align="center"><a href="https://www.npmjs.com/package/@mailkite/mcp"><img src="https://img.shields.io/npm/v/@mailkite/mcp?color=2563eb&label=npm" alt="npm"></a></p>
24
+
25
+ > **Read-only mirror.** This repo is a generated, release-time mirror of the MailKite monorepo (the private source of truth) — development doesn't happen here. Install from npm and open issues against the [MailKite docs](https://mailkite.dev/docs).
26
+
27
+ ## Install
36
28
 
37
29
  ```json
38
30
  {
@@ -46,63 +38,63 @@ management session token.
46
38
  }
47
39
  ```
48
40
 
49
- | Env var | Required | Default | Notes |
50
- | --- | --- | --- | --- |
51
- | `MAILKITE_API_KEY` | yes | — | Bearer credential (`mk_live_…` API key or session token) |
52
- | `MAILKITE_BASE_URL` | no | `https://api.mailkite.dev` | Override for local/staging |
53
-
54
41
  ## Tools
55
42
 
56
- One tool per MailKite API operation (generated from [`../spec/api.json`](../spec/api.json)):
57
-
58
- | Tool | Operation |
59
- | --- | --- |
60
- | `mailkite_send` | Send a message over a verified domain |
61
- | `mailkite_agent` | Send a message to an inbox agent and get its reply |
62
- | `mailkite_route` | Route a message to a registered route and run its action |
63
- | `mailkite_list_domains` | List your domains |
64
- | `mailkite_create_domain` | Add a domain (returns DNS records) |
65
- | `mailkite_get_domain` | Get one domain with DNS + webhook |
66
- | `mailkite_delete_domain` | Remove a domain |
67
- | `mailkite_verify_domain` | Check DNS and update status |
68
- | `mailkite_set_webhook` | Set/replace the domain catch-all webhook |
69
- | `mailkite_delete_webhook` | Remove the domain webhook |
70
- | `mailkite_test_webhook` | Send a signed test event to the webhook |
71
- | `mailkite_list_routes` | List inbound routing rules |
72
- | `mailkite_create_route` | Create a route (match, action, destination) |
73
- | `mailkite_list_messages` | List stored messages |
74
- | `mailkite_get_message` | Get a message with deliveries + attachments |
75
- | `mailkite_retry_delivery` | Re-deliver a stored message to its webhook |
76
- | `mailkite_verify_webhook` | Verify an `x-mailkite-signature` header (local — no API call) |
77
-
78
- `mailkite_verify_webhook` is a **local** tool: it runs the SDK's `verifyWebhook`
79
- in-process (no credential, no network) and returns `{ "valid": true | false }`.
80
- Every other tool is one MailKite API operation.
81
-
82
- Each tool's input is a flat object with the real field names (e.g.
83
- `mailkite_send` takes `from`, `to`, `subject`, `html`, `text`, …). Required
84
- fields and types are enforced with [`ajv`](https://ajv.js.org) against the same
85
- JSON Schemas in [`../spec/schemas`](../spec/schemas) that the SDKs and
86
- conformance harness use — invalid calls are rejected before any HTTP request.
87
-
88
- ## How it works
43
+ One tool per MailKite API method, generated from the shared contract — including `mailkite_send`, `mailkite_semantic_search`, `mailkite_agent`, domain/route/webhook management, and more. Full list + schemas: **https://mailkite.dev/docs/libraries#mcp**.
89
44
 
90
- ```
91
- api.json ──▶ one MCP tool per method (name, description, input schema)
92
- schemas/* ──▶ ajv validators (validate the call before dispatch)
93
- Node SDK ──▶ MailKite.request(method, path, body) (auth, HTTP, errors)
94
- local methods (verifyWebhook) dispatch in-process — no HTTP
95
- ```
45
+ ## Use it from an AI agent — MCP + Agent connectors
96
46
 
97
- See [`PLAN.md`](./PLAN.md) for the full design.
47
+ MailKite speaks the [Model Context Protocol](https://modelcontextprotocol.io): every API method is a tool your AI assistant (Claude, Cursor, …) can call — send mail, manage domains, search the docs, and give an agent its own inbox. Full guide: **[https://mailkite.dev/docs/ai-agents](https://mailkite.dev/docs/ai-agents)**.
98
48
 
99
- ## Develop
49
+ **Hosted (recommended) — one-click OAuth, no key to copy:**
100
50
 
101
51
  ```bash
102
- npm install
103
- npm test # boots the server over stdio, lists tools, checks validation + wire bytes
52
+ claude mcp add --transport http mailkite https://mcp.mailkite.dev/mcp
53
+ ```
54
+
55
+ In Claude Code you can also install the plugin:
56
+
57
+ ```text
58
+ /plugin marketplace add mailkite/claude-code
59
+ /plugin install mailkite@mailkite
104
60
  ```
105
61
 
106
- ## License
62
+ Any chat/UI agent: *"Add the MCP server at https://mcp.mailkite.dev/mcp and authenticate in the browser when prompted."*
63
+
64
+ **Local (static key, offline / CI):**
65
+
66
+ ```json
67
+ { "mcpServers": { "mailkite": { "command": "npx", "args": ["-y", "@mailkite/mcp"], "env": { "MAILKITE_API_KEY": "mk_live_…" } } } }
68
+ ```
107
69
 
108
- MIT
70
+ **Give an agent its own inbox.** Route inbound mail to a built-in **inbox agent** (the `agent` route action) and it answers, files, or escalates on its own — see [https://mailkite.dev/docs/ai-agents](https://mailkite.dev/docs/ai-agents).
71
+
72
+ ## All MailKite libraries
73
+
74
+ Same contract, every language — pick the one for your stack (full list: [https://mailkite.dev/docs/libraries](https://mailkite.dev/docs/libraries)):
75
+
76
+ | Library | Repo | Distribution |
77
+ | --- | --- | --- |
78
+ | MailKite for Node.js | [`mailkite-node`](https://github.com/mailkite/mailkite-node) | npm |
79
+ | MailKite for Python | [`mailkite-python`](https://github.com/mailkite/mailkite-python) | PyPI |
80
+ | MailKite for Ruby | [`mailkite-ruby`](https://github.com/mailkite/mailkite-ruby) | RubyGems |
81
+ | MailKite for Java | [`mailkite-java`](https://github.com/mailkite/mailkite-java) | Maven Central |
82
+ | MailKite for PHP | [`mailkite-php`](https://github.com/mailkite/mailkite-php) | Packagist |
83
+ | MailKite for Go | [`mailkite-go`](https://github.com/mailkite/mailkite-go) | Go modules |
84
+ | @mailkite/cli | [`mailkite-cli`](https://github.com/mailkite/mailkite-cli) | npm |
85
+ | @mailkite/mcp **(this repo)** | [`mailkite-mcp`](https://github.com/mailkite/mailkite-mcp) | npm |
86
+ | @mailkite/client | [`mailkite-js`](https://github.com/mailkite/mailkite-js) | npm |
87
+ | @mailkite/expo | [`mailkite-expo`](https://github.com/mailkite/mailkite-expo) | npm |
88
+ | MailKiteClient | [`mailkite-swift`](https://github.com/mailkite/mailkite-swift) | Swift Package Manager |
89
+ | dev.mailkite:mailkite-client | [`mailkite-kotlin`](https://github.com/mailkite/mailkite-kotlin) | Maven Central |
90
+ | mailkite_client | [`mailkite-flutter`](https://github.com/mailkite/mailkite-flutter) | pub.dev |
91
+
92
+ ## Docs & links
93
+
94
+ - 📚 **Documentation:** https://mailkite.dev/docs
95
+ - 📦 **This library's guide:** https://mailkite.dev/docs/libraries#mcp
96
+ - 🤖 **AI agents (MCP + inbox agents):** https://mailkite.dev/docs/ai-agents
97
+ - 🌐 **Website:** https://mailkite.dev
98
+ - 🧭 **All libraries:** https://mailkite.dev/docs/libraries
99
+
100
+ <sub>Generated from the shared MailKite API contract. © MailKite.</sub>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailkite/mcp",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Model Context Protocol server for MailKite — exposes the MailKite API to LLM agents as tools. A thin layer over the MailKite Node SDK and the shared sdks/spec contract.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -40,6 +40,6 @@
40
40
  "dependencies": {
41
41
  "@modelcontextprotocol/sdk": "^1.0.0",
42
42
  "ajv": "^8.17.1",
43
- "mailkite": "^0.8.0"
43
+ "mailkite": "^0.10.0"
44
44
  }
45
45
  }
package/spec/TODO.md ADDED
@@ -0,0 +1,36 @@
1
+ # Spec TODO — propagate pending changes
2
+
3
+ Visible checklist for spec changes that are **documented in `api.json` but not yet fully
4
+ propagated** to the hand-written SDKs / plugin / registries. Clear an item once it ships.
5
+
6
+ ## `listMessages` + `listListContacts` — optional `before` / `limit` paging
7
+
8
+ **Status (2026-06-28):** documented in `api.json` (method `summary` + a structured
9
+ `optionalQuery` field) and live on the API (`GET /api/messages`, `GET /api/lists/:id/contacts`
10
+ honor `before`/`limit`; response stays a **bare array**, default = pre-pagination behavior).
11
+
12
+ ### ✅ Done
13
+
14
+ - [x] All **6 server SDKs** expose optional `before`/`limit` (idiomatic per language: positional
15
+ optional in node/python/ruby/php, boxed-nullable overloads in java, functional options
16
+ `mailkite.Before()/Limit()` in go). Backward compatible — no-arg calls unchanged.
17
+ - [x] Each conformance runner forwards them + `cases.json` exercises real values;
18
+ `cd sdks/conformance && node run.mjs` → **55/55 across all 6**.
19
+ - [x] **CLI** `messages list --before --limit`.
20
+ - [x] SDK docs regenerated (`node sdks/scripts/build-sdk-docs.mjs`) — server-SDK method pages list
21
+ the optional params (client libs intentionally skipped; they don't expose them, see below).
22
+
23
+ ### ⏳ Still deferred (kept optional + low-value / blocked)
24
+
25
+ These need optional-query-param support that doesn't exist yet, and the API tree is mid-refactor
26
+ (another agent), so the hosted-MCP redeploy is held.
27
+
28
+ - [ ] Add optional-query support to `sdks/clients/codegen.mjs` so the **4 client libs**
29
+ (TS/Kotlin/Flutter/Swift) emit `before?`/`limit?`, then regen.
30
+ - [ ] Both MCP servers expose them as **optional** tool inputs — needs `tools.ts` +
31
+ `sdks/mcp/server.mjs` to stop forcing `in:"query"` args into `required`. Hosted MCP also
32
+ needs `cd api && npm run deploy` from a clean tree.
33
+ - [ ] Claude Code **plugin** (`plugin/`) refresh if it pins tool schemas.
34
+
35
+ > Until those land, MCP/client-lib users reach `before`/`limit` via the low-level `request()`
36
+ > escape hatch (`GET /api/messages?before=…&limit=…`).
package/spec/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailkite",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Canonical interface contract for every MailKite SDK. One low-level request() plus one function per endpoint. All languages expose the same shape; only naming adapts to each language's convention (e.g. Go exports PascalCase).",
5
5
  "baseUrl": "https://api.mailkite.dev",
6
6
  "auth": {
@@ -305,12 +305,16 @@
305
305
  },
306
306
  {
307
307
  "name": "listMessages",
308
- "summary": "List stored messages.",
308
+ "summary": "List stored messages, newest first. Optionally page with `before` (a `received_at` cursor) and `limit`; omit both for the default newest 100. Response is a bare array — paginate by passing the last row's `received_at` as the next `before`.",
309
309
  "http": {
310
310
  "method": "GET",
311
311
  "path": "/api/messages"
312
312
  },
313
313
  "args": [],
314
+ "optionalQuery": [
315
+ { "name": "before", "type": "integer", "description": "Cursor: return only messages with `received_at` strictly less than this (epoch ms). Omit for the first page." },
316
+ { "name": "limit", "type": "integer", "description": "Max rows to return, 1–200. Omitted = newest 100 (the pre-pagination default)." }
317
+ ],
314
318
  "returns": "any"
315
319
  },
316
320
  {
@@ -421,7 +425,7 @@
421
425
  },
422
426
  {
423
427
  "name": "listListContacts",
424
- "summary": "List the contacts that are members of a list.",
428
+ "summary": "List the contacts that are members of a list, newest first. Optionally page with `before` (a `last_seen_at`/`created_at` cursor) and `limit`. Response is a bare array — paginate by passing the last row's `last_seen_at` (or `created_at`) as the next `before`.",
425
429
  "http": {
426
430
  "method": "GET",
427
431
  "path": "/api/lists/{id}/contacts"
@@ -432,6 +436,10 @@
432
436
  "in": "path"
433
437
  }
434
438
  ],
439
+ "optionalQuery": [
440
+ { "name": "before", "type": "integer", "description": "Cursor: return only members with `last_seen_at` (or `created_at`) strictly less than this (epoch ms). Omit for the first page." },
441
+ { "name": "limit", "type": "integer", "description": "Max rows to return (default 100, max 500)." }
442
+ ],
435
443
  "returns": "any"
436
444
  },
437
445
  {
package/spec/cases.json CHANGED
@@ -630,7 +630,10 @@
630
630
  {
631
631
  "name": "list_messages",
632
632
  "method": "listMessages",
633
- "args": {},
633
+ "args": {
634
+ "before": 1717000000000,
635
+ "limit": 50
636
+ },
634
637
  "request": {
635
638
  "method": "GET",
636
639
  "path": "/api/messages"
@@ -824,7 +827,9 @@
824
827
  "name": "list_list_contacts",
825
828
  "method": "listListContacts",
826
829
  "args": {
827
- "id": "lst_1"
830
+ "id": "lst_1",
831
+ "before": 1717000000000,
832
+ "limit": 25
828
833
  },
829
834
  "request": {
830
835
  "method": "GET",