Claude Integration
email-connector is a remote MCP server that integrates with Claude through OAuth 2.0 with PKCE. This page explains exactly what happens when you connect your email to Claude.What Claude Expects
Claude’s MCP connector system requires:| Requirement | email-connector |
|---|---|
| Transport | Streamable HTTP (POST /mcp) |
| Auth | OAuth 2.0 with PKCE (S256) |
| Callback URL | https://claude.ai/api/mcp/auth_callback |
| Token type | Bearer |
| Server metadata | RFC 8414 at /oauth/meta |
| CORS | Must allow claude.ai and claude.com |
Connection Flow
When you add the connector in Claude, here’s exactly what happens:PKCE (Proof Key for Code Exchange)
PKCE prevents authorization code interception attacks. The flow works like this:- Claude generates a random
code_verifier(43–128 chars) - Claude computes
code_challenge = BASE64URL(SHA256(code_verifier)) - Claude sends
code_challenge+code_challenge_method=S256to/oauth/authorize - email-connector stores the challenge alongside the pending auth
- At token exchange, Claude sends the original
code_verifier - email-connector recomputes the hash and verifies it matches the stored challenge
Redirect URIs
email-connector accepts these callback URLs:| Client | Redirect URI |
|---|---|
| Claude.ai | https://claude.ai/api/mcp/auth_callback |
| Claude.com | https://claude.com/api/mcp/auth_callback |
| Claude Code | http://localhost:6274/oauth/callback |
| MCP Inspector | http://localhost:6274/oauth/callback/debug |
Token Lifecycle
| Property | Value |
|---|---|
| Token type | Bearer |
| Expiry | 30 days |
| Scope | email:read email:write |
| Revocation | POST /oauth/revoke |
MCP Session Management
After auth, Claude communicates via MCP Streamable HTTP:POST /mcp— Initialize a new session or send messages to an existing one. ReturnsMcp-Session-Idheader on first request.GET /mcp— SSE upgrade for streaming responses within an active session.DELETE /mcp— Close a session and free server resources.
CORS Configuration
email-connector allows requests from:https://claude.aihttps://claude.comhttps://email-connector.fly.devhttps://connectmyemail.com
Mcp-Session-Id header is exposed in CORS responses so Claude can maintain session continuity.
Server Metadata
Claude discovers endpoints via RFC 8414 OAuth Server Metadata atGET /oauth/meta:
Security Headers
All responses include:Strict-Transport-Security: max-age=63072000; includeSubDomainsX-Frame-Options: DENYX-Content-Type-Options: nosniffReferrer-Policy: no-referrerx-powered-bydisabled