For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
contact@agentmail.ccDiscord
DocumentationAPI ReferenceKnowledge BaseChangelog
DocumentationAPI ReferenceKnowledge BaseChangelog
  • Get Started
    • Welcome
    • Introduction
    • Quickstart
  • Core Concepts
    • Inboxes
    • Messages
    • Threads
    • Drafts
    • Labels
    • Lists
    • Attachments
    • Pods
    • Permissions
  • Integrations
    • Agent Onboarding
    • Skills
    • MCP
    • CLI
    • Google ADK
    • OpenClaw
    • Replit
    • x402
    • MPP
    • LiveKit
    • Sim.ai
  • Guides
    • Sending & Receiving Email
    • IMAP & SMTP
    • Multi-Tenancy
  • Webhooks
    • Overview
    • Events
    • Setup Guide
    • Verifying Webhooks
  • WebSockets
    • Overview
    • Quickstart
  • Best Practices
    • Email Deliverability
    • Idempotency
  • Examples
    • Github Repo Agent
    • Auto Reply Agent
    • Smart Labeling Agent
    • Sales Agent (WebSocket)
    • Live AgentMail Examples
  • Resources
    • FAQ
    • Talon Reply Extraction
    • Community
    • Support
LogoLogo
contact@agentmail.ccDiscord
On this page
  • Getting started
  • Base URLs
  • Prerequisites
  • Install dependencies
  • Quickstart
  • How it works
  • Resources
Integrations

MPP

Pay-per-use AgentMail with Stripe’s Machine Payments Protocol

Was this page helpful?
Edit this page
Previous

Integrate LiveKit Agents

Build a voice assistant with real time email capabilities.
Next
Built with

Getting started

MPP (Machine Payments Protocol) is Stripe’s open protocol that enables machine-to-machine payments. By integrating MPP with AgentMail, your agents can pay for API usage directly without managing API keys or subscriptions.

Base URLs

To authenticate with MPP instead of an API key, you must use the MPP-specific base URLs below. These replace the default AgentMail base URLs and route requests through the MPP payment layer.

ProtocolURL
HTTPmpp.api.agentmail.to
WebSocketmpp.ws.agentmail.to

Prerequisites

  • A crypto wallet with funds (EVM-compatible wallet)
  • Node.js installed

Install dependencies

$npm install agentmail mppx viem

Quickstart

1import { privateKeyToAccount } from "viem/accounts";
2import { Mppx, tempo } from "mppx/client";
3
4import { AgentMailClient } from "agentmail";
5
6
7// setup MPP client
8
9const PRIVATE_KEY = "0x...";
10
11const account = privateKeyToAccount(PRIVATE_KEY);
12
13export const mppx = Mppx.create({ methods: [tempo({ account })] });
14
15
16// setup AgentMail client
17
18export const client = new AgentMailClient({ mppx });
19
20
21// create inbox
22
23const inboxRes = await client.inboxes.create({
24 username: `mpp-${Date.now()}`,
25});
26console.log("Created inbox: ", inboxRes.inboxId);
27
28
29// subscribe to inbox
30
31const socket = await client.websockets.connect();
32console.log("Connected to websocket");
33
34socket.on("message", async (event) => {
35 if (event.type === "subscribed") {
36 console.log("Subscribed to", event.inboxIds);
37 } else if (event.type === "event" && event.eventType === "message.received") {
38 console.log("Received message from: ", event.message.from);
39 }
40});
41
42socket.sendSubscribe({
43 type: "subscribe",
44 inboxIds: [inboxRes.inboxId],
45});

How it works

When you pass an mppx client to AgentMailClient, the SDK automatically handles payment negotiation for each API request. The MPP client signs payments using your wallet, enabling your agent to pay per request seamlessly.

This means your agent can use the full AgentMail API (inboxes, messages, threads, attachments) without needing a traditional API key. Payment happens per-request via Stripe’s Machine Payments Protocol.

Resources

  • MPP documentation
  • AgentMail API reference
  • WebSockets overview