# TempMail OTP MCP (`rexreus/tempmail-otp-mcp`) Actor

TempMail & OTP Extractor MCP server for AI Agents. Instantly generate temporary emails, auto-poll inboxes, and extract verification codes or activation links. Perfect for registration automation.

- **URL**: https://apify.com/rexreus/tempmail-otp-mcp.md
- **Developed by:** [REXREUS D.O](https://apify.com/rexreus) (community)
- **Categories:** Automation, Agents, MCP servers
- **Stats:** 1 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $50.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 📧 TempMail OTP MCP - Apify Actor

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-FF671B?style=for-the-badge&logo=apify&logoColor=white)](https://apify.com)
[![MCP](https://img.shields.io/badge/Protocol-MCP-blue?style=for-the-badge)](https://modelcontextprotocol.io)

**Automate account registrations seamlessly.** This Actor provides a high-performance temporary email service and automatic OTP extraction via the Model Context Protocol (MCP).


<p>
<img src="https://i.imgur.com/JHdOKD1.jpeg" align="center">
</p>


### 🚀 Overview

AI Agents struggle with checking emails during sign-up workflows. This MCP server simplifies the process into a few direct tool calls.

- **Auto-Polling**: The server handles polling the inbox, so your agent gets the OTP immediately when it arrives.
- **Smart Extraction**: Built-in logic to identify verification codes and links.
- **Customizable**: Optional tool prefixing supported via Actor configuration.

---

### 🛠️ MCP Tools

| Tool Name | Description | Key Inputs |
|-----------|-------------|------------|
| `create_email` | Generates a new temporary email | `provider` (optional), `username` (optional) |
| `list_inbox` | Lists messages in the inbox | `token`, `provider` (optional) |
| `wait_for_otp` | **Magic Tool**: Waits and extracts the code | `token`, `pollingTimeoutSecs` (optional), `pollingIntervalSecs` (optional), `customRegex` (optional), `provider` (optional) |

---

### 🔌 Integration Guide & Agent Skills

#### 🤖 Configuration for AI Agents (Roo Code, Claude, etc.)
Add this to your MCP settings. This command runs the Actor on Apify's infrastructure and tunnels the MCP protocol through Stdio.

```json
{
  "mcpServers": {
    "tempmail-otp": {
      "command": "npx",
      "args": [
        "-y",
        "apify-cli",
        "actor:run",
        "rexreus/tempmail-otp-mcp",
        "--pipe",
        "-i",
        "{\"toolPrefix\": \"\", \"defaultProvider\": \"mail.tm\"}"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"
      }
    }
  }
}
````

*Note: The `--pipe` flag is essential for MCP to ensure stdio communication works correctly.*

***

### 🧠 Agent Instructions: How to perform "OTP Flow"

If you are an AI Agent, read this carefully to understand your mission:

#### 1. Identify available tools

Upon connection, you will see `create_email`, `list_inbox`, and `wait_for_otp`.

#### 2. Execution Workflow

1. **Action**: Call `create_email`.
2. **Analysis**: Extract the `address` and `token` from the response.
   - *Example Response*: `{"address": "xyz@mail.tm", "token": "SECRET_TOKEN"}`
3. **External Task**: Use the `address` to register on the website you are currently browsing.
4. **Action**: Immediately call `wait_for_otp` with the `token` you saved.
   - Set `pollingTimeoutSecs` to `300` for slow websites.
5. **Logic**:
   - If the tool returns an `otp`, submit it on the website.
   - If the tool returns `otp: null` but gives you `full_text`, **read the body** and find the verification code yourself.

#### 3. Creating multiple accounts

You can call `create_email` multiple times in a single session. Each call generates a unique identity. Always keep track of which `token` belongs to which `address`.

#### 📝 Step-by-Step Example: Registering on Facebook

Here is a practical simulation of how an AI Agent handles a registration flow on Facebook using this MCP:

1. **Initialize Session**:
   The agent calls `create_email` to generate a temporary inbox:
   ```json
   // Tool Call: create_email
   {}
   ```
   *Response*:
   ```json
   {
     "address": "john.doe.7f3a@wshu.net",
     "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9..."
   }
   ```

2. **Navigate & Fill Form**:
   The agent navigates to the registration page (e.g., `https://www.facebook.com/r.php`) and inputs the registration details:
   - First name: `John`
   - Last name: `Doe`
   - Mobile number or email: `john.doe.7f3a@wshu.net`
   - Password: `SecurePassword123!`
   - Date of Birth & Gender
     The agent clicks the **Sign Up** button.

3. **Await Verification Code**:
   Facebook prompts for a 5-digit security code sent to the email.
   The agent immediately triggers `wait_for_otp`:
   ```json
   // Tool Call: wait_for_otp
   {
     "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9..."
   }
   ```
   *Response*:
   ```json
   {
     "subject": "12345 is your Facebook confirmation code",
     "otp": "12345",
     "strategy": "numeric"
   }
   ```

4. **Complete Registration**:
   The agent extracts the OTP code `12345` from the response, inputs it into the Facebook confirmation form, and submits it to successfully create the account.

#### 📋 Example Prompts for Users to Trigger the Agent

If you are a user, you can copy-paste these prompts directly into your AI Agent (equipped with this MCP) to execute automated sign-up tasks:

- **General Sign-Up**:
  > *"Register a new account on \[WEBSITE\_URL] using the tempmail-otp MCP server. Generate a temporary email, sign up on the page, poll the inbox for the OTP, submit it, and tell me the login credentials."*
- **Specific Provider Sign-Up**:
  > *"Create a new profile on \[WEBSITE\_URL]. Call the create\_email tool using the 'tempmail.lol' provider, then fill out the sign-up form, wait for the verification code using wait\_for\_otp, and complete the registration."*
- **Verification Link Flow (e.g., GitHub/Discord)**:
  > *"Go to \[WEBSITE\_URL] and start the registration process. Create a temp email address, use it to register, and wait for the verification email. If the server extracts a confirmation URL instead of a numeric code, follow that link to verify the account."*
- **Multiple Registrations**:
  > *"Create 3 mock user accounts on \[WEBSITE\_URL] using different temporary email addresses. Track the generated email addresses and tokens, perform registration for each, and output a table containing the created emails and their registration status."*

***

### 🛠️ Detailed Tool Reference

#### `create_email`

- **Goal**: Create a new session.
- **Inputs**: `provider` (mail.tm/tempmail.lol), `username` (optional).
- **Output**: Returns `address` and `token`.

#### `wait_for_otp`

- **Goal**: Polling and parsing.
- **Inputs**: `token` (required), `pollingTimeoutSecs`, `customRegex`.
- **Output**: Returns `otp`, `subject`, and `full_text` (fallback).

***

### ⚙️ Actor Configuration

#### Input Parameters (`INPUT_SCHEMA.json`)

- `toolPrefix`: Optional string to prepend to tool names (e.g., `tm_` -> `tm_create_email`).
- `defaultProvider`: Default email provider to use (`mail.tm` or `tempmail.lol`).
- `pollingTimeoutSecs`: Default timeout in seconds to wait for OTP email (default: `300`).

#### Output Schema (Dataset)

For platform auditing, successful tool calls will also push a record to the Apify dataset:

```json
{
  "action": "wait_for_otp",
  "status": "success",
  "provider": "mail.tm",
  "email": "bot@mail.tm",
  "otp": "123456",
  "timestamp": "2024-03-20T10:00:00Z"
}
```

*Note on irregular OTPs:* If the extraction logic cannot identify the OTP structure, the tool will return `otp: null` along with the full email body (`full_text`). AI Agents will easily extract it semantically from the text.

***

### 🛡️ Privacy

- Email accounts are ephemeral and provided by third-party temp mail services.
- Always use for temporary registrations only.

***

*Built for the next generation of full AI automation.*

# Actor input Schema

## `toolPrefix` (type: `string`):

Prefix for MCP tools (e.g. 'tm\_').

## `defaultProvider` (type: `string`):

Default email provider to use.

## `pollingTimeoutSecs` (type: `integer`):

How long to wait for OTP email.

## Actor input object example

```json
{
  "toolPrefix": "",
  "defaultProvider": "mail.tm",
  "pollingTimeoutSecs": 300
}
```

# Actor output Schema

## `event` (type: `string`):

Action performed (e.g. create\_email, otp\_extracted).

## `address` (type: `string`):

No description

## `otp` (type: `string`):

No description

## `success` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("rexreus/tempmail-otp-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("rexreus/tempmail-otp-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call rexreus/tempmail-otp-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=rexreus/tempmail-otp-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "TempMail OTP MCP",
        "description": "TempMail & OTP Extractor MCP server for AI Agents. Instantly generate temporary emails, auto-poll inboxes, and extract verification codes or activation links. Perfect for registration automation.",
        "version": "0.0",
        "x-build-id": "2QqrnPkGZ6vJOTDDb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/rexreus~tempmail-otp-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-rexreus-tempmail-otp-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/rexreus~tempmail-otp-mcp/runs": {
            "post": {
                "operationId": "runs-sync-rexreus-tempmail-otp-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/rexreus~tempmail-otp-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-rexreus-tempmail-otp-mcp",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "toolPrefix": {
                        "title": "Tool Prefix",
                        "type": "string",
                        "description": "Prefix for MCP tools (e.g. 'tm_').",
                        "default": ""
                    },
                    "defaultProvider": {
                        "title": "Default Provider",
                        "enum": [
                            "mail.tm",
                            "tempmail.lol"
                        ],
                        "type": "string",
                        "description": "Default email provider to use.",
                        "default": "mail.tm"
                    },
                    "pollingTimeoutSecs": {
                        "title": "Polling Timeout (Seconds)",
                        "type": "integer",
                        "description": "How long to wait for OTP email.",
                        "default": 300
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
