https://auth.example.com, the server is https://mcp.example.com/mcp, and the service account is MCPSVC.
What you need
- An OAuth 2.1 or OpenID Connect provider that issues JWT access tokens signed with an asymmetric algorithm (RS256, ES256, EdDSA, …).
- A service account profile on the IBM i.
- HTTPS in front of the server: a reverse proxy, or the server’s own certificate (
MCP_TLS_CERT_FILE,MCP_TLS_KEY_FILE).
Register the server with your provider
In your provider’s admin console:- Register an API (resource) with the identifier
https://mcp.example.com/mcp, so tokens carry it in theiraudclaim. - Optionally create a scope such as
mcp:toolsand grant it to the people allowed to use the server. - Turn on a client registration method your assistants support: dynamic client registration, or Client ID Metadata Documents.
Find the issuer
The server compares the issuer character for character. Read it from the provider’s metadata:Configure the server
Create.env:
.env
MCP_TRUSTED_PROXIES to the proxy’s address. If your provider can’t put the resource URL in aud, set OAUTH_AUDIENCE to the value it uses.
Start the server:
OAuth authentication enabled.
Check it works
Call the server without a token:401 Unauthorized with a WWW-Authenticate: Bearer … resource_metadata="…" header. That header is what tells assistants where to sign in.
Now add https://mcp.example.com/mcp to an assistant. It opens your provider’s sign-in page on first use.
Good to know
- JWT access tokens only. Opaque tokens and token introspection aren’t supported.
- One provider per server. Scopes apply to the whole server, not per tool.
- Clocks must agree. The server allows no clock skew when it checks a token’s expiry.
Next steps
Reference
Every setting and the token rules.
Troubleshooting
Token and startup errors.