Permet aux agents IA de créer des boîtes de réception de test et de bloquer automatiquement l'exécution jusqu'à la réception d'un OTP ou d'un magic link pour les tests d'applications.
Aussi connu sous mailsocket/mailsocket-sdk, mailsocket-mcp
- Étoiles
- 1
- Outils
- —
- Téléchargements, 30 jours
- 861
- Dernière version
- 0.4.2
- Dernier commit
- 1 nov. 2026
- Licence
- MIT
Qu'est-ce que mailsocket MCP ?
mailsocket est un serveur MCP. Permet aux agents IA de créer des boîtes de réception de test et de bloquer automatiquement l'exécution jusqu'à la réception d'un OTP ou d'un magic link pour les tests d'applications.
Résumé généré à partir du README du projet
À propos du MCP server mailsocket
Mailsocket propose un MCP server conçu pour permettre aux agents de codage IA d'effectuer des tests d'application impliquant une vérification par e-mail. Il permet aux agents de créer des boîtes de réception de test dédiées et d'attendre automatiquement des éléments d'authentification spécifiques, tels que des mots de passe à usage unique (OTP) ou des magic links. Cela évite aux développeurs de devoir écrire une logique de polling personnalisée dans leurs prompts d'agent ou leurs bases de code.
Les utilisateurs peuvent exécuter ce serveur localement via stdio en utilisant uvx ou pip, ou se connecter à une version hébergée à distance via HTTP. Le serveur nécessite une clé API Mailsocket fournie via des variables d'environnement ou des en-têtes d'autorisation. Il inclut des outils spécialisés tels que create_inbox, wait_for_otp et wait_for_link pour gérer le cycle de vie des tests. Pour un débogage rapide, l'outil send_test_code permet aux agents d'injecter un OTP d'exemple directement dans une boîte de réception sans attendre qu'un véritable serveur de messagerie traite la requête.
Ce que vous pouvez faire avec
- 1Récupération automatisée d'OTPUn agent IA peut attendre l'arrivée d'un code de vérification dans une nouvelle boîte de réception et extraire la chaîne de caractères automatiquement.
- 2Extraction de magic linkLe serveur peut identifier et renvoyer un lien d'authentification spécifique provenant d'un e-mail entrant pour qu'un agent puisse l'utiliser.
- 3Test de boucles d'e-mailsLes développeurs peuvent vérifier la logique d'attente de leur agent en injectant immédiatement un faux code dans une boîte de réception.
- 4Gestion des boîtes de réceptionLes agents peuvent nettoyer leur environnement de test en supprimant les boîtes de réception temporaires une fois le test terminé.
Extrait du README du projet. Chaque cas d'utilisation est vérifié par rapport à une citation du document.
Comment installer mailsocket MCP
Formats vérifiés le 10 nov. 2026Installer mailsocket MCP dans Claude Code
$ claude mcp add --env MAILSOCKET_API_KEY=<YOUR_MAILSOCKET_API_KEY> mailsocket-mcp -- uvx mailsocket-mcpInstaller mailsocket MCP dans Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"mailsocket-mcp": {
"command": "uvx",
"args": [
"mailsocket-mcp"
],
"env": {
"MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
}
}
}
}Installer mailsocket MCP dans VS Code
.vscode/mcp.json
{
"servers": {
"mailsocket-mcp": {
"type": "stdio",
"command": "uvx",
"args": [
"mailsocket-mcp"
],
"env": {
"MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
}
}
}
}Installer mailsocket MCP dans Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"mailsocket-mcp": {
"command": "uvx",
"args": [
"mailsocket-mcp"
],
"env": {
"MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
}
}
}
}Installer mailsocket MCP dans Codex
~/.codex/config.toml
[mcp_servers.mailsocket-mcp] command = "uvx" args = ["mailsocket-mcp"] [mcp_servers.mailsocket-mcp.env] MAILSOCKET_API_KEY = "<YOUR_MAILSOCKET_API_KEY>"
Installer mailsocket MCP dans Gemini CLI
~/.gemini/settings.json
{
"mcpServers": {
"mailsocket-mcp": {
"command": "uvx",
"args": [
"mailsocket-mcp"
],
"env": {
"MAILSOCKET_API_KEY": "<YOUR_MAILSOCKET_API_KEY>"
}
}
}
}Configuration
MAILSOCKET_API_KEYRequisSecretmailsocket API key (ms_live_...). Create one in the dashboard or via POST /api/v1/agents/register.
MAILSOCKET_BASE_URLOverride the API base URL. Defaults to https://dash.mailsocket.app/api/v1.
| Nom | Description | Type |
|---|---|---|
| MAILSOCKET_API_KEY | mailsocket API key (ms_live_...). Create one in the dashboard or via POST /api/v1/agents/register. | RequisSecret |
| MAILSOCKET_BASE_URL | Override the API base URL. Defaults to https://dash.mailsocket.app/api/v1. |
Vérifications automatisées
Exécuté le 12 nov. 2026Rapport complet →A passé nos vérifications automatisées. Il ne s'agit pas d'un audit de sécurité : lisez le code et donnez au serveur l'accès le plus restreint dont il a besoin. Fonctionnement des vérifications
- Dépôt source lié et accessibleRéussi
- Licence open source (OSI)Réussi
- Commit ou version publiée au cours de l'année écouléeRéussi
- Nom du package non proche d'un package populaireRéussi
- L'endpoint distant utilise HTTPSRéussi
- Les outils destructifs sont étiquetésNon vérifié
- Aucune instruction cachée destinée au modèleRéussi
- Aucun avis critique dans le paquet ni ses dépendancesRéussi
README
Voir sur GitHubmailsocket — MCP server
An MCP server that exposes mailsocket to AI coding agents as native tools, so an agent can create a per-test inbox and block on the OTP or magic link without writing any polling code. For testing apps you own or are authorized to test. Not for creating accounts on services you don't control.
It wraps the Python SDK — no second HTTP client, no re-implemented polling.
What it does
| Tool | What the agent gets |
|---|---|
create_inbox(label?) |
a fresh inbox id + address |
wait_for_otp(inbox_id, timeout?=60, min_confidence?=0, since?) |
the headline — blocks (bounded: requested deadline clamped to 120s locally, 55s on the remote server) and returns the OTP string + confidence + subject/from/id/received_at. Default since omitted: only messages arriving after this call are matched. |
wait_for_link(inbox_id, timeout?=60, since?) |
the extracted magic link (returned, not followed) + subject/from/id/received_at. Default since omitted: only messages arriving after this call are matched. |
list_inboxes(limit?, cursor?) |
one page of inboxes owned by the key (server default page size 25) + next_cursor/has_more |
list_messages(inbox_id, has_otp?, subject_contains?, sender?, limit?, cursor?) |
one page of messages, optionally filtered (server default page size 25) + next_cursor/has_more |
get_latest(inbox_id) |
the newest message, without blocking |
send_test_code(inbox_id) |
puts one sample OTP email straight into the inbox (no mail server) and returns its message_id + sent_at, so you can check the wait loop without real email. 5 per inbox / 20 per account per hour. |
delete_inbox(inbox_id) |
remove an inbox when done |
Errors from the SDK (AuthError / NotFound / RateLimited / WaitTimeout)
are turned into clean MCP tool errors — no stack traces, and the API key is
never echoed back.
Reusing an inbox
create_inbox needs no since — a fresh inbox only ever has new messages.
By default, wait_for_otp/wait_for_link omit since entirely, so the
server matches only messages arriving AFTER the call (the request start
time). But if you reuse an existing inbox (e.g. to request a second
OTP/link), pass since explicitly: otherwise a call with no since will
correctly ignore anything already sitting in the inbox, which is right for
most reuse, but if you actually WANT to catch a code that already arrived
before you called the tool, pass either the time right before you triggered
the new email (ISO8601 or unix seconds), or the id of the last message you
saw (msg_..., meaning "only messages after that one") — both tools return
id/received_at on the matched message so you can chain since=<id> into
the next call on that same inbox.
Trying the loop without real email
send_test_code does not go through the mail server, so the code is
already in the inbox when the tool returns. Take a cutoff first: the id
from get_latest (or since=0 if the inbox is empty), or the current time.
Then call send_test_code(inbox_id), then
wait_for_otp(inbox_id, since=<that cutoff>). Without since the wait only
sees mail that arrives during the wait, so it would miss the test code.
Requirements
- Python 3.10+
- A mailsocket API key — from the dashboard or
POST /api/v1/agents/register.
Install
No install needed with uv:
uvx mailsocket-mcp
Or install with pip:
pip install mailsocket-mcp
mailsocket-mcp
Either way, it reads MAILSOCKET_API_KEY (and optional
MAILSOCKET_BASE_URL) from the environment. If the key is missing it exits
with a clear message and status 2; the key is never logged.
Register with an MCP client
Claude Desktop / Cursor
Add this to your client's MCP config file — claude_desktop_config.json for
Claude Desktop, ~/.cursor/mcp.json for Cursor:
{
"mcpServers": {
"mailsocket": {
"command": "uvx",
"args": ["mailsocket-mcp"],
"env": {
"MAILSOCKET_API_KEY": "ms_live_..."
}
}
}
}
Claude Code CLI
claude mcp add mailsocket -e MAILSOCKET_API_KEY=ms_live_... -- uvx mailsocket-mcp
Any other MCP-compatible client works the same way: point it at the
mailsocket-mcp executable (or uvx mailsocket-mcp) over stdio and pass the
key through the environment.
Remote server (no install)
The same tools are hosted at https://mcp.mailsocket.app/mcp over
Streamable HTTP. Send your key on every request as a header:
Authorization: Bearer ms_live_.... Never put the key in the URL; a
?api_key= request is rejected.
Claude Code CLI
claude mcp add --transport http mailsocket https://mcp.mailsocket.app/mcp \
--header "Authorization: Bearer ms_live_..."
Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"mailsocket": {
"url": "https://mcp.mailsocket.app/mcp",
"headers": { "Authorization": "Bearer ms_live_..." }
}
}
}
VS Code (.vscode/mcp.json)
{
"servers": {
"mailsocket": {
"type": "http",
"url": "https://mcp.mailsocket.app/mcp",
"headers": { "Authorization": "Bearer ms_live_..." }
}
}
}
Any client that can set a custom HTTP header works the same way (OpenAI Agents SDK, the n8n MCP Client node, your own code).
Things to know:
- Claude.ai, Claude Desktop connectors and Smithery need OAuth, which is planned but not available yet. Until then, use the local stdio server above in those clients (Claude Desktop), or use a header-capable client.
- On the remote server,
wait_for_otp/wait_for_linkwait at most 55s per call, which keeps each response under proxy timeouts. On a timeout, call the tool again. - The server is stateless: no session to keep, and every request is authenticated on its own. It has no key of its own and only acts with yours, under your normal API rate limits.
- Self-hosting:
mailsocket-mcp-httpruns the same server (seemailsocket_mcp/remote.pyfor its env vars).
Env vars
| Variable | Required | Description |
|---|---|---|
MAILSOCKET_API_KEY |
yes (secret) | Your mailsocket API key (ms_live_...). |
MAILSOCKET_BASE_URL |
no | Override the API base URL. Defaults to https://dash.mailsocket.app/api/v1. |
Develop
pip install -e ".[dev]"
pytest
Tests make no external or live-API requests. The SDK client is faked, and the
remote-transport tests talk to a local fake upstream on 127.0.0.1.
Changelog
- 0.4.2 — wording only: server and tool descriptions and README say "test inbox for apps you own or are authorized to test". Tool names and behaviour unchanged.
- 0.4.1 — requires
mailsocket>=0.3.1:wait_for_otp/wait_for_linkcalled withoutsinceno longer miss a message that lands between the SDK's internal long-poll calls (each follow-up call sends the cutoff the server reported inMailsocket-Wait-Since). No tool signature changes. - 0.4.0 — new
send_test_code(inbox_id)tool (stdio and the hosted remote server, under the same per-key caps as the other non-wait tools): puts one sample OTP email into your own inbox without going through the mail server. Requiresmailsocket>=0.3.0(Client.send_test_code). - 0.3.0 — BEHAVIOUR CHANGE (via
mailsocket>=0.2.0):wait_for_otp/wait_for_linknow omitsinceby default instead of forwarding0("any message already in the inbox"). The old default could return a STALE OTP/link already sitting in a reused inbox; the new default matches only messages arriving after the call. Passsince=0explicitly to keep the old behaviour. Hosted server (mcp.mailsocket.app, deployed from the repo, no new PyPI release): per-key concurrent waits raised 3 → 10 (= the Pro plan cap; the API still enforces each plan's own cap) and the shared wait pool 16 → 32, following the backend's raised wait capacity (global 64). - 0.2.3 —
wait_for_otp/wait_for_linkaccept an optionalsince(ISO8601, unix seconds or a message id) so a reused inbox returns the NEW code; results include the messageidandreceived_at. - 0.2.2 — depends on
mailsocket>=0.1.3(stricter_segid validation in the underlying Python SDK).
Questions sur mailsocket MCP
Comment ajouter mailsocket MCP à Claude Code ?
Exécutez claude mcp add --env MAILSOCKET_API_KEY=<YOUR_MAILSOCKET_API_KEY> mailsocket-mcp -- uvx mailsocket-mcp dans votre terminal. Ajoutez --scope user pour le rendre disponible dans tous les projets.
Comment ajouter mailsocket MCP à Cursor ?
Ouvrez ~/.cursor/mcp.json et ajoutez le serveur sous mcpServers, avec la configuration Cursor indiquée dans la section d'installation ci-dessus.
Comment puis-je tester la boucle d'attente sans envoyer un véritable e-mail ?
Vous pouvez utiliser l'outil send_test_code, qui place un e-mail OTP d'exemple directement dans la boîte de réception sans utiliser de serveur de messagerie.
Que se passe-t-il si je réutilise une boîte de réception existante ?
Pour garantir la réception d'un nouveau code dans une boîte réutilisée, vous devez passer explicitement le paramètre since en utilisant un horodatage ou l'ID du dernier message reçu.
Existe-t-il un délai d'attente (timeout) pour l'OTP ou le lien ?
Oui, l'échéance demandée est limitée localement à 120s, tandis que le serveur distant la limite à 55s pour éviter les timeouts de proxy.