OAuth Flow¶
This section documents the authentication and authorization flow used to connect an Organization (e.g., a delivery platform, POS system, or restaurant management system) to the Platform and allow secure access to data via MCP.
Participants¶
| Participant | Description |
|---|---|
| User | Person who operates the platform and connects the organization |
| Platform | Agent / UI that consumes data via MCP |
| Login (Organization) | Login page of the restaurant software |
| OAuth (Organization) | Organization's authorization server |
| MCP | MCP server that exposes the tools (hosted by the organization or a delegated operator) |
| DataBridge | Data access layer (runs the queries) |
Organization
"Organization" represents any company integrated with the ecosystem. In this flow, the organization acts as a provider, exposing identity (OAuth / userinfo / merchants) and data. DataBridge is the generic data access layer behind an MCP — the organization or a delegated operator may run it. See Who operates the MCP.
How the platform obtains OAuth before the flow¶
Before the authorization flow, the platform needs to discover the authorization server endpoints and the client credentials. There are three scenarios:
- No discovery metadata → manual configuration: the organization provides the endpoints and credentials (
client_id/client_secret) explicitly. - With metadata + DCR → automatic flow: the platform reads the metadata (RFC 8414) and self-registers as a client (RFC 7591). Nothing is exchanged manually.
- With metadata, without DCR → automatic endpoint discovery, but the credentials (
client_id/client_secret) are provided manually.
Info
The authorization server requirements are the same in all scenarios. See OAuth Requirements for the full breakdown.
Interactive sequence diagram¶
Flow steps¶
1. Organization connection¶
- User → Platform: clicks "Connect Organization".
- Platform → Login: redirects the user sending
client_id,scopesand the PKCE flow parameters. - User → Login: enters credentials (email/password) and performs MFA if necessary.
- Login → OAuth: validates the provided credentials.
- OAuth → Platform: returns an authorization code via callback.
- Platform → OAuth: exchanges the authorization code for tokens using the PKCE
code_verifier. - OAuth → Platform: returns
access_token(JWT) andrefresh_token. - Platform: stores the connection tokens with the organization.
- Platform → OAuth: calls
GET /merchantswith the Bearer (preferred path for store scope). - OAuth → Platform: returns the merchant list (rich catalog).
- Platform: builds the store picker / bind and the account business profile.
- Platform → User: informs that the organization was connected.
Note
The platform does not need to call userinfo in this step. Userinfo is consumed by the MCP on tool calls. See Userinfo and Merchants.
2. Query about organization data¶
- User → Platform: sends a prompt involving organization data.
- Platform → MCP: runs a tool — in the example,
list_merchants(fallback for rediscovery/refresh; connect stores already came from/merchants) — withBearer JWT. - MCP: validates the JWT (signature,
iss,aud,exp). - MCP → OAuth (Organization): calls
GET /userinfowith the Bearer token to obtain the user's authorization context (identity + permissions). - OAuth (Organization) → MCP: returns
sub,emailandprofile_permissions. - MCP: applies the authorization logic — determines which merchants/resources the user can access.
- MCP → Platform: returns the tool result (e.g. authorized merchant list).
Note
The platform does not receive the raw userinfo payload. The MCP applies userinfo and returns only the tool result.
3. Data query¶
- Platform → MCP: runs
tool_call fetch_data(merchant_ids)withBearer JWT. - MCP: validates the JWT (signature,
iss,aud,exp) and checks the user's authorization scope (via userinfo / known scope). - MCP → DataBridge: runs the necessary queries against the organization's data store, filtered by the authorized
merchant_ids. - DataBridge → MCP: returns the requested data.
- MCP → Platform: returns the result of the tool execution.
- Platform → User: displays the response with the merchant data.