Skip to content
mentoor

Topic 4 of 5 · 5 min read

Machine and enterprise-managed MCP authorization

Goal: Choose user OAuth, client credentials or enterprise-managed authorization for a described deployment and plan how access is revoked.

Pick the authorization mode by who is acting: a person approving for themselves uses user OAuth, a program with no person present uses client credentials, and a company that wants one place to grant and revoke access uses enterprise-managed authorization. The server still checks scopes and audience in all three.

Check yourself · 1 of 3

A CI pipeline needs to call an MCP server with no person present. Which mode fits?

Choose one answer

Why it matters

The standard flow opens a browser and waits for a user. A nightly job cannot do that. A company with 2,000 employees does not want each of them to approve dozens of servers by hand, and cannot revoke a leaver across all of them one by one. Matching the mode to the deployment removes both problems.

The three modes

  1. User OAuth (the default flow). A human logs in and consents. Use it for consumer apps and for individuals connecting their own accounts.
  2. OAuth client credentials extension (io.modelcontextprotocol/oauth-client-credentials). The client proves its own identity, with a signed JWT assertion (recommended; aud is the authorization server's issuer) or a client ID and secret. Use it for CI pipelines, scheduled jobs and server-to-server links. The token represents the application, not a person, so give it narrow scopes and its own identity in logs. A client acting on its own behalf may attempt step-up or simply stop.
  3. Enterprise-managed authorization (io.modelcontextprotocol/enterprise-managed-authorization). Employees sign in once to the company identity provider (IdP). The client asks the IdP for an Identity Assertion JWT Authorization Grant (ID-JAG) through a token exchange, then trades it at the MCP authorization server for an access token. The IdP applies policy, such as group or role, before issuing anything. Admins add or remove a server in one console.

Revocation

  • User OAuth: each user or admin revokes each client at each server.
  • Client credentials: rotate or delete the secret or key, and remove the client at the authorization server.
  • Enterprise-managed: disable the employee or the server's policy at the IdP. New grants stop immediately. Access tokens already issued live until they expire, so keep them short.

Before and after

Weak plan: one shared "agent" API key in the CI variables,
used by every pipeline, never rotated.

Anyone who can read CI variables can act as the agent, and revoking it breaks every pipeline. Better: one client per pipeline, each with a private-key JWT and only the scopes it needs, with the key stored in the CI secret store and rotated on a schedule.

What goes wrong

  • A client secret in a repo or chat, which turns into a standing credential.
  • Using client credentials for a task that should show who the user is, so audit trails say only "the agent".
  • Assuming IdP revocation ends tokens already issued.

Examples

Choosing for three deployments

A nightly report job with no user: client credentials, one client with reports:read. A support agent app used by 400 staff whose access must end when they leave: enterprise-managed authorization through the company IdP. A hobbyist connecting their own notes to a desktop client: user OAuth.

Offboarding an employee

Under enterprise-managed authorization, the admin disables the account at the IdP. The client can no longer obtain an ID-JAG, so it cannot get new MCP tokens. Existing access tokens expire on their own schedule, which is why the lifetime should be minutes, not days.

Key points

  • User OAuth fits a person approving access for themselves; client credentials fit unattended programs; enterprise-managed authorization fits organizations managing access centrally.
  • Client credentials should use a signed JWT assertion where possible, with one client per workload and narrow scopes.
  • Enterprise-managed authorization uses an ID-JAG from the company IdP, so policy is applied before any token is issued.
  • Revocation differs by mode, and tokens already issued stay valid until expiry, so lifetimes stay short.
  • Every mode still goes through scope and audience checks at the MCP server.

Common mistakes

  • Sharing one client secret across every pipeline or environment.
  • Using client credentials where a user identity is needed for audit or per-user data.
  • Treating IdP revocation as instant for tokens that were already issued.
  • Skipping scope design for machine clients because no user will see a consent screen.

Check yourself · 2 of 3

An employee leaves a company that uses enterprise-managed MCP authorization. Where does the admin cut off new access?

Choose one answer

Check yourself · 3 of 3

After the admin disables a leaver at the IdP, the leaver's laptop still calls a tool successfully five minutes later. What is the most likely explanation?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic