The Loop MCP Server uses OAuth 2.1 with PKCE for authentication and publishes authorization server metadata following RFC 8414. Most MCP clients handle this flow for you — this page exists for integrators who want to understand how it works under the hood.Documentation Index
Fetch the complete documentation index at: https://docs.loopreturns.com/llms.txt
Use this file to discover all available pages before exploring further.
This is not the same OAuth flow used by the REST API. REST API OAuth is for partner integrations that act on behalf of merchants. MCP OAuth is initiated by the merchant themselves through their MCP client.
Discovery
When an MCP client first connects tohttps://api.loopreturns.com/mcp, it fetches the protected resource metadata to discover the authorization server:
https://api.loopreturns.com) as the OAuth authorization server, the supported scopes, and the endpoints below.
Authorization endpoints
| Endpoint | Purpose |
|---|---|
POST /oauth/register | Return the client metadata needed to start the MCP OAuth flow |
GET /oauth/authorize | Begin the authorization flow |
GET /oauth/callback | Complete the browser authorization flow |
POST /oauth/token | Exchange the code for a bearer token |
https://api.loopreturns.com.
Flow overview
Multi-tenant shop resolution
A single email can be associated with multiple Loop shops. The MCP OAuth flow resolves the right shop in one of three ways:login_hintprovided. The client passes the email up front; Loop looks up the associated shops.- Email form. If no hint is provided, Loop shows an email input form.
- Shop selector. If the email is associated with more than one shop, Loop shows a shop selection form before sign-in continues.
Token handling
Loop returns a signed bearer token that MCP clients present on each tool call. Clients should treat this token as opaque: store it securely, send it only to Loop, and reconnect when the client reports that the session has expired.Using the token
Pass the token in theAuthorization header on every MCP request:
Permissions
Once authenticated, the user is subject to the same role-based permissions that govern their access to the Loop Admin. Each MCP tool declares the permissions it requires (OR logic — at least one is sufficient). If a user lacks every required permission, the tool returns an authorization error and is hidden from the assistant’s tool catalog where possible.Rate limits
| Endpoint | Limit |
|---|---|
/.well-known/* | 100/hour per IP |
/oauth/register | 50/hour per IP |
/oauth/authorize | 100/hour per IP |
/oauth/token | 100/hour per IP |
/mcp (tool calls) | 600/hour per authenticated user |
429 Too Many Requests with a Retry-After header.
Troubleshooting
The browser opens but I see 'Email not found'
The browser opens but I see 'Email not found'
Loop didn’t find any shops associated with the email you submitted. Confirm the email matches a user record in your Loop Admin (under Settings → Team).
Authentication succeeds but tool calls return 'Unauthorized'
Authentication succeeds but tool calls return 'Unauthorized'
The MCP client says 'Token expired'
The MCP client says 'Token expired'
Reconnect the server in your MCP client to start a fresh OAuth flow.
Next steps
Get Started
Connect Claude, Cursor, or VS Code Copilot to the Loop MCP Server.
Overview
See the full list of tools the MCP server exposes.