# mailsocket MCP server

> Allows AI agents to create test inboxes and automatically block until an OTP or magic link arrives for application testing.

- Repository: https://github.com/mailsocket/mailsocket-sdk
- Page: https://hostedmcp.org/servers/mailsocket/mailsocket-mcp
- Transport: stdio, remote
- Stars: 1
- License: MIT
- Latest version: 0.4.2

## Install

### Claude Code

```sh
claude mcp add --env MAILSOCKET_API_KEY=<YOUR_MAILSOCKET_API_KEY> mailsocket-mcp -- uvx mailsocket-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "mailsocket-mcp": {
      "command": "uvx",
      "args": [
        "mailsocket-mcp"
      ],
      "env": {
        "MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "mailsocket-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mailsocket-mcp"
      ],
      "env": {
        "MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
      }
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "mailsocket-mcp": {
      "command": "uvx",
      "args": [
        "mailsocket-mcp"
      ],
      "env": {
        "MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
      }
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.mailsocket-mcp]
command = "uvx"
args = ["mailsocket-mcp"]

[mcp_servers.mailsocket-mcp.env]
MAILSOCKET_API_KEY = "<YOUR_MAILSOCKET_API_KEY>"
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "mailsocket-mcp": {
      "command": "uvx",
      "args": [
        "mailsocket-mcp"
      ],
      "env": {
        "MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MAILSOCKET_API_KEY` | yes | yes | mailsocket API key (ms_live_...). Create one in the dashboard or via POST /api/v1/agents/register. |
| `MAILSOCKET_BASE_URL` | no | no | Override the API base URL. Defaults to https://dash.mailsocket.app/api/v1. |

## FAQ

### How can I test the wait loop without sending a real email?

You can use the `send_test_code` tool, which places a sample OTP email directly into the inbox without using a mail server.

### What happens if I reuse an existing inbox?

To ensure you catch a new code in a reused inbox, you should pass the `since` parameter explicitly using a timestamp or the ID of the last message seen.

### Is there a timeout for waiting for an OTP or link?

Yes, the requested deadline is locally clamped to 120s, while the remote server clamps it to 55s to avoid proxy timeouts.
