Skip to main content

mailsocket — MCP server

An MCP server that exposes mailsocket to AI coding agents as native tools, so an agent can create a throwaway inbox and block on the OTP or magic link without writing any polling code. 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) the headline — blocks (bounded, clamped to 120s) and returns the OTP string + confidence + subject/from
wait_for_link(inbox_id, timeout?=60) the extracted magic link (returned, not followed)
list_inboxes() every inbox owned by the key
list_messages(inbox_id, has_otp?, subject_contains?, from?) messages, optionally filtered
get_latest(inbox_id) the newest message, without blocking
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.

Install

# from this directory, with the repo's backend venv (or your own):
/Users/tuki/MailBridge/backend/.venv/bin/python -m pip install mcp          # official MCP SDK
/Users/tuki/MailBridge/backend/.venv/bin/python -m pip install -e ../python # local mailsocket SDK
/Users/tuki/MailBridge/backend/.venv/bin/python -m pip install -e .         # this server (mailsocket-mcp)

Run

export MAILSOCKET_API_KEY="ms_live_..."
# optional: export MAILSOCKET_BASE_URL="https://dash.mailsocket.app/api/v1"
mailsocket-mcp

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

The server is a plain stdio MCP server, so it works with any MCP-compatible client. Point your client's mcpServers config at the mailsocket-mcp executable and pass the key through the environment:

{
  "mcpServers": {
    "mailsocket": {
      "command": "mailsocket-mcp",
      "args": [],
      "env": {
        "MAILSOCKET_API_KEY": "ms_live_...",
        "MAILSOCKET_BASE_URL": "https://dash.mailsocket.app/api/v1"
      }
    }
  }
}

If mailsocket-mcp is not on the client's PATH, use the venv's full path for command, e.g. /Users/tuki/MailBridge/backend/.venv/bin/mailsocket-mcp.

Develop

cd sdks/mcp
/Users/tuki/MailBridge/backend/.venv/bin/python -m pytest -q

Tests are fully offline — the SDK client is faked, so nothing touches the live API.

Release files for mailsocket-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailsocket-mcp 0.1.0
File Size Uploaded
mailsocket_mcp-0.1.0.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mailsocket-mcp 0.1.0
File Interpreter ABI Platform
mailsocket_mcp-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / mailsocket_mcp-0.1.0.tar.gz

Download URL mailsocket_mcp-0.1.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e729a97796c251f207712acc5c6ed8da6112bdde3e38004dad203c59a79af311
BLAKE2b-256 checksum
How to use checksums
21850691c4942bd847e969bb1d50f83baf48b68c224d3dc8cf014e7872ca0738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / mailsocket_mcp-0.1.0-py3-none-any.whl

Download URL mailsocket_mcp-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dc659ec19aeb35449cc90eb79cfa8ce02a87a2c59169d8e6785046d950dfbff
BLAKE2b-256 checksum
How to use checksums
c2dfe5c561c618c53cd1f0663bf3f59afdb76209dbf43453097dcdfa1dd5559e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page