Skip to main content
MCP clients authorize against Langmail with standard OAuth 2.1 discovery — no pre-shared client IDs, no API keys. This page documents the flow as implemented, for anyone debugging a connection or building their own MCP client. The parties involved:

The flow

1

The first request gets a 401

A request to https://mcp.langmail.me/mcp without a bearer token returns 401 with a pointer to the resource metadata:
Response header
2

Discover the protected resource

Request
Response
3

Discover the authorization server

Request
Response
The issuer is the MCP server’s own URL, while the functional endpoints live on auth.langmail.me. Clients only need to follow the endpoints in this document.
4

Register as a client

The registration endpoint accepts dynamic client registration (RFC 7591) without prior credentials, rate-limited per IP. MCP clients typically register as a public client with a loopback redirect:
Registration request
Redirect URIs are matched exactly at authorization time, so register the precise URI you will use, including the port.
5

The user signs in and consents

The client opens the authorization URL with a PKCE challenge:
A user without a session is sent to the Langmail login page first (Google sign-in is optional). Then a consent screen shows what the named client is asking for; approving redirects back to the client’s redirect_uri with an authorization code. Every dynamically registered client goes through consent — there are no silent grants.
6

Exchange the code for tokens

Request
The response contains an access_token and, because offline_access was granted, a refresh_token. Public clients send no client secret; the PKCE verifier binds the exchange to the client that started the flow.
7

Call the MCP server

Request header
The MCP server validates the token against the authorization server’s userinfo endpoint and resolves the caller to their @langmail.me mailbox. Every tool call then operates on that mailbox — tokens are per-user, and a token can never reach another user’s mail.

Tokens

  • Access tokens are opaque — treat them as bearer credentials, not as JWTs to inspect.
  • Refresh tokens are issued when offline_access is granted, so clients can stay connected without re-prompting you to sign in.
  • Ending access: remove the server from your MCP client — it discards its tokens, and without the refresh token access lapses. There is no dashboard for reviewing individual grants yet.

Requirements on the user

The signed-in account must belong to a Langmail user with an active @langmail.me mailbox. Accounts without one are rejected at the MCP server with 401 invalid_token — sign up at app.langmail.me first.
Authorization gives a client access to the tools the server exposes for your mailbox — currently read access to mail and read-write access to calendars. See the tool reference for the exact surface.