Most MCP authorization guidance, including ours, assumes one authorization server. A B2B SaaS product rarely gets to live there for long. The first enterprise customer who asks "can the agent sign in with our Okta, not your login page?" turns a single-issuer resource server into a multi-tenant federation problem, and the usual first answer is to add a second issuer to an allow list and hope.
That answer breaks in a specific way: the server ends up trusting a valid token from tenant A to reach tenant B's data. This is a guide to accepting tokens from many customer identity providers without that outcome.
Decide where federation happens
There are two shapes, and the choice is architectural rather than cosmetic.
One authorization server, many upstream connections. Your product keeps a single authorization server. Each customer's IdP is configured as an upstream SAML or OIDC connection. The MCP server sees exactly one issuer and one JWKS, and the tenant arrives as a claim. Most managed identity services support this directly.
Many authorization servers, one resource server. Each customer's IdP issues tokens for your MCP server directly. The MCP server validates tokens from N issuers with N key sets. This is what large enterprise buyers often want, because the token never leaves their control plane and revocation is theirs.
The first shape is far less work and should be the default. Choose the second when customers require it contractually, when you need tokens issued by the customer's own tenant for audit reasons, or when you are heading toward IdP-brokered access. Do not drift into the second by accident, one exception at a time, because the validation logic is different and so is the failure mode.
Discovery has to be tenant-aware
Protected resource metadata advertises which authorization servers a resource trusts. With one authorization server, one document at /.well-known/oauth-protected-resource is enough. With many, a single document listing every customer's issuer leaks your customer list and tells a client nothing useful about which one to use.
Two workable patterns:
- Tenant-scoped resource URLs. Each tenant gets its own MCP endpoint, for example
https://mcp.example.com/t/acme, with its own protected resource metadata naming only that tenant's authorization server. The resource identifier is distinct per tenant, which also makesresource(RFC 8707) and audience validation meaningful per tenant. - One endpoint with discovery after an unauthenticated probe. The server returns
401with aWWW-Authenticateheader whoseresource_metadataparameter points at the tenant-specific document, derived from a hint the client supplies (a subdomain, a URL path, or a connection the user picked in the client UI).
Tenant-scoped URLs are easier to reason about and easier to explain in a security review. They also give the customer something concrete to allow-list on egress.
Whichever you pick, the mapping from endpoint to trusted issuer must be server-side configuration. Never let the client name its own issuer or metadata URL in a request parameter. That is a request-forgery primitive, not a feature.
Validate the issuer, then bind it to the tenant
The critical rule: a valid signature proves who issued the token, not what it may reach. Validation for a multi-issuer server is two steps that must both run.
Step one, ordinary token validation, per issuer:
- Resolve the issuer from the
issclaim against your registered set. Reject unknown issuers before fetching anything. - Fetch keys from the JWKS URL recorded in that issuer's configuration, never from a URL carried in the token or its header.
- Verify the signature, the algorithm against an allow list,
exp,nbf, andaudagainst this tenant's resource identifier. - Cache keys per issuer with independent rotation and independent failure handling. One customer's IdP going slow must not stall validation for every other tenant.
Step two, the part that is usually missing: confirm that this issuer is the issuer registered for the tenant being addressed. If the request arrived at Acme's endpoint, the token's issuer must be the issuer stored on Acme's tenant record, and the token's tenant or organization claim must agree. If any of those three disagree, reject with 403 and emit an audit event. Treat that event as a security signal, not noise.
Store the binding as an explicit row: tenant ID, issuer URL, expected audience, expected tenant claim name and value, and who approved it. A security reviewer will ask how a token from one customer cannot reach another customer's data. The answer should be this row plus the test that proves it.
Subjects are not globally unique
Across issuers, sub is unique only within an issuer. A user is identified by the pair (iss, sub), and your user table should carry both. Collisions are rare in practice and catastrophic when they happen, which is the worst combination for a bug you only find in production.
The same applies to email. Email in a token is a claim about an address, not proof that the holder owns the mailbox, and two customers can assert the same domain. Do not match accounts on email across issuers. Link accounts only through a provisioned identifier from SCIM or an explicit admin-approved mapping.
Onboarding is a real feature
Adding an enterprise IdP is a privileged operation and should look like one:
- A customer administrator, authenticated in your product, submits the issuer URL.
- Your server fetches the issuer's discovery document and keys, over TLS, with timeouts and size limits, from an allow-listed egress path.
- The administrator completes a test authorization so you see a real token before the configuration goes live.
- The configuration becomes active only after that test succeeds, and the change is recorded in the customer-visible audit log with the actor and timestamp.
Write down the limits too. Which OIDC features you require, whether you support more than one issuer per tenant, what happens to existing sessions when an issuer changes, and how long key fetch failures are tolerated before the tenant is failed closed. Customers ask all four, usually in a questionnaire.
Offboarding and rotation
Federation changes more often than teams expect. Customers migrate from one identity provider to another, rotate signing keys, and occasionally leave.
- Key rotation is normal and should need no action if you honor
kidand refetch on an unknown key with a rate limit. - Issuer migration needs an overlap window where two issuers are valid for one tenant, with an expiry date on the old one and an alert when it passes.
- Contract termination must disable the issuer binding, not just the user records. A disabled tenant with a live binding still validates tokens.
- A compromised customer IdP is an incident on your side as well. You need one operation that suspends a tenant's binding and invalidates its sessions, and you need to have run it in a rehearsal.
Audit events need the issuer
Every audit event from a federated server should carry the issuer, the tenant, the subject, the client, and the tool. Without the issuer, a customer investigating an incident cannot tell whether a call came through their IdP or through your fallback login, and that is exactly the question an incident reviewer asks first. Include rejected calls, with the rejection reason, including issuer mismatches.
Test what you claim
The assertions above are worth exactly as much as the tests behind them. The minimum set, run in CI and included in the evidence pack:
- A token from tenant A's issuer, replayed against tenant B's endpoint. Expect
403. - A token whose
audnames a different tenant's resource identifier. Expect401. - A token signed with a key from an unregistered issuer whose
issclaims a registered one. Expect rejection before any network fetch. - A token with a
jkuor similar header pointing at an attacker-controlled key set. Expect rejection. - A disabled tenant with a still-valid, unexpired token. Expect
403. - Two users with identical
subvalues under different issuers. Expect two distinct accounts.
When you do not need this
If every customer signs in through your product's own login and nobody has asked for their own IdP, you do not need multi-issuer validation yet, and building it early buys you a larger attack surface for no revenue. The useful preparation is cheaper: keep issuer and audience as configuration rather than constants, store (iss, sub) on the user record from day one, and make the tenant resolution path a single function. Those three choices make the federation project a week instead of a rewrite.
We work through this binding on server engineering engagements and check it explicitly during an MCP security audit; when a customer runs several servers behind one control plane, it belongs in the governed platform design.