{"_id":"@arvoretech/tempmail-mcp","_rev":"8-dbb9087701039de8bf6b4ef38b914afa","name":"@arvoretech/tempmail-mcp","dist-tags":{"latest":"2.2.0"},"versions":{"2.0.0":{"name":"@arvoretech/tempmail-mcp","version":"2.0.0","keywords":["mcp","tempmail","temporary-email","disposable-email","cloudflare","d1","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/tempmail-mcp@2.0.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"tempmail-mcp":"dist/index.js"},"dist":{"shasum":"2cba96aa8e867efbec259966427295113fe5daae","tarball":"https://registry.npmjs.org/@arvoretech/tempmail-mcp/-/tempmail-mcp-2.0.0.tgz","fileCount":28,"integrity":"sha512-e4logVuW0Ix3eWi4TafCFdy8ptIUbmHJR5pBHmdXx4LCzAnjB1Y9frffubRS6l3mm+s+ll/IjDtZdzAVoYAQuA==","signatures":[{"sig":"MEUCIHDaxAs/oxWHTX/PpRMZH2Ms4DK8l7QEUEsSHfIJQAhdAiEAqFJRDrP9ehLaEmGCrv0Mr17bzOf1BRnywKjq5B43AL4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":131436},"main":"dist/index.js","type":"module","gitHead":"436e3346c9568d2f98afe962f2055de96ff18f1a","scripts":{"dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsc","start":"node dist/index.js","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest run --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/tempmail"},"_npmVersion":"10.8.2","description":"Temporary Email MCP Server powered by Cloudflare D1 + Email Workers","directories":{},"_nodeVersion":"20.20.0","dependencies":{"zod":"^3.22.4","mailparser":"^3.7.0","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/mailparser":"^3.4.4"},"_npmOperationalInternal":{"tmp":"tmp/tempmail-mcp_2.0.0_1770935553046_0.8686766956521801","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@arvoretech/tempmail-mcp","version":"2.1.0","keywords":["mcp","tempmail","temporary-email","disposable-email","cloudflare","d1","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/tempmail-mcp@2.1.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"tempmail-mcp":"dist/index.js"},"dist":{"shasum":"64f46ddcd872cf4a56cc97d37f69ec1c48aebb11","tarball":"https://registry.npmjs.org/@arvoretech/tempmail-mcp/-/tempmail-mcp-2.1.0.tgz","fileCount":31,"integrity":"sha512-y61H9AgkmNGeIqU3rN4CRYKEV2uTBBJG/hqxmIMCT4bKEUkGNZ1pRn0JP9paGm2hzwOUc6fA4dTRbIl9ueAAIw==","signatures":[{"sig":"MEUCIQCJ3bIgchL6Dd/aVbElAmUpb8X/ldMwav3/CBLVRr4lhgIgD9TuZ7bLTSCsJZYCON0l4ysEZcQPgO8aL99IwTgan60=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":188087},"main":"dist/index.js","type":"module","gitHead":"a1721d21277bd1ab38f0418ed8fcec8c36606808","scripts":{"ui":"node dist/index.js ui","dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsc","start":"node dist/index.js","dev:ui":"tsx src/index.ts ui","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest run --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/tempmail"},"_npmVersion":"10.8.2","description":"Temporary Email MCP Server powered by Cloudflare D1 + Email Workers","directories":{},"_nodeVersion":"20.20.0","dependencies":{"zod":"^3.22.4","mailparser":"^3.7.0","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/mailparser":"^3.4.4"},"_npmOperationalInternal":{"tmp":"tmp/tempmail-mcp_2.1.0_1771018706583_0.952829658241976","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@arvoretech/tempmail-mcp","version":"2.2.0","keywords":["mcp","tempmail","temporary-email","disposable-email","cloudflare","d1","llm","ai","arvore"],"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/tempmail-mcp@2.2.0","maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"}],"homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"bin":{"tempmail-mcp":"dist/index.js"},"dist":{"shasum":"91c4c4f6a8bbdd693e14a3f84ca7f3c6a3a0d306","tarball":"https://registry.npmjs.org/@arvoretech/tempmail-mcp/-/tempmail-mcp-2.2.0.tgz","fileCount":31,"integrity":"sha512-osNi6PRVGgpqJX5EJiS74RuWK4DISh/wc8apcIc5yesI5f49PPH0cWTstGun3IoCX1j2fgVZNMzuOgH9PMNZPg==","signatures":[{"sig":"MEUCIQC3oTEsXfzpB80niB0/ZrmHiOVHRAgJZA5h2+j4MHL4aAIgEW9cFuO/m9t5MTl+20/m6KsnsBX+8G14uU90g34d3Y8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":191131},"main":"dist/index.js","type":"module","gitHead":"d1be6e39360d3776b2b9c706b80531ff25c794c2","scripts":{"ui":"node dist/index.js ui","dev":"tsx src/index.ts","lint":"eslint src/**/*.ts","test":"vitest run","build":"tsc","start":"node dist/index.js","dev:ui":"tsx src/index.ts ui","lint:fix":"eslint src/**/*.ts --fix","test:cov":"vitest run --coverage"},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/tempmail"},"_npmVersion":"10.8.2","description":"Temporary Email MCP Server powered by Cloudflare D1 + Email Workers","directories":{},"_nodeVersion":"20.20.0","dependencies":{"zod":"^3.22.4","mailparser":"^3.7.0","@modelcontextprotocol/sdk":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/mailparser":"^3.4.4"},"_npmOperationalInternal":{"tmp":"tmp/tempmail-mcp_2.2.0_1771019193644_0.49040906824037034","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-02-12T22:32:32.908Z","modified":"2026-06-16T21:13:25.361Z","2.0.0":"2026-02-12T22:32:33.255Z","2.1.0":"2026-02-13T21:38:26.747Z","2.2.0":"2026-02-13T21:46:33.788Z"},"bugs":{"url":"https://github.com/arvoreeducacao/arvore-mcp-servers/issues"},"author":{"name":"Arvore"},"license":"MIT","homepage":"https://github.com/arvoreeducacao/arvore-mcp-servers#readme","keywords":["mcp","tempmail","temporary-email","disposable-email","cloudflare","d1","llm","ai","arvore"],"repository":{"url":"git+https://github.com/arvoreeducacao/arvore-mcp-servers.git","type":"git","directory":"packages/tempmail"},"description":"Temporary Email MCP Server powered by Cloudflare D1 + Email Workers","maintainers":[{"email":"joao.barros@arvore.com.br","name":"joao.barros.arvore"},{"email":"rafasouza@protonmail.com","name":"rafsouza"},{"email":"pedro.adas@gmail.com","name":"pedro.adas"},{"email":"guilhermebscontact@gmail.com","name":"guilhermebs"},{"email":"ricardorbxx1@gmail.com","name":"ricardoraposorfox"},{"email":"jvgcunha2002@gmail.com","name":"jott4"},{"email":"vitor.piovezan@arvore.com.br","name":"vitor.piovezan"}],"readme":"# TempMail MCP Server\n\n[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=tempmail-mcp&registry=https://npm.pkg.github.com&packageName=@arvoretech/tempmail-mcp)\n\nA Model Context Protocol (MCP) server for temporary/disposable email management, powered by **Cloudflare D1** (edge SQLite) and **Email Workers**. Zero infrastructure to manage — everything runs on Cloudflare.\n\n## Features\n\n- 📧 **Create Accounts**: Generate temporary email addresses on your domain\n- 📬 **Read Emails**: Full access to email content (text + HTML)\n- 🗑️ **Manage**: Delete accounts and messages\n- ☁️ **Cloudflare D1**: Serverless SQLite storage on the edge\n- 📮 **Email Workers**: Cloudflare handles MX, SMTP, and email routing\n- 📡 **MCP Protocol**: Communication via stdio transport\n- 🛠️ **TypeScript**: Fully typed with Zod validation\n\n## Architecture\n\n```\nGmail / any sender\n  → Cloudflare MX (your domain)\n    → Email Worker (parses + stores in D1)\n\nMCP Server (local, Cursor/Claude)\n  → Cloudflare D1 REST API (reads/writes accounts & messages)\n```\n\n- **`D1DatabaseClient`**: Cloudflare D1 REST API client for all database operations\n- **`TempMailMCPTools`**: MCP tool implementations for account/message management\n- **`TempMailMCPServer`**: Main MCP server with stdio transport\n\n## Setup\n\n### 1. Create a D1 Database\n\nIn the Cloudflare Dashboard → **Workers & Pages** → **D1** → **Create database**.\n\nOr via Wrangler CLI:\n\n```bash\nnpx wrangler d1 create tempmail\n```\n\nSave the `database_id` from the output.\n\n### 2. Run the Schema Migration\n\nIn the Cloudflare Dashboard → D1 → your database → **Console**, run:\n\n```sql\nCREATE TABLE IF NOT EXISTS accounts (\n  id TEXT PRIMARY KEY,\n  address TEXT NOT NULL UNIQUE,\n  username TEXT NOT NULL,\n  domain TEXT NOT NULL,\n  is_active INTEGER NOT NULL DEFAULT 1,\n  created_at TEXT NOT NULL DEFAULT (datetime('now'))\n);\n\nCREATE TABLE IF NOT EXISTS messages (\n  id TEXT PRIMARY KEY,\n  account_id TEXT NOT NULL,\n  from_address TEXT NOT NULL DEFAULT '',\n  from_name TEXT NOT NULL DEFAULT '',\n  to_address TEXT NOT NULL DEFAULT '',\n  subject TEXT NOT NULL DEFAULT '',\n  text TEXT NOT NULL DEFAULT '',\n  html TEXT NOT NULL DEFAULT '',\n  raw TEXT NOT NULL DEFAULT '',\n  has_attachments INTEGER NOT NULL DEFAULT 0,\n  size INTEGER NOT NULL DEFAULT 0,\n  seen INTEGER NOT NULL DEFAULT 0,\n  created_at TEXT NOT NULL DEFAULT (datetime('now')),\n  FOREIGN KEY (account_id) REFERENCES accounts(id) ON DELETE CASCADE\n);\n\nCREATE INDEX IF NOT EXISTS idx_messages_account_id ON messages(account_id);\nCREATE INDEX IF NOT EXISTS idx_accounts_address ON accounts(address);\n```\n\n### 3. Enable Email Routing\n\nIn Cloudflare Dashboard → your domain → **Email** → **Email Routing** → Enable. Cloudflare will automatically configure the MX records.\n\n### 4. Create the Email Worker\n\nGo to **Email Routing** → **Email Workers** → create a new worker with this code:\n\n```javascript\nfunction extractBody(raw) {\n  const headerEnd = raw.indexOf(\"\\r\\n\\r\\n\");\n  if (headerEnd === -1) return { text: \"\", html: \"\" };\n\n  const headers = raw.substring(0, headerEnd);\n  const ctMatch = headers.match(/^Content-Type:\\s*([^\\r\\n]+(?:\\r\\n\\s+[^\\r\\n]+)*)/im);\n  if (!ctMatch) return { text: raw.substring(headerEnd + 4).trim(), html: \"\" };\n\n  const contentType = ctMatch[1].replace(/\\r\\n\\s+/g, \" \");\n\n  if (contentType.includes(\"text/plain\")) {\n    return { text: raw.substring(headerEnd + 4).trim(), html: \"\" };\n  }\n\n  if (contentType.includes(\"text/html\")) {\n    return { text: \"\", html: raw.substring(headerEnd + 4).trim() };\n  }\n\n  const boundaryMatch = contentType.match(/boundary=\"?([^\";\\s]+)\"?/);\n  if (!boundaryMatch) return { text: \"\", html: \"\" };\n\n  const boundary = boundaryMatch[1];\n  const parts = raw.split(\"--\" + boundary);\n  let text = \"\";\n  let html = \"\";\n\n  for (const part of parts) {\n    const partHeaderEnd = part.indexOf(\"\\r\\n\\r\\n\");\n    if (partHeaderEnd === -1) continue;\n\n    const partHeaders = part.substring(0, partHeaderEnd);\n    const partBody = part.substring(partHeaderEnd + 4).replace(/--\\s*$/, \"\").trim();\n\n    if (partHeaders.match(/Content-Type:\\s*text\\/plain/i) && !text) {\n      text = partBody;\n    }\n    if (partHeaders.match(/Content-Type:\\s*text\\/html/i) && !html) {\n      html = partBody;\n    }\n  }\n\n  return { text, html };\n}\n\nexport default {\n  async email(message, env, ctx) {\n    const to = message.to.toLowerCase();\n\n    const account = await env.D1.prepare(\n      \"SELECT id FROM accounts WHERE address = ? AND is_active = 1\"\n    ).bind(to).first();\n\n    if (!account) {\n      message.setReject(\"Mailbox not found\");\n      return;\n    }\n\n    const rawEmail = new Response(message.raw);\n    const raw = await rawEmail.text();\n\n    const subject = message.headers.get(\"subject\") || \"(no subject)\";\n    const fromHeader = message.headers.get(\"from\") || message.from;\n\n    let fromName = \"\";\n    const nameMatch = fromHeader.match(/^\"?([^\"<]*)\"?\\s*<?/);\n    if (nameMatch && nameMatch[1]) {\n      fromName = nameMatch[1].trim();\n    }\n\n    const { text, html } = extractBody(raw);\n    const id = crypto.randomUUID();\n\n    await env.D1.prepare(\n      \"INSERT INTO messages (id, account_id, from_address, from_name, to_address, subject, text, html, raw, size) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\"\n    ).bind(\n      id,\n      account.id,\n      message.from,\n      fromName,\n      to,\n      subject,\n      text,\n      html,\n      raw,\n      message.rawSize\n    ).run();\n  }\n}\n```\n\n### 5. Bind D1 to the Worker\n\nIn the Worker settings → **Bindings** → add a **D1 Database** binding:\n- Variable name: `D1`\n- Database: select your tempmail database\n\n### 6. Create a Catch-All Routing Rule\n\nIn **Email Routing** → **Routing rules** → enable **Catch-all** → route to your Email Worker.\n\n### 7. Create a Cloudflare API Token\n\nGo to [Cloudflare API Tokens](https://dash.cloudflare.com/profile/api-tokens) → **Create Token** → **Custom token**:\n- **Permissions**: Account → D1 → Edit\n- **Account Resources**: your account\n\nSave the token.\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `CLOUDFLARE_ACCOUNT_ID` | Yes | Your Cloudflare account ID |\n| `CLOUDFLARE_D1_DATABASE_ID` | Yes | D1 database ID |\n| `CLOUDFLARE_API_TOKEN` | Yes | Cloudflare API token with D1 permissions |\n| `TEMPMAIL_DOMAIN` | No | Email domain (default: `tempmail.arvore.com.br`) |\n\n### Cursor MCP Configuration\n\nAdd to your Cursor MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"tempmail\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@arvoretech/tempmail-mcp\"],\n      \"env\": {\n        \"CLOUDFLARE_ACCOUNT_ID\": \"your-account-id\",\n        \"CLOUDFLARE_D1_DATABASE_ID\": \"your-database-id\",\n        \"CLOUDFLARE_API_TOKEN\": \"your-api-token\",\n        \"TEMPMAIL_DOMAIN\": \"yourdomain.com\"\n      }\n    }\n  }\n}\n```\n\n## Available MCP Tools\n\n### `get_domains`\n\nGet the list of available email domains.\n\n### `create_email_account`\n\nCreate a new temporary email account.\n\n**Parameters:**\n- `username` (string): Username for the email (e.g. \"testuser\" → testuser@domain.com)\n\n### `list_email_accounts`\n\nList all active temporary email accounts.\n\n**Parameters:**\n- `page` (number, optional): Page number (default: 1)\n- `limit` (number, optional): Results per page (default: 20, max: 100)\n\n### `delete_email_account`\n\nDelete a temporary email account and all its messages.\n\n**Parameters:**\n- `accountId` (string): The account ID to delete\n\n### `get_inbox`\n\nList messages received by an email account.\n\n**Parameters:**\n- `accountId` (string): The account ID\n- `page` (number, optional): Page number (default: 1)\n- `limit` (number, optional): Results per page (default: 20, max: 100)\n\n### `read_email`\n\nRead the full content of an email message.\n\n**Parameters:**\n- `messageId` (string): The message ID\n\n### `delete_email`\n\nDelete a specific email message.\n\n**Parameters:**\n- `messageId` (string): The message ID to delete\n\n## Web UI\n\nThe package includes a built-in web interface (Gmail-like) for browsing emails in the browser.\n\n### Using the published package\n\n```bash\nnpx @arvoretech/tempmail-mcp ui\n```\n\nMake sure the required environment variables are set, or create a `.env` file in the current directory:\n\n```env\nCLOUDFLARE_ACCOUNT_ID=your-account-id\nCLOUDFLARE_D1_DATABASE_ID=your-database-id\nCLOUDFLARE_API_TOKEN=your-api-token\nTEMPMAIL_DOMAIN=yourdomain.com\n```\n\n### Options\n\n```bash\nnpx @arvoretech/tempmail-mcp ui                  # default port 3847, auto-opens browser\nnpx @arvoretech/tempmail-mcp ui --port 8080       # custom port\nnpx @arvoretech/tempmail-mcp ui --no-open         # don't auto-open browser\n```\n\n### Programmatic usage\n\n```typescript\nimport { WebUIServer } from \"@arvoretech/tempmail-mcp\";\n\nconst ui = new WebUIServer({ port: 3847, open: true });\nawait ui.start();\n```\n\n## Development\n\n```bash\npnpm install\npnpm test\npnpm lint\npnpm build\npnpm dev:ui    # run web UI in dev mode (tsx)\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}