Skip to main content

relaymcp-client

Official Python client for RelayMCP, a programmable email inbox API for end-to-end tests, browser automation, agent workflows, and backend services.

Install

python -m pip install relaymcp-client

The package has no runtime dependencies and supports Python 3.9+.

Quick start

import os
from relaymcp import RelayApiError, RelayClient

relay = RelayClient(os.environ["RELAY_API_KEY"])
inbox = relay.create_inbox(name="checkout-tests")["inbox"]
print(inbox["address"])

messages = relay.list_messages(inbox["id"], limit=20)
for message in messages["messages"]:
    print(message["subject"], message["sender"])
artifacts = relay.extract_auth(inbox_id, message_id)["auth"]

if artifacts["otp"]["found"] and not artifacts["otp"]["ambiguous"]:
    verification_code = artifacts["otp"]["code"]

verification_url = artifacts["links"][0] if artifacts["links"] else None

Webhooks

created = relay.create_webhook(
    "https://example.test/hooks/relay",
    ["inbox.message.received"],
)

# Store this secret securely. It is returned only during creation.
print(created["id"])
print(relay.list_webhook_deliveries(created["id"]))

Webhook requests include x-relay-signature: t=<unix>,v1=<hmac>. Verify the HMAC against <unix>.<raw-json-body> using the secret returned by create_webhook.

Real-time events

def handle_event(event):
    if event["type"] == "inbox.message.received":
        print("New message", event["data"])

relay.stream_events(handle_event, after=last_event_id)

Error handling

try:
    relay.list_inboxes()
except RelayApiError as error:
    print(error.status, error.body.get("code"), str(error))

RelayApiError contains the HTTP status and structured API response. Network and transport failures raise RelayError.

Self-hosted API

relay = RelayClient(
    os.environ["RELAY_API_KEY"],
    base_url="https://relay.example.com/api/v1",
    timeout=30,
)

Security

Keep API keys in environment variables or a secret manager. Do not commit them, log message bodies, or expose them to untrusted browser code. Use the smallest API key scopes required by each service.

License

MIT. See LICENSE.

Metadata

Release files for relaymcp-client 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 relaymcp-client 0.1.0
File Size Uploaded Provenance Actions
relaymcp_client-0.1.0.tar.gz 5.5 kB Without provenance Details for relaymcp_client-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for relaymcp-client 0.1.0
File Interpreter ABI Platform Actions
relaymcp_client-0.1.0-py3-none-any.whl Python 3 none any Details for relaymcp_client-0.1.0-py3-none-any.whl

Total release size: 11.0 kB

Release files / relaymcp_client-0.1.0.tar.gz

Download URL relaymcp_client-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f3138ab7aecfbcc59e711887045e36e0a4e2bf5558cbf319b3bf0336296d34a1
BLAKE2b-256 checksum
How to use checksums
91d84dd2de84893703a033346ea021af37f6fa30df2b849f270d11074baec1f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

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

Download URL relaymcp_client-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28e2c847dbe72d86a608c46f39324c903dbaca54752d6e439eed1eb0b9ba0a01
BLAKE2b-256 checksum
How to use checksums
d796e9dd3acbe05cc37e37b7e9ee4270209e63192ddd28ff414b84eeb9bf18db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for relaymcp-client 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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