Agent quickstart
Paste one prompt into Claude Code, Cursor, Codex or OpenCode and the agent signs itself up through auth.md, gets a sandbox inbox and asks you to claim it.
You do not have to create an account first. An agent can register itself with MachineMail, get a working email address immediately, and then ask you to claim it. This page shows the prompt that does that and what happens at each step.
The prompt
The Copy agent prompt button on machinemail.dev copies this prompt. Paste it into any coding agent that can make HTTP requests or connect to an MCP server, such as Claude Code, Cursor, Codex or OpenCode.
The last instruction matters. Anyone can email your agent, so the prompt tells it to treat mail as data unless the trust report says the sender is authenticated. See Using trust in agents.
What the agent does
Reads auth.md
GET /auth.mdis a Markdown document written for agents. It describes the discovery metadata, the registration types this deployment accepts, the claim ceremony and the token exchange. An agent that gets a401from/v0can also find it on its own: the response carriesWWW-Authenticate: Bearer resource_metadata="https://api.machinemail.dev/.well-known/oauth-protected-resource". A401from the MCP server points at the MCP server’s own metadata,https://mcp.machinemail.dev/.well-known/oauth-protected-resource/mcp, which names the same authorization server.Registers anonymously
The response includes a service-signed
identity_assertion, a one-timeclaim_token, the scopes it has before and after a claim, and aninboxobject with the sandbox address. Thenameis shown to you when you claim the agent.Exchanges the assertion for an access token
The
access_tokenlasts an hour. There is no refresh token: the agent exchanges the same assertion again until the assertion expires. The token works as a Bearer credential on bothhttps://api.machinemail.dev/v0andhttps://mcp.machinemail.dev/mcp.Uses its sandbox inbox
Before it is claimed, the agent can only reach its own sandbox inbox: read messages and threads, send, reply and manage drafts, and change labels. The sandbox has limits:
Limit Value Inboxes One, on the shared machinemail.devdomainLifetime The inbox expires 24 hours after registration unless claimed. New mail pushes the expiry out. Sending By default at most 10 outbound messages to 10 different recipients per 24 hours, 5 per message Starts the claim ceremony
The response contains a six-digit
user_codeand averification_uri. Theemailis optional. When the agent sends it, only the signed-in user with that address can complete the claim. The agent shows you the code and the link, then pollsPOST /oauth2/tokenwith the claim grant until you finish.
Claim the agent
Open the link the agent gives you, or go to machinemail.dev/claim. Sign in, or sign up with a magic link if you do not have an account yet, and enter the six-digit code. Codes expire after 10 minutes. If yours has expired, ask the agent to start the claim again.
When you confirm:
- The registration is bound to your organization.
- The sandbox inbox moves into your organization’s default pod and stops expiring. Its messages, threads and drafts move with it.
- The agent’s poll returns a new access token with the full set of scopes. Its pre-claim tokens stop working.
- The sandbox limits no longer apply.
You can list and revoke the agents registered to your organization with GET /v0/agent-registrations and DELETE /v0/agent-registrations/{agent_id}, using an organization-scoped key. Claiming agents has the details.
Note
If you would rather give the agent a key yourself, skip registration. Create an inbox-scoped key with a narrow permission list (see API keys) and configure your MCP client with it, as in MCP clients.
Waiting for mail
Once connected over MCP, the agent can call wait_for_message. It blocks for up to 60 seconds and returns the next message that arrives in the inbox, in an agent-safe form that includes the trust report. Quarantined, spam and unauthenticated mail does not wake it. This is the easiest way to receive a verification code right after the agent triggers one. See MCP tools.