monacloud-mcp 0.5.0 → 0.7.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.
Files changed (3) hide show
  1. package/STATUS.md +1 -1
  2. package/dist/mail.js +78 -0
  3. package/package.json +27 -2
package/STATUS.md CHANGED
@@ -10,7 +10,7 @@ Updated: 2026-09-14 (Asia/Ho_Chi_Minh)
10
10
  - Mô tả tool, instructions, resource, prompt, README và agent guide ghi Base **beta** = thay Supabase, chung account/ví MONA Cloud, khớp app deploy.
11
11
  - Package, binary và MCP handshake đã bump minor lên `0.5.0`; stdio có 145 tool.
12
12
  - `npm test` offline: **52 tests, 52 pass, 0 fail, 0 skip**, gồm TypeScript build và HTTP mock Base create/poll/sandbox/list/get/delete/credentials/aliases.
13
- - Không publish, không gọi API production. **Chờ Base provision-live để publish.**
13
+ - **PUBLISHED npm `monacloud-mcp@0.5.0`** (2026-09-14, tag latest, acc rxathu9999) sau khi Base đạt provision-live + verified (base up ~4.5 phút, supabase-js chạy). MCP trỏ prod `https://api.monacloud.vn` (base_* live: /api/bases 401, capabilities có key `base`). Mon chốt "public mona base đi".
14
14
 
15
15
  CODEX DONE
16
16
 
package/dist/mail.js CHANGED
@@ -22,7 +22,10 @@ const empty = z.object({}).strict();
22
22
  const events = z.enum([
23
23
  'email.sent', 'email.delivered', 'email.deferred', 'email.bounced',
24
24
  'email.complained', 'email.suppressed', 'email.failed', 'domain.verified',
25
+ 'inbox.message',
25
26
  ]);
27
+ const agentId = z.string().trim().min(1).max(64).regex(/^[a-z0-9](?:[a-z0-9._-]{0,62}[a-z0-9])?$/, 'agent_id chỉ nhận chữ thường, số, dấu chấm, gạch dưới hoặc gạch nối.');
28
+ const inboxMatch = z.string().trim().min(1).max(200).describe('otp để lấy mã, hoặc regex khớp nội dung/subject/from.');
26
29
  const status = z.enum(['queued', 'sent', 'delivered', 'deferred', 'bounced', 'complained', 'suppressed', 'failed', 'sandbox']);
27
30
  function idempotencyHeaders(key) {
28
31
  return { 'Idempotency-Key': key || `mcp-mail-${randomUUID()}` };
@@ -180,4 +183,79 @@ export function registerMailTools(server, clients, config) {
180
183
  description: 'Khi đánh giá khả năng giao thư, đọc tỷ lệ delivered và bounce theo thời gian. / Use to review email delivery statistics.',
181
184
  inputSchema: z.object({ from: dateOrTimestamp.optional(), to: dateOrTimestamp.optional() }).strict().refine((value) => !value.from || !value.to || Date.parse(value.from) <= Date.parse(value.to), 'Thời điểm from phải trước hoặc bằng to.'),
182
185
  }, (query) => runTool(() => clients.mail('/v1/stats', { query })));
186
+ // ── Hộp thư AI agent (nhận + đọc + trả lời) ─────────────────────────────
187
+ server.registerTool('mail_inbox_create', {
188
+ title: 'Tạo hộp thư agent',
189
+ description: 'Khi cần một địa chỉ email cho agent trực (đọc thư, trả lời), tạo hộp. Bỏ domain để dùng miền agent.monamail.vn (nhận ngay); truyền domain đã verify để có địa chỉ brand. / Use to create an inbox an AI agent can read and reply from.',
190
+ inputSchema: z.object({ agent_id: agentId, domain: domain.optional() }).strict(),
191
+ }, ({ agent_id, domain }) => runTool(() => clients.mail('/v1/inboxes', {
192
+ method: 'POST', body: domain ? { agent_id, domain } : { agent_id },
193
+ })));
194
+ server.registerTool('mail_inbox_list', {
195
+ title: 'Danh sách hộp agent',
196
+ description: 'Khi cần biết agent đang trực những hộp nào, liệt kê hộp còn hoạt động. / Use to list active agent inboxes.',
197
+ inputSchema: empty,
198
+ }, () => runTool(() => clients.mail('/v1/inboxes')));
199
+ server.registerTool('mail_inbox_get', {
200
+ title: 'Xem hộp agent',
201
+ description: 'Khi cần địa chỉ và trạng thái của một hộp, đọc chi tiết. / Use to read one inbox.',
202
+ inputSchema: z.object({ inbox_id: id }).strict(),
203
+ }, ({ inbox_id }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}`)));
204
+ server.registerTool('mail_inbox_delete', {
205
+ title: 'Xóa hộp agent',
206
+ description: 'Khi hộp không còn dùng, xóa mềm; thư cũ còn đọc tới hết retention. / Use to soft-delete an inbox.',
207
+ inputSchema: z.object({ inbox_id: id }).strict(),
208
+ }, ({ inbox_id }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}`, { method: 'DELETE' })));
209
+ server.registerTool('mail_inbox_messages', {
210
+ title: 'Thư trong hộp agent',
211
+ description: 'Khi trực hộp, liệt kê thư nhận; lọc seen=false để lấy thư chưa xử lý, phân trang bằng cursor. / Use to list messages an agent needs to handle.',
212
+ inputSchema: z.object({
213
+ inbox_id: id,
214
+ seen: z.boolean().optional().describe('false = chỉ thư chưa đọc.'),
215
+ since: timestamp.optional(),
216
+ limit: z.number().int().min(1).max(100).default(50),
217
+ cursor: z.string().min(1).max(255).optional(),
218
+ }).strict(),
219
+ }, ({ inbox_id, seen, since, limit, cursor }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}/messages`, {
220
+ query: { limit, cursor, since, ...(seen === undefined ? {} : { seen: String(seen) }) },
221
+ })));
222
+ server.registerTool('mail_inbox_message', {
223
+ title: 'Đọc thư trong hộp',
224
+ description: 'Khi cần nội dung đầy đủ, header và đính kèm của một thư, đọc chi tiết; lần đọc đầu đánh dấu đã xem. / Use to read a full inbox message before replying.',
225
+ inputSchema: z.object({ inbox_id: id, message_id: id }).strict(),
226
+ }, ({ inbox_id, message_id }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}/messages/${encodeURIComponent(message_id)}`)));
227
+ server.registerTool('mail_inbox_reply', {
228
+ title: 'Trả lời thư trong hộp',
229
+ description: 'Khi agent trả lời khách, gửi đúng thread (In-Reply-To, References) từ địa chỉ hộp; cần text hoặc html. Việc khó rút lại (hứa giá, chuyển tiền) thì báo người, đừng tự gửi. / Use to reply to an inbox message in-thread.',
230
+ inputSchema: z.object({ inbox_id: id, message_id: id, text: z.string().min(1).optional(), html: z.string().min(1).optional() })
231
+ .strict().refine((value) => value.text || value.html, 'Cần text hoặc html để trả lời.'),
232
+ }, ({ inbox_id, message_id, ...body }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}/messages/${encodeURIComponent(message_id)}/reply`, { method: 'POST', body })));
233
+ server.registerTool('mail_inbox_wait', {
234
+ title: 'Chờ thư trong hộp',
235
+ description: 'Khi cần chờ thư tới (ví dụ mã OTP hoặc thư khớp mẫu), chờ tối đa timeout giây; có thư khớp trả full nội dung + extracted_code, hết giờ trả 204. Gọi lại nếu cần chờ lâu hơn. / Use to wait for an OTP or a matching message.',
236
+ inputSchema: z.object({ inbox_id: id, match: inboxMatch, timeout: z.number().int().min(0).max(300).default(120) }).strict(),
237
+ }, ({ inbox_id, match, timeout }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}/wait`, {
238
+ query: { match, timeout },
239
+ })));
240
+ server.registerTool('mail_inbox_update', {
241
+ title: 'Cấu hình hộp agent',
242
+ description: 'Khi cần đặt cách hộp xử lý thư: mode redirect (tự forward thư về email chủ) | store (chỉ lưu) | ai (để AI trực), địa chỉ forward_to, chat Telegram nhận báo, hoặc bật/tắt hộp. / Use to configure an inbox: redirect-forward email, Telegram chat, mode, active.',
243
+ inputSchema: z.object({
244
+ inbox_id: id,
245
+ forward_to: email.optional().describe('Email chủ nhận bản forward khi mode=redirect.'),
246
+ mode: z.enum(['redirect', 'store', 'ai']).optional().describe('redirect=tự forward về forward_to · store=chỉ lưu · ai=để AI trực.'),
247
+ notify_telegram: z.string().max(64).optional().describe('chat_id Telegram nhận ping khi có thư.'),
248
+ active: z.boolean().optional(),
249
+ }).strict().refine((v) => Object.keys(v).length > 1, 'Cần ít nhất một trường để cập nhật.'),
250
+ }, ({ inbox_id, ...body }) => runTool(() => clients.mail(`/v1/inboxes/${encodeURIComponent(inbox_id)}`, { method: 'PATCH', body })));
251
+ server.registerTool('mail_inbox_batch', {
252
+ title: 'Tạo nhiều hộp agent',
253
+ description: 'Khi cần tạo nhiều địa chỉ một lần (ví dụ mỗi nhân viên một hộp), tạo hàng loạt trong quota gói; lỗi từng hộp không hủy cả batch. / Use to create many inboxes at once.',
254
+ inputSchema: z.object({
255
+ agent_ids: z.array(agentId).min(1).max(100),
256
+ domain: domain.optional(),
257
+ forward_to: email.optional(),
258
+ mode: z.enum(['redirect', 'store', 'ai']).optional(),
259
+ }).strict(),
260
+ }, (body) => runTool(() => clients.mail('/v1/inboxes/batch', { method: 'POST', body })));
183
261
  }
package/package.json CHANGED
@@ -1,8 +1,33 @@
1
1
  {
2
2
  "name": "monacloud-mcp",
3
- "version": "0.5.0",
4
- "description": "Unified MCP server for MONA Cloud, MONA Pay and MONA Agent.",
3
+ "version": "0.7.0",
4
+ "description": "MCP server for MONA Cloud \u2014 deploy apps (Vercel alternative), Supabase-compatible Postgres/Auth/Storage bases (Supabase alternative), VND wallet, MONA Pay & Mail \u2014 for AI agents (Claude, Cursor, Codex) in Vietnam.",
5
5
  "license": "MIT",
6
+ "homepage": "https://monacloud.vn",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/themonagroup/monacloud-mcp.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/themonagroup/monacloud-mcp/issues"
13
+ },
14
+ "keywords": [
15
+ "mcp",
16
+ "model-context-protocol",
17
+ "mona-cloud",
18
+ "mona-base",
19
+ "supabase-alternative",
20
+ "vercel-alternative",
21
+ "vietnam",
22
+ "vnd",
23
+ "ai-agent",
24
+ "claude",
25
+ "cursor",
26
+ "codex",
27
+ "postgres",
28
+ "deploy",
29
+ "vibecoder"
30
+ ],
6
31
  "type": "module",
7
32
  "bin": {
8
33
  "monacloud-mcp": "dist/index.js"