@receiverdotemail/mcp 0.0.0-stage → 0.1.1
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 +102 -2
- package/dist/http.d.ts +38 -0
- package/dist/http.js +177 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +41 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.js +127 -0
- package/dist/tools.d.ts +85 -0
- package/dist/tools.js +116 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.js +3 -0
- package/package.json +66 -4
package/README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @receiverdotemail/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Model Context Protocol](https://modelcontextprotocol.io) server for [Receiver.email](https://receiver.email). It gives an AI agent real inboxes: create an address, use it in a sign-up or login form, and read the verification code or magic link that arrives.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. In the Receiver.email dashboard, open a project and create an API key (`recv_live_...`). Use one project per agent: the key only sees its own project's mail.
|
|
8
|
+
2. Add the server to your client with `RECEIVER_API_KEY` in its environment.
|
|
9
|
+
|
|
10
|
+
### Claude Code
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
claude mcp add receiver --env RECEIVER_API_KEY=recv_live_... -- npx -y @receiverdotemail/mcp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Claude Desktop
|
|
17
|
+
|
|
18
|
+
`claude_desktop_config.json` (Settings > Developer > Edit Config):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"receiver": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@receiverdotemail/mcp"],
|
|
26
|
+
"env": { "RECEIVER_API_KEY": "recv_live_..." }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Cursor
|
|
33
|
+
|
|
34
|
+
`~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"receiver": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "@receiverdotemail/mcp"],
|
|
42
|
+
"env": { "RECEIVER_API_KEY": "recv_live_..." }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Configuration
|
|
49
|
+
|
|
50
|
+
| Variable | Required | Default |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| `RECEIVER_API_KEY` | yes | |
|
|
53
|
+
| `RECEIVER_API_URL` | no | `https://api.receiver.email/api/v1` |
|
|
54
|
+
|
|
55
|
+
The server speaks MCP over stdio and identifies itself to the API as `receiver-mcp/<version>`.
|
|
56
|
+
|
|
57
|
+
### Remote server
|
|
58
|
+
|
|
59
|
+
Agents that can't start a local process (hosted agents, the Claude API's MCP connector) can use the hosted server at `https://mcp.receiver.email/mcp`, with the same four tools. Send your project API key on every request:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Authorization: Bearer recv_live_...
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For example, in Claude Code:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
claude mcp add --transport http receiver https://mcp.receiver.email/mcp \
|
|
69
|
+
--header "Authorization: Bearer recv_live_..."
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
To run it yourself, start `receiver-mcp --http`: it serves Streamable HTTP at `/mcp` on `PORT` (default 8080), plus `GET /health`. It is stateless and holds no key of its own. It doesn't keep a caller's key between requests; it remembers which project an accepted key belongs to (by the key's SHA-256) for up to 10 minutes, so it needn't look that up on every request. `RECEIVER_API_URL` sets the API it calls.
|
|
73
|
+
|
|
74
|
+
## Tools
|
|
75
|
+
|
|
76
|
+
| Tool | Input | Returns |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `create_inbox` | `{ prefix? }` | `{ address, since }` |
|
|
79
|
+
| `wait_for_email` | `{ address, since?, timeoutSeconds? (default 60, max 300), extract?: "otp" \| "links" \| "none" }` | `{ status: "received", email: { id, from, subject, receivedAt, text }, otp?, links? }` or `{ status: "timeout", since, hint }` |
|
|
80
|
+
| `list_emails` | `{ address?, limit? (default 10, max 50) }` | `{ emails: [{ id, from, to, subject, receivedAt }] }` |
|
|
81
|
+
| `get_email` | `{ id, format?: "text" \| "html" }` | `{ id, from, to, subject, receivedAt, body, links, attachments }` |
|
|
82
|
+
|
|
83
|
+
The typical flow:
|
|
84
|
+
|
|
85
|
+
1. `create_inbox` returns an address and `since` (the moment it was created).
|
|
86
|
+
2. The agent enters the address in a form.
|
|
87
|
+
3. `wait_for_email` with the address, the same `since` and `extract: "otp"` returns the code (`otp: { code, candidates }`, or `otp: null` when the email has no code). Only mail received strictly after `since` counts, so an older message is never returned.
|
|
88
|
+
4. On `status: "timeout"`, call `wait_for_email` again with the same `since`. For the next email to the same address, pass the previous email's `receivedAt` as `since`.
|
|
89
|
+
|
|
90
|
+
`text` in `wait_for_email` is cut at 4000 characters; `get_email` returns the full body. While waiting, the server sends MCP progress notifications every 10 seconds when the client asks for them, so clients that reset their request timeout on progress don't give up on long waits.
|
|
91
|
+
|
|
92
|
+
Errors (missing or rejected key, rate limits, unreachable API, bad arguments) come back as tool results with `isError: true` and a one-line fix, for example `RECEIVER_API_KEY is not set. Set RECEIVER_API_KEY to a project API key ...`.
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm ci
|
|
98
|
+
npm run typecheck && npm test # uses ../typescript-sdk/src directly; no build needed
|
|
99
|
+
npm run build # builds ../typescript-sdk, then dist/
|
|
100
|
+
RECEIVER_API_KEY=recv_live_... npx @modelcontextprotocol/inspector node dist/index.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The SDK dependency is `file:../typescript-sdk` inside this monorepo; publishing replaces it with the released `@receiverdotemail/sdk` version range.
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The same four tools over MCP's Streamable HTTP transport, for agents that
|
|
3
|
+
* can't run a local process (hosted agents, the Claude and OpenAI APIs' MCP
|
|
4
|
+
* connectors, web clients). Each request brings its own project API key as
|
|
5
|
+
* `Authorization: Bearer recv_live_...`; the server holds no key of its own,
|
|
6
|
+
* keeps no key between requests and has no MCP session state. It remembers
|
|
7
|
+
* which project each key belongs to (see clientFor).
|
|
8
|
+
*
|
|
9
|
+
* POST /mcp MCP over Streamable HTTP, stateless (no sessions)
|
|
10
|
+
* GET /health liveness, no auth
|
|
11
|
+
*/
|
|
12
|
+
import { type IncomingMessage, type Server, type ServerResponse } from 'node:http';
|
|
13
|
+
import type { ToolClient } from './tools.js';
|
|
14
|
+
export declare const MCP_PATH = "/mcp";
|
|
15
|
+
export declare const HEALTH_PATH = "/health";
|
|
16
|
+
/** What a remote caller is told to do about a missing or rejected key. */
|
|
17
|
+
export declare const REMOTE_KEY_FIX: string;
|
|
18
|
+
/** What a remote caller is told when this server can't reach the API: nothing for them to configure. */
|
|
19
|
+
export declare const REMOTE_NETWORK_FIX = "The problem is on Receiver.email's side. Retry in a few seconds.";
|
|
20
|
+
export interface HttpHandlerOptions {
|
|
21
|
+
/** The Receiver.email API the tools call. Defaults to `RECEIVER_API_URL`, then the public API. */
|
|
22
|
+
apiUrl?: string;
|
|
23
|
+
/** Build the client for a request's key instead of a real one (tests). */
|
|
24
|
+
clientFor?: (apiKey: string) => ToolClient;
|
|
25
|
+
/** How often to send progress notifications during wait_for_email, in ms. */
|
|
26
|
+
progressIntervalMs?: number;
|
|
27
|
+
/** Size and lifetime of the key-to-project cache (defaults: 1000 keys, 10 minutes). */
|
|
28
|
+
projectCache?: {
|
|
29
|
+
max?: number;
|
|
30
|
+
ttlMs?: number;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The key from `Authorization: Bearer <key>`, or undefined. */
|
|
34
|
+
export declare function bearerKey(req: IncomingMessage): string | undefined;
|
|
35
|
+
/** A Node request handler serving MCP at /mcp and a health check at /health. */
|
|
36
|
+
export declare function createHttpHandler(options?: HttpHandlerOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
37
|
+
/** Start the HTTP server (Cloud Run sets PORT). */
|
|
38
|
+
export declare function startHttpServer(port: number, options?: HttpHandlerOptions): Server;
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The same four tools over MCP's Streamable HTTP transport, for agents that
|
|
3
|
+
* can't run a local process (hosted agents, the Claude and OpenAI APIs' MCP
|
|
4
|
+
* connectors, web clients). Each request brings its own project API key as
|
|
5
|
+
* `Authorization: Bearer recv_live_...`; the server holds no key of its own,
|
|
6
|
+
* keeps no key between requests and has no MCP session state. It remembers
|
|
7
|
+
* which project each key belongs to (see clientFor).
|
|
8
|
+
*
|
|
9
|
+
* POST /mcp MCP over Streamable HTTP, stateless (no sessions)
|
|
10
|
+
* GET /health liveness, no auth
|
|
11
|
+
*/
|
|
12
|
+
import { createHash } from 'node:crypto';
|
|
13
|
+
import { createServer as createHttpServer } from 'node:http';
|
|
14
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
15
|
+
import { AuthenticationError, DEFAULT_BASE_URL, ReceiverClient } from '@receiverdotemail/sdk';
|
|
16
|
+
import { createServer } from './server.js';
|
|
17
|
+
import { USER_AGENT, VERSION } from './version.js';
|
|
18
|
+
export const MCP_PATH = '/mcp';
|
|
19
|
+
export const HEALTH_PATH = '/health';
|
|
20
|
+
/** Project API keys look like this; the API refuses anything else as a key. */
|
|
21
|
+
const API_KEY_PREFIX = 'recv_live_';
|
|
22
|
+
/** What a remote caller is told to do about a missing or rejected key. */
|
|
23
|
+
export const REMOTE_KEY_FIX = 'Send a project API key (recv_live_...) from the Receiver.email dashboard (Project > API keys) as the ' +
|
|
24
|
+
'Authorization: Bearer header in your MCP client\'s config for this server.';
|
|
25
|
+
/** What a remote caller is told when this server can't reach the API: nothing for them to configure. */
|
|
26
|
+
export const REMOTE_NETWORK_FIX = 'The problem is on Receiver.email\'s side. Retry in a few seconds.';
|
|
27
|
+
/** How long a key's project (looked up with whoami) is remembered, and for how many keys. */
|
|
28
|
+
const PROJECT_TTL_MS = 10 * 60_000;
|
|
29
|
+
const MAX_PROJECTS = 1000;
|
|
30
|
+
const CORS_HEADERS = {
|
|
31
|
+
// Bearer keys, not cookies: there is no ambient credential for another origin to ride on
|
|
32
|
+
'Access-Control-Allow-Origin': '*',
|
|
33
|
+
'Access-Control-Allow-Methods': 'POST, GET, DELETE, OPTIONS',
|
|
34
|
+
'Access-Control-Allow-Headers': 'Authorization, Content-Type, Accept, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-ID',
|
|
35
|
+
'Access-Control-Expose-Headers': 'Mcp-Session-Id, WWW-Authenticate',
|
|
36
|
+
'Access-Control-Max-Age': '86400',
|
|
37
|
+
};
|
|
38
|
+
function sendJson(res, status, body, headers = {}) {
|
|
39
|
+
res.writeHead(status, { ...CORS_HEADERS, 'Content-Type': 'application/json', ...headers });
|
|
40
|
+
res.end(JSON.stringify(body));
|
|
41
|
+
}
|
|
42
|
+
/** A JSON-RPC error with no request id: the shape MCP clients expect from a rejected HTTP request. */
|
|
43
|
+
const rpcError = (code, message) => ({ jsonrpc: '2.0', error: { code, message }, id: null });
|
|
44
|
+
/** The key from `Authorization: Bearer <key>`, or undefined. */
|
|
45
|
+
export function bearerKey(req) {
|
|
46
|
+
const header = req.headers.authorization;
|
|
47
|
+
const match = header && /^Bearer\s+(\S+)\s*$/i.exec(header);
|
|
48
|
+
return match ? match[1] : undefined;
|
|
49
|
+
}
|
|
50
|
+
/** The request's path without query string or trailing slashes. Never throws, whatever the request line holds. */
|
|
51
|
+
function pathOf(req) {
|
|
52
|
+
const path = (req.url ?? '/').split('?')[0];
|
|
53
|
+
return path.replace(/\/+$/, '') || '/';
|
|
54
|
+
}
|
|
55
|
+
/** A Node request handler serving MCP at /mcp and a health check at /health. */
|
|
56
|
+
export function createHttpHandler(options = {}) {
|
|
57
|
+
if (process.env.RECEIVER_PROJECT_ID) {
|
|
58
|
+
// The SDK would use it as every caller's default project
|
|
59
|
+
throw new Error('Unset RECEIVER_PROJECT_ID for the remote MCP server: each caller\'s key picks its own project.');
|
|
60
|
+
}
|
|
61
|
+
const apiUrl = options.apiUrl || process.env.RECEIVER_API_URL || DEFAULT_BASE_URL;
|
|
62
|
+
// Each key's project, remembered after a successful whoami so it isn't looked
|
|
63
|
+
// up on every request (whoami counts against the plan's per-minute limit).
|
|
64
|
+
// Keyed by the key's SHA-256 and holding only the project id: no key is kept
|
|
65
|
+
// between requests. Only keys the API accepted are cached, so junk keys can't
|
|
66
|
+
// push real ones out; least recently used goes first. A key revoked while
|
|
67
|
+
// cached still fails on its next real call.
|
|
68
|
+
const maxProjects = options.projectCache?.max ?? MAX_PROJECTS;
|
|
69
|
+
const projectTtlMs = options.projectCache?.ttlMs ?? PROJECT_TTL_MS;
|
|
70
|
+
const projects = new Map();
|
|
71
|
+
/** The SDK client for a request's key, or 'rejected' when the API refuses the key. */
|
|
72
|
+
const clientFor = async (apiKey) => {
|
|
73
|
+
if (options.clientFor)
|
|
74
|
+
return options.clientFor(apiKey);
|
|
75
|
+
const base = { apiKey, baseUrl: apiUrl, userAgent: `${USER_AGENT} (remote)` };
|
|
76
|
+
const id = createHash('sha256').update(apiKey).digest('hex');
|
|
77
|
+
const now = Date.now();
|
|
78
|
+
const cached = projects.get(id);
|
|
79
|
+
projects.delete(id);
|
|
80
|
+
if (cached && cached.expires > now) {
|
|
81
|
+
projects.set(id, cached); // most recently used last
|
|
82
|
+
return new ReceiverClient({ ...base, projectId: cached.projectId });
|
|
83
|
+
}
|
|
84
|
+
const client = new ReceiverClient(base);
|
|
85
|
+
try {
|
|
86
|
+
const projectId = await client.resolveProjectId();
|
|
87
|
+
projects.set(id, { projectId, expires: now + projectTtlMs });
|
|
88
|
+
while (projects.size > maxProjects)
|
|
89
|
+
projects.delete(projects.keys().next().value);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error instanceof AuthenticationError)
|
|
93
|
+
return 'rejected';
|
|
94
|
+
// Anything else (API unreachable, rate limited): the tool calls report it
|
|
95
|
+
}
|
|
96
|
+
return client;
|
|
97
|
+
};
|
|
98
|
+
return async function handle(req, res) {
|
|
99
|
+
try {
|
|
100
|
+
const path = pathOf(req);
|
|
101
|
+
if (path === HEALTH_PATH && (req.method === 'GET' || req.method === 'HEAD')) {
|
|
102
|
+
return sendJson(res, 200, { status: 'ok', version: VERSION });
|
|
103
|
+
}
|
|
104
|
+
if (path !== MCP_PATH) {
|
|
105
|
+
return sendJson(res, 404, { error: { code: 'NOT_FOUND', message: `Not found. The MCP endpoint is ${MCP_PATH}.` } });
|
|
106
|
+
}
|
|
107
|
+
if (req.method === 'OPTIONS') {
|
|
108
|
+
res.writeHead(204, CORS_HEADERS);
|
|
109
|
+
return void res.end();
|
|
110
|
+
}
|
|
111
|
+
if (req.method !== 'POST') {
|
|
112
|
+
// Stateless: no standalone SSE stream (GET) and no session to end (DELETE)
|
|
113
|
+
return sendJson(res, 405, rpcError(-32000, 'Method not allowed. This server is stateless: send JSON-RPC with POST.'), {
|
|
114
|
+
Allow: 'POST, OPTIONS',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const apiKey = bearerKey(req);
|
|
118
|
+
if (!apiKey || !apiKey.startsWith(API_KEY_PREFIX)) {
|
|
119
|
+
const problem = apiKey ? 'That is not a project API key.' : 'Missing API key.';
|
|
120
|
+
return sendJson(res, 401, rpcError(-32001, `${problem} ${REMOTE_KEY_FIX}`), {
|
|
121
|
+
'WWW-Authenticate': 'Bearer realm="receiver.email"',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const client = await clientFor(apiKey);
|
|
125
|
+
if (client === 'rejected') {
|
|
126
|
+
return sendJson(res, 401, rpcError(-32001, `The API key was rejected. ${REMOTE_KEY_FIX}`), {
|
|
127
|
+
'WWW-Authenticate': 'Bearer realm="receiver.email", error="invalid_token"',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
for (const [name, value] of Object.entries(CORS_HEADERS))
|
|
131
|
+
res.setHeader(name, value);
|
|
132
|
+
// A server and transport per request: no MCP state is shared between callers
|
|
133
|
+
const server = createServer({
|
|
134
|
+
env: { RECEIVER_API_URL: apiUrl },
|
|
135
|
+
client,
|
|
136
|
+
progressIntervalMs: options.progressIntervalMs,
|
|
137
|
+
keyFix: REMOTE_KEY_FIX,
|
|
138
|
+
networkFix: REMOTE_NETWORK_FIX,
|
|
139
|
+
});
|
|
140
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
|
|
141
|
+
// Closing aborts in-flight tool calls, so a caller hanging up stops its wait_for_email
|
|
142
|
+
res.on('close', () => {
|
|
143
|
+
void transport.close();
|
|
144
|
+
void server.close();
|
|
145
|
+
});
|
|
146
|
+
await server.connect(transport);
|
|
147
|
+
await transport.handleRequest(req, res);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
console.error('receiver-mcp: request failed', error);
|
|
151
|
+
if (!res.headersSent)
|
|
152
|
+
sendJson(res, 500, rpcError(-32603, 'Internal server error'));
|
|
153
|
+
else
|
|
154
|
+
res.end();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** Start the HTTP server (Cloud Run sets PORT). */
|
|
159
|
+
export function startHttpServer(port, options = {}) {
|
|
160
|
+
const handler = createHttpHandler(options);
|
|
161
|
+
const server = createHttpServer((req, res) => {
|
|
162
|
+
handler(req, res).catch(error => {
|
|
163
|
+
// handle() catches its own errors; this is the last guard so nothing can take the process down
|
|
164
|
+
console.error('receiver-mcp: unhandled request error', error);
|
|
165
|
+
if (!res.headersSent)
|
|
166
|
+
res.writeHead(500);
|
|
167
|
+
res.end();
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
// Time limits for *receiving* a request (slow senders); they don't cap the
|
|
171
|
+
// response, so a wait_for_email can stream for its full 300 s
|
|
172
|
+
server.requestTimeout = 30_000;
|
|
173
|
+
server.headersTimeout = 20_000;
|
|
174
|
+
server.keepAliveTimeout = 65_000;
|
|
175
|
+
server.listen(port);
|
|
176
|
+
return server;
|
|
177
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* receiver-mcp: Receiver.email MCP server.
|
|
4
|
+
*
|
|
5
|
+
* receiver-mcp stdio, for a local MCP client. Config: RECEIVER_API_KEY (required),
|
|
6
|
+
* RECEIVER_API_URL (optional).
|
|
7
|
+
* receiver-mcp --http Streamable HTTP on PORT (default 8080) at /mcp, for remote clients.
|
|
8
|
+
* Each request sends its own key as Authorization: Bearer; RECEIVER_API_URL
|
|
9
|
+
* (optional) is the API the tools call.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* receiver-mcp: Receiver.email MCP server.
|
|
4
|
+
*
|
|
5
|
+
* receiver-mcp stdio, for a local MCP client. Config: RECEIVER_API_KEY (required),
|
|
6
|
+
* RECEIVER_API_URL (optional).
|
|
7
|
+
* receiver-mcp --http Streamable HTTP on PORT (default 8080) at /mcp, for remote clients.
|
|
8
|
+
* Each request sends its own key as Authorization: Bearer; RECEIVER_API_URL
|
|
9
|
+
* (optional) is the API the tools call.
|
|
10
|
+
*/
|
|
11
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
12
|
+
import { MCP_PATH, startHttpServer } from './http.js';
|
|
13
|
+
import { createServer } from './server.js';
|
|
14
|
+
import { VERSION } from './version.js';
|
|
15
|
+
if (process.argv.includes('--version')) {
|
|
16
|
+
console.log(VERSION);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
if (process.argv.includes('--http')) {
|
|
20
|
+
// A shared server must never fall back to one project's key or project for every caller
|
|
21
|
+
for (const name of ['RECEIVER_API_KEY', 'RECEIVER_PROJECT_ID']) {
|
|
22
|
+
if (process.env[name]) {
|
|
23
|
+
console.error(`receiver-mcp: ignoring ${name} in --http mode; each request's key picks its project.`);
|
|
24
|
+
delete process.env[name];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const port = Number(process.env.PORT) || 8080;
|
|
28
|
+
const server = startHttpServer(port);
|
|
29
|
+
console.error(`receiver-mcp ${VERSION}: Streamable HTTP on :${port}${MCP_PATH}`);
|
|
30
|
+
const stop = () => server.close(() => process.exit(0));
|
|
31
|
+
process.on('SIGTERM', stop);
|
|
32
|
+
process.on('SIGINT', stop);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (!process.env.RECEIVER_API_KEY) {
|
|
36
|
+
// stdout is the protocol channel: diagnostics go to stderr
|
|
37
|
+
console.error('receiver-mcp: RECEIVER_API_KEY is not set; tools will return an error until it is.');
|
|
38
|
+
}
|
|
39
|
+
const server = createServer();
|
|
40
|
+
await server.connect(new StdioServerTransport());
|
|
41
|
+
}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Receiver.email MCP server: four tools that give a model real inboxes.
|
|
3
|
+
*/
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { type ToolClient } from './tools.js';
|
|
6
|
+
export interface ServerOptions {
|
|
7
|
+
/** Defaults to `process.env` (`RECEIVER_API_KEY`, `RECEIVER_API_URL`). */
|
|
8
|
+
env?: Record<string, string | undefined>;
|
|
9
|
+
/** Use this client instead of building one from the env (tests). */
|
|
10
|
+
client?: ToolClient;
|
|
11
|
+
/** How often to send progress notifications during wait_for_email, in ms. */
|
|
12
|
+
progressIntervalMs?: number;
|
|
13
|
+
/** How to fix a missing or rejected key, appended to those errors (the remote server's differs). */
|
|
14
|
+
keyFix?: string;
|
|
15
|
+
/** Replaces the network error's advice (which names the API URL and RECEIVER_API_URL) on the remote server. */
|
|
16
|
+
networkFix?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function createServer(options?: ServerOptions): McpServer;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Receiver.email MCP server: four tools that give a model real inboxes.
|
|
3
|
+
*/
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { DEFAULT_BASE_URL, ReceiverClient, ReceiverError } from '@receiverdotemail/sdk';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { createInbox, describeError, getEmail, listEmails, waitForEmail, } from './tools.js';
|
|
8
|
+
import { USER_AGENT, VERSION } from './version.js';
|
|
9
|
+
const INSTRUCTIONS = `Receiver.email gives you real email addresses that can receive mail.
|
|
10
|
+
Typical flow: create_inbox -> use the address in a sign-up/login/reset form -> wait_for_email with the address and the since from create_inbox (extract "otp" for a code, "links" for a magic link).
|
|
11
|
+
On status "timeout", call wait_for_email again with the same since. Use a new inbox per task.`;
|
|
12
|
+
const isoTimestamp = z
|
|
13
|
+
.string()
|
|
14
|
+
.refine(value => !Number.isNaN(Date.parse(value)), 'must be an ISO 8601 timestamp, e.g. the since returned by create_inbox');
|
|
15
|
+
export function createServer(options = {}) {
|
|
16
|
+
const env = options.env ?? process.env;
|
|
17
|
+
const apiUrl = env.RECEIVER_API_URL || DEFAULT_BASE_URL;
|
|
18
|
+
const progressIntervalMs = options.progressIntervalMs ?? 10_000;
|
|
19
|
+
let client = options.client;
|
|
20
|
+
const getClient = () => {
|
|
21
|
+
if (!client) {
|
|
22
|
+
if (!env.RECEIVER_API_KEY)
|
|
23
|
+
throw new ReceiverError('RECEIVER_API_KEY is not set', 0, 'MISSING_API_KEY');
|
|
24
|
+
client = new ReceiverClient({ apiKey: env.RECEIVER_API_KEY, baseUrl: apiUrl, userAgent: USER_AGENT });
|
|
25
|
+
}
|
|
26
|
+
return client;
|
|
27
|
+
};
|
|
28
|
+
const run = async (handler) => {
|
|
29
|
+
try {
|
|
30
|
+
const result = await handler(getClient());
|
|
31
|
+
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const text = describeError(error, apiUrl, { keyFix: options.keyFix, networkFix: options.networkFix });
|
|
35
|
+
return { content: [{ type: 'text', text }], isError: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const server = new McpServer({ name: 'receiver-email', version: VERSION }, { instructions: INSTRUCTIONS });
|
|
39
|
+
server.registerTool('create_inbox', {
|
|
40
|
+
title: 'Create inbox',
|
|
41
|
+
description: 'Create a fresh email address that can receive real email. Call this before you type an email address into a ' +
|
|
42
|
+
'sign-up, login, password-reset or newsletter form, so you can read the verification code or link that gets sent. ' +
|
|
43
|
+
'Returns { address, since }. Keep `since` and pass it to wait_for_email: it makes sure you only get mail that ' +
|
|
44
|
+
'arrived after this inbox was created. Use a new inbox per task; addresses cost nothing until mail arrives.',
|
|
45
|
+
inputSchema: {
|
|
46
|
+
prefix: z
|
|
47
|
+
.string()
|
|
48
|
+
.min(1)
|
|
49
|
+
.max(40)
|
|
50
|
+
.regex(/^[A-Za-z0-9._+-]+$/, 'may only use letters, digits, ".", "_", "+" and "-"')
|
|
51
|
+
.optional()
|
|
52
|
+
.describe('Optional readable start of the address, e.g. "signup". Random characters are appended so addresses never collide.'),
|
|
53
|
+
},
|
|
54
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
55
|
+
}, args => run(c => createInbox(c, args)));
|
|
56
|
+
server.registerTool('wait_for_email', {
|
|
57
|
+
title: 'Wait for email',
|
|
58
|
+
description: 'Wait until an email arrives at an address and return it. Call this right after you trigger an email ' +
|
|
59
|
+
'(submitted a sign-up form, asked for a login code or a password reset). Pass the `since` from create_inbox; ' +
|
|
60
|
+
'only email received strictly after `since` is returned, so you never pick up an older message. To wait for ' +
|
|
61
|
+
'the next email to the same address, pass the previous email\'s receivedAt as `since`. ' +
|
|
62
|
+
'Set extract to "otp" to get the verification code, or "links" to get the URLs (magic links, confirm links). ' +
|
|
63
|
+
'Returns status "received" with the email (text cut at 4000 characters; get_email has the full body), or ' +
|
|
64
|
+
'status "timeout" when nothing arrived in time: then call wait_for_email again with the same `since`.',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
address: z.string().min(3).describe('The address to wait on, e.g. from create_inbox.'),
|
|
67
|
+
since: isoTimestamp
|
|
68
|
+
.optional()
|
|
69
|
+
.describe('ISO timestamp from create_inbox (or a previous email\'s receivedAt). Without it, mail from the last 60 seconds counts.'),
|
|
70
|
+
timeoutSeconds: z
|
|
71
|
+
.number()
|
|
72
|
+
.min(0)
|
|
73
|
+
.max(300)
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('How long to wait, in seconds (default 60, max 300).'),
|
|
76
|
+
extract: z
|
|
77
|
+
.enum(['otp', 'links', 'none'])
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('"otp": also return the verification code; "links": also return the links; "none" (default): just the email.'),
|
|
80
|
+
},
|
|
81
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
82
|
+
}, async (args, extra) => {
|
|
83
|
+
const timeoutSeconds = args.timeoutSeconds ?? 60;
|
|
84
|
+
const progressToken = extra._meta?.progressToken;
|
|
85
|
+
const started = Date.now();
|
|
86
|
+
// Progress notifications keep clients that reset their timeout on progress from giving up
|
|
87
|
+
const ticker = progressToken !== undefined
|
|
88
|
+
? setInterval(() => {
|
|
89
|
+
const elapsed = Math.min(timeoutSeconds, Math.round((Date.now() - started) / 1000));
|
|
90
|
+
extra
|
|
91
|
+
.sendNotification({
|
|
92
|
+
method: 'notifications/progress',
|
|
93
|
+
params: { progressToken, progress: elapsed, total: timeoutSeconds, message: `Waiting for email to ${args.address}` },
|
|
94
|
+
})
|
|
95
|
+
.catch(() => { });
|
|
96
|
+
}, progressIntervalMs)
|
|
97
|
+
: undefined;
|
|
98
|
+
try {
|
|
99
|
+
return await run(c => waitForEmail(c, { ...args, timeoutSeconds }, extra.signal));
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
if (ticker)
|
|
103
|
+
clearInterval(ticker);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
server.registerTool('list_emails', {
|
|
107
|
+
title: 'List emails',
|
|
108
|
+
description: 'List recent emails, newest first, optionally only those sent to one address. Use it to see what has already ' +
|
|
109
|
+
'arrived or to find an email id for get_email. It does not wait: use wait_for_email to wait for new mail.',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
address: z.string().min(3).optional().describe('Only emails sent to this address.'),
|
|
112
|
+
limit: z.number().int().min(1).max(50).optional().describe('How many emails (default 10, max 50).'),
|
|
113
|
+
},
|
|
114
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
115
|
+
}, args => run(c => listEmails(c, args)));
|
|
116
|
+
server.registerTool('get_email', {
|
|
117
|
+
title: 'Get email',
|
|
118
|
+
description: 'Get one email by id with its full body, all links and the attachment list. Use it after list_emails or ' +
|
|
119
|
+
'wait_for_email when you need the complete text, or the HTML with format "html".',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
id: z.string().min(1).describe('Email id from list_emails or wait_for_email.'),
|
|
122
|
+
format: z.enum(['text', 'html']).optional().describe('Body format: "text" (default) or "html".'),
|
|
123
|
+
},
|
|
124
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
125
|
+
}, args => run(c => getEmail(c, args)));
|
|
126
|
+
return server;
|
|
127
|
+
}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handlers. Each takes a Receiver client and validated arguments and
|
|
3
|
+
* returns the JSON the model sees. They throw on failure; `describeError`
|
|
4
|
+
* turns the error into a one-line fix.
|
|
5
|
+
*/
|
|
6
|
+
import { ReceiverTimeoutError, type ReceiverClient } from '@receiverdotemail/sdk';
|
|
7
|
+
/** The part of the SDK client the tools use (lets tests pass a fake). */
|
|
8
|
+
export type ToolClient = Pick<ReceiverClient, 'inboxes' | 'emails'>;
|
|
9
|
+
export declare const TEXT_LIMIT = 4000;
|
|
10
|
+
export declare const TIMEOUT_HINT = "No email yet. Call wait_for_email again with the same since.";
|
|
11
|
+
export interface CreateInboxArgs {
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createInbox(client: ToolClient, args: CreateInboxArgs): Promise<{
|
|
15
|
+
address: string;
|
|
16
|
+
since: string;
|
|
17
|
+
}>;
|
|
18
|
+
export interface WaitForEmailArgs {
|
|
19
|
+
address: string;
|
|
20
|
+
since?: string;
|
|
21
|
+
timeoutSeconds?: number;
|
|
22
|
+
extract?: 'otp' | 'links' | 'none';
|
|
23
|
+
}
|
|
24
|
+
export interface ReceivedResult {
|
|
25
|
+
status: 'received';
|
|
26
|
+
email: {
|
|
27
|
+
id: string;
|
|
28
|
+
from: string;
|
|
29
|
+
subject: string;
|
|
30
|
+
receivedAt: string;
|
|
31
|
+
text: string;
|
|
32
|
+
};
|
|
33
|
+
otp?: {
|
|
34
|
+
code: string;
|
|
35
|
+
candidates: string[];
|
|
36
|
+
} | null;
|
|
37
|
+
links?: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface TimeoutResult {
|
|
40
|
+
status: 'timeout';
|
|
41
|
+
since: string;
|
|
42
|
+
hint: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function waitForEmail(client: ToolClient, args: WaitForEmailArgs, signal?: AbortSignal): Promise<ReceivedResult | TimeoutResult>;
|
|
45
|
+
export interface ListEmailsArgs {
|
|
46
|
+
address?: string;
|
|
47
|
+
limit?: number;
|
|
48
|
+
}
|
|
49
|
+
export declare function listEmails(client: ToolClient, args: ListEmailsArgs): Promise<{
|
|
50
|
+
emails: {
|
|
51
|
+
id: string;
|
|
52
|
+
from: string;
|
|
53
|
+
to: string;
|
|
54
|
+
subject: string;
|
|
55
|
+
receivedAt: string;
|
|
56
|
+
}[];
|
|
57
|
+
}>;
|
|
58
|
+
export interface GetEmailArgs {
|
|
59
|
+
id: string;
|
|
60
|
+
format?: 'text' | 'html';
|
|
61
|
+
}
|
|
62
|
+
export declare function getEmail(client: ToolClient, args: GetEmailArgs): Promise<{
|
|
63
|
+
id: string;
|
|
64
|
+
from: string;
|
|
65
|
+
to: string;
|
|
66
|
+
subject: string;
|
|
67
|
+
receivedAt: string;
|
|
68
|
+
body: string;
|
|
69
|
+
links: string[];
|
|
70
|
+
attachments: {
|
|
71
|
+
filename: string;
|
|
72
|
+
contentType: string;
|
|
73
|
+
size: number;
|
|
74
|
+
}[];
|
|
75
|
+
}>;
|
|
76
|
+
export declare function isTimeout(error: unknown): error is ReceiverTimeoutError;
|
|
77
|
+
/** Advice that differs between the stdio and the remote server. */
|
|
78
|
+
export interface ErrorHints {
|
|
79
|
+
/** How to fix a missing or rejected key (default: set RECEIVER_API_KEY). */
|
|
80
|
+
keyFix?: string;
|
|
81
|
+
/** Replaces the network advice, which names the API URL and RECEIVER_API_URL. */
|
|
82
|
+
networkFix?: string;
|
|
83
|
+
}
|
|
84
|
+
/** One line saying what went wrong and how to fix it. */
|
|
85
|
+
export declare function describeError(error: unknown, apiUrl?: string, hints?: ErrorHints): string;
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handlers. Each takes a Receiver client and validated arguments and
|
|
3
|
+
* returns the JSON the model sees. They throw on failure; `describeError`
|
|
4
|
+
* turns the error into a one-line fix.
|
|
5
|
+
*/
|
|
6
|
+
import { AuthenticationError, NotFoundError, RateLimitError, ReceiverError, ReceiverTimeoutError, } from '@receiverdotemail/sdk';
|
|
7
|
+
export const TEXT_LIMIT = 4000;
|
|
8
|
+
export const TIMEOUT_HINT = 'No email yet. Call wait_for_email again with the same since.';
|
|
9
|
+
export async function createInbox(client, args) {
|
|
10
|
+
const inbox = await client.inboxes.create({ prefix: args.prefix });
|
|
11
|
+
return { address: inbox.address, since: inbox.createdAt };
|
|
12
|
+
}
|
|
13
|
+
export async function waitForEmail(client, args, signal) {
|
|
14
|
+
const { address, since, timeoutSeconds = 60, extract = 'none' } = args;
|
|
15
|
+
let email;
|
|
16
|
+
try {
|
|
17
|
+
email = await client.emails.waitFor({ recipient: address, since, timeout: timeoutSeconds, signal });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (isTimeout(error)) {
|
|
21
|
+
return { status: 'timeout', since: error.since || since || '', hint: TIMEOUT_HINT };
|
|
22
|
+
}
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
const result = {
|
|
26
|
+
status: 'received',
|
|
27
|
+
email: {
|
|
28
|
+
id: email.id,
|
|
29
|
+
from: email.sender,
|
|
30
|
+
subject: email.subject,
|
|
31
|
+
receivedAt: email.receivedAt,
|
|
32
|
+
text: (email.textBody ?? email.textBodyPreview ?? '').slice(0, TEXT_LIMIT),
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
if (extract === 'links')
|
|
36
|
+
result.links = email.links ?? [];
|
|
37
|
+
if (extract === 'otp') {
|
|
38
|
+
// The API extracts codes; ask it about this email (since is exclusive, so start 1 ms before it)
|
|
39
|
+
const justBefore = new Date(Date.parse(email.receivedAt) - 1).toISOString();
|
|
40
|
+
const otp = await client.emails.getOtp({ recipient: address, since: justBefore, signal });
|
|
41
|
+
const fromThisEmail = (otp?.candidates ?? []).filter(c => c.email.id === email.id);
|
|
42
|
+
result.otp = fromThisEmail.length
|
|
43
|
+
? { code: fromThisEmail[0].code, candidates: [...new Set(fromThisEmail.map(c => c.code))] }
|
|
44
|
+
: null;
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
export async function listEmails(client, args) {
|
|
49
|
+
const { emails } = await client.emails.list({ recipient: args.address, limit: args.limit ?? 10 });
|
|
50
|
+
return {
|
|
51
|
+
emails: emails.map(e => ({ id: e.id, from: e.sender, to: e.sendTo, subject: e.subject, receivedAt: e.receivedAt })),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export async function getEmail(client, args) {
|
|
55
|
+
const format = args.format ?? 'text';
|
|
56
|
+
const email = await client.emails.get(args.id);
|
|
57
|
+
// Large bodies live in storage: `get` then only carries a preview
|
|
58
|
+
const storedElsewhere = format === 'text' ? email.textBodyUri : email.htmlBodyUri;
|
|
59
|
+
const inline = format === 'text' ? email.textBody : email.htmlBody;
|
|
60
|
+
const body = storedElsewhere ? await client.emails.getContent(email.id, format) : inline ?? '';
|
|
61
|
+
return {
|
|
62
|
+
id: email.id,
|
|
63
|
+
from: email.sender,
|
|
64
|
+
to: email.sendTo,
|
|
65
|
+
subject: email.subject,
|
|
66
|
+
receivedAt: email.receivedAt,
|
|
67
|
+
body,
|
|
68
|
+
links: email.links ?? [],
|
|
69
|
+
attachments: (email.attachments ?? []).map(a => ({ filename: a.filename, contentType: a.contentType, size: a.size })),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function isTimeout(error) {
|
|
73
|
+
return error instanceof ReceiverTimeoutError || error?.name === 'ReceiverTimeoutError';
|
|
74
|
+
}
|
|
75
|
+
const KEY_FIX = 'Set RECEIVER_API_KEY to a project API key (recv_live_...) from the Receiver.email dashboard (Project > API keys) in this MCP server\'s env config.';
|
|
76
|
+
/** One line saying what went wrong and how to fix it. */
|
|
77
|
+
export function describeError(error, apiUrl, hints = {}) {
|
|
78
|
+
const keyFix = hints.keyFix ?? KEY_FIX;
|
|
79
|
+
if (!(error instanceof ReceiverError)) {
|
|
80
|
+
return `Unexpected error: ${error?.message ?? String(error)}`;
|
|
81
|
+
}
|
|
82
|
+
const message = error.message.replace(/\.$/, '');
|
|
83
|
+
if (error.code === 'MISSING_API_KEY')
|
|
84
|
+
return `RECEIVER_API_KEY is not set. ${keyFix}`;
|
|
85
|
+
if (error.code === 'PROJECT_ID_REQUIRED') {
|
|
86
|
+
return `The key is a dashboard session token, not a project API key. ${keyFix}`;
|
|
87
|
+
}
|
|
88
|
+
if (error instanceof AuthenticationError) {
|
|
89
|
+
return `The API key was rejected (${message}). ${keyFix}`;
|
|
90
|
+
}
|
|
91
|
+
if (error instanceof RateLimitError) {
|
|
92
|
+
const when = error.resetAt ? ` until ${error.resetAt.toISOString()}` : ' for a minute';
|
|
93
|
+
return `Rate limited by Receiver.email. Wait${when}, then retry.`;
|
|
94
|
+
}
|
|
95
|
+
if (error instanceof NotFoundError) {
|
|
96
|
+
return `${message}. Check the id: list_emails shows the ids of recent emails.`;
|
|
97
|
+
}
|
|
98
|
+
if (error.code === 'ABORTED')
|
|
99
|
+
return 'Cancelled.';
|
|
100
|
+
if (error.statusCode === 0 || error.statusCode === 408) {
|
|
101
|
+
if (hints.networkFix)
|
|
102
|
+
return `Could not reach the Receiver.email API (${message}). ${hints.networkFix}`;
|
|
103
|
+
const where = apiUrl ? ` at ${apiUrl}` : '';
|
|
104
|
+
return `Could not reach the Receiver.email API${where} (${message}). Check the network, or RECEIVER_API_URL if you set it.`;
|
|
105
|
+
}
|
|
106
|
+
if (error.statusCode === 403) {
|
|
107
|
+
return `${message}. The API key only works for its own project: use an address from create_inbox.`;
|
|
108
|
+
}
|
|
109
|
+
if (error.statusCode === 400) {
|
|
110
|
+
return `Invalid request: ${message}. Fix the arguments and call the tool again.`;
|
|
111
|
+
}
|
|
112
|
+
if (error.statusCode >= 500) {
|
|
113
|
+
return `Receiver.email API error ${error.statusCode} (${message}). Retry in a few seconds.`;
|
|
114
|
+
}
|
|
115
|
+
return `${message} (HTTP ${error.statusCode}${error.code ? `, ${error.code}` : ''}).`;
|
|
116
|
+
}
|
package/dist/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@receiverdotemail/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "MCP server for Receiver.email: give AI agents real inboxes to receive sign-up, OTP and magic-link emails",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"receiver-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/server.js",
|
|
10
|
+
"types": "dist/server.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build:sdk": "cd ../typescript-sdk && ([ -d node_modules ] || npm ci --no-audit --no-fund --loglevel=error) && npm run build",
|
|
19
|
+
"build": "npm run build:sdk && tsc -p tsconfig.build.json",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"start": "node dist/index.js",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"mcp-server",
|
|
29
|
+
"model-context-protocol",
|
|
30
|
+
"receiver.email",
|
|
31
|
+
"email",
|
|
32
|
+
"inbox",
|
|
33
|
+
"otp",
|
|
34
|
+
"2fa",
|
|
35
|
+
"magic-link",
|
|
36
|
+
"email-verification",
|
|
37
|
+
"ai-agents",
|
|
38
|
+
"agents",
|
|
39
|
+
"claude",
|
|
40
|
+
"cursor",
|
|
41
|
+
"testing"
|
|
42
|
+
],
|
|
43
|
+
"author": "Receiver.email",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
47
|
+
"@receiverdotemail/sdk": "^2.0.0",
|
|
48
|
+
"zod": "^4.1.12"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^20.0.0",
|
|
52
|
+
"typescript": "^5.0.0",
|
|
53
|
+
"vitest": "^3.2.4"
|
|
54
|
+
},
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/BUW91/mailingestion.git",
|
|
58
|
+
"directory": "packages/mcp-server"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://receiver.email/docs/mcp",
|
|
61
|
+
"bugs": {
|
|
62
|
+
"url": "https://github.com/BUW91/mailingestion/issues"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"mcpName": "email.receiver/mcp"
|
|
68
|
+
}
|