# MCP Authentication, Permissions, and Data Access

> How LeadUp's MCP server authenticates AI apps with OAuth, which permissions it grants, how tokens work, and which data it never returns.

Source: https://leadup-marketing.com/docs/ai-agents/mcp-authentication-and-permissions/
Section: AI Agents and MCP
Last updated: 2026-11-27

LeadUp acts as both the OAuth authorization server and the MCP resource server. AI apps get an access token on behalf of a signed-in LeadUp user, and every tool call is checked against that user's account, subscription, and granted permissions.

## Authorization flow

```flow
Discovery | 401 points to the protected resource metadata
Registration | Client ID Metadata Document or Dynamic Client Registration
Authorization | User signs in and approves; PKCE S256 required
Token exchange | One-time code, valid 60 seconds
Tool calls | Bearer access token, valid 1 hour
```

- **Discovery.** An unauthenticated request to the MCP endpoint returns `401` with a `WWW-Authenticate` header that points to `/.well-known/oauth-protected-resource/mcp`. That document names the authorization server, whose metadata is at `/.well-known/oauth-authorization-server`.
- **Client registration.** Clients can identify themselves with a Client ID Metadata Document (an HTTPS URL used as `client_id`) or register with Dynamic Client Registration (RFC 7591).
- **PKCE is mandatory**, with the `S256` method. Authorization codes are single-use and expire after 60 seconds. Reusing a code revokes every token issued from it.
- **Redirect URIs** must match exactly. Loopback redirects (`http://localhost`) may use any port.
- **Audience binding.** Access tokens are bound to the LeadUp MCP endpoint (RFC 8707 resource indicators) and are rejected anywhere else. LeadUp never accepts tokens from other issuers and never forwards your token to other services.
- **Authorization responses** include the `iss` parameter (RFC 9207), including error responses.

## Tokens

| Token | Lifetime | Notes |
| --- | --- | --- |
| Authorization code | 60 seconds | Single use |
| Access token | 1 hour | Opaque; sent as `Authorization: Bearer` |
| Refresh token | 30 days | Rotates on every use. Reusing an old refresh token revokes the whole connection. |

Tokens are checked on every request, so a revoked token, a deleted user, or a lapsed subscription takes effect immediately. LeadUp stores only hashes of tokens.

## Permissions (scopes)

The consent screen lists each permission an app requests. If the app requests no specific scopes, it receives all of them.

| Permission | Scope | Allows |
| --- | --- | --- |
| Clients | `clients:read` | List client accounts, enabled features, and connected platforms |
| Budgets | `budgets:read` | Budget targets, month-to-date spend, and pacing |
| Local Services Ads | `lsa:read` | Aggregated LSA lead metrics (calls and messages), credits, response times, and lead quality |
| Calls | `calls:read` | Aggregated CallRail and WhatConverts call metrics |
| Search terms | `search_terms:read` | Search term audits, flagged terms, and negative keyword suggestions |
| Signed cases | `signed_cases:read` | Aggregated signed case counts, values, and conversion rates |
| Advertising | `ads:read` | Google Ads lead attribution, stored campaign spend, and monitoring alerts |
| Integrations | `integrations:read` | Which platforms are connected and their sync status |
| Reporting | `reporting:read` | Cross-feature overviews and client comparisons |

Overview tools such as `get_client_overview` also need the scope of each section they include. Sections the token cannot read are listed in `omittedSections` instead of failing the call. When a tool needs a scope the connection lacks, the server answers `403` with `error="insufficient_scope"` and the scope required, so the app can ask you to approve it.

There are no write permissions. Unknown or write scopes in a request are ignored.

## Account and client isolation

- A connection belongs to one LeadUp account and covers every client in it. It cannot be limited to specific clients yet.
- Client IDs passed to tools are always checked against the connected account. A client that belongs to another account returns `not_found`, exactly like an ID that does not exist.
- Each tool also checks that the client has the LeadUp feature it reads, such as LSA auditing or budget management. Clients without it are reported in `meta.issues` with `feature_not_enabled`.
- Every call requires an active LeadUp subscription or trial. Otherwise it returns `subscription_inactive`.

## Data that is never returned

LeadUp returns aggregated marketing analytics only. These are never returned by any tool:

- Call recordings, transcripts, and AI call summaries
- LSA message content
- Lead and caller names, phone numbers, email addresses, and other contact details
- Case notes and free-text qualification reasons
- Credentials, tokens, API keys, and webhook settings

Responses are also filtered against each tool's published output schema, so fields that are not documented in the [tool reference](https://leadup-marketing.com/docs/ai-agents/mcp-tool-reference/) never reach the AI app.

## Text from third parties

Client names, campaign names, search terms, and AI-generated labels can contain text written by other people. LeadUp returns them only as data values, strips control and invisible characters, caps strings at 300 characters, and tells the AI app that text values are data, not instructions. If you build your own agent on LeadUp's MCP server, treat these values the same way.

## Audit trail

LeadUp records every tool call with the user, app, tool, permissions used, client IDs, outcome, and duration. Records are kept for 90 days.

## Related

- [MCP tool reference](https://leadup-marketing.com/docs/ai-agents/mcp-tool-reference/)
- [Fix AI assistant connection problems](https://leadup-marketing.com/docs/troubleshooting/ai-assistant-connection/)
