- Validate bearer tokens — an LLM or MCP application whose callers already hold an Entra access token (a service using client credentials, or an app forwarding a user token). TrustGate verifies the token and admits the caller; routing is the application’s own.
- OAuth2 · MCP login — an MCP application gated by an exposed API scope. Interactive agents (Cursor, etc.) use TrustGate’s authorization-code broker; optional client-credentials tokens are only for curl checks.
api:// resource URI and its bare identifier as the same audience, and prefers
the Entra oid claim as the stable subject. Use the values below exactly.
Prerequisites
- An Entra tenant — note your Tenant ID (
Overview → Tenant ID). - Rights to register applications (App registrations) and manage Enterprise applications.
- For Cursor / agent MCP login: the public MCP base URL of your gateway (e.g.
https://{gateway_slug}.mcp.neuraltrust.ai), so you can register the OAuth redirect URI.
mcp_base_url: SaaS uses {slug}.mcp.neuraltrust.ai. Private/Hybrid uses the Dataplane MCP URL from Settings → General. Register {mcp_base_url}/oauth/callback on the IdP before testing agent login.
The values you will collect
The endpoints are derived from the tenant:
1. Register the application
Steps use the Microsoft Entra admin center athttps://entra.microsoft.com (the same
screens exist in the Azure portal under Microsoft Entra ID). Paths below are the
left-hand navigation.
1
Create the registration
In the left sidebar go to Identity → Applications → App registrations → click
New registration.
- Name:
trustgate - Supported account types: pick the one that matches your tenant.
- Redirect URI (optional at create time; required for interactive MCP): platform
Web, URI
{mcp_base_url}/oauth/callback
(example:https://default-xxxxxxxx.mcp.neuraltrust.ai/oauth/callback)
2
Add a client secret
Open the app → left menu Manage → Certificates & secrets → Client secrets tab →
New client secret. Set a description and expiry, click Add, then copy the secret
Value immediately (it is shown only once — the Secret ID is not the value).
3
Confirm the redirect URI (for Cursor / MCP)
If you skipped it at registration, open Manage → Authentication → Add a
platform → Web, and add:Match character-for-character (no trailing slash). Save.
2. Expose an API scope (for MCP)
1
Set the Application ID URI
Open the app → left menu Manage → Expose an API. Next to Application ID URI click
Add, accept the default
api://{client_id}, and Save. This URI is your
audience.2
Add the scope
Still on Expose an API, click Add a scope:
- Scope name:
mcp.access - Who can consent: Admins and users (or Admins only) as appropriate.
- Fill the admin/user consent display name and description.
- State: Enabled.
api://{client_id}/mcp.access.3. Validate Entra bearer tokens (LLM or MCP)
Use this when the application already obtains its own Entra access token — client credentials for a service, or a user token the application forwards — and sends it asAuthorization: Bearer <token>. TrustGate verifies the token; what the application
binds on General decides providers and models. Everything below is done in the
NeuralTrust app — no API payloads.
1
Create the trust anchor
Go to Settings → Agent Gateway → Machine identity → Add trust anchor.
- Kind: IdP (JWT)
- Name: e.g.
entra-idp - Issuer:
https://login.microsoftonline.com/{tenant_id}/v2.0 - Audience:
api://{client_id}(the bare{client_id}form is accepted as the same audience) - Advanced: Subject claim
oid— a stable per-tenant user id; Entrasubis pairwise per app and changes across apps. Optionally pin JWKS URL tohttps://login.microsoftonline.com/{tenant_id}/discovery/v2.0/keys.
2
Attach it to the application
Go to Agent Gateway → Applications, open (or create) the application, and on General →
Authentication choose Identity provider and select
entra-idp.- Allowed client IDs: the Application (client) ID of every calling
application. Entra v2.0 tokens carry it in
azp. Leave empty only when the audience is dedicated to this one application.
3
Call the application
Mint a token (see §5) and send it:
401 means the token failed verification; 403 means it verified but its azp is
not in Allowed client IDs.4. OAuth2 for MCP
Use this when Cursor (or another MCP client) should log in through Entra. Access is gated by the exposed API scope (for examplemcp.access).
TrustGate accepts either:
- Delegated (user) tokens — scope appears in the
scpclaim (what Cursor uses via the authorization-code broker). - Application (client credentials) tokens — grant an app role as an application
permission, request
api://{client_id}/.default; the granted role appears inroles. TrustGate matches bothscpandrolesagainst Required scopes.
1
Grant API permission (client-credentials / M2M only)
Skip this step for Cursor. For curl M2M tests: open the calling app registration →
Manage → API permissions → Add a permission → My APIs → select your
trustgate API → Application permissions → tick the app role → Add
permissions. Then Grant admin consent for your tenant. Without admin consent the
token carries no roles and TrustGate rejects it for missing scopes.2
Create the interactive OAuth2 auth
The Machine identity form creates token-validation anchors; an anchor that brokers
a login is created with the Admin API and is then
listed and editable under Settings → Agent Gateway → Machine identity:This is the Interactive login · IdP with discovery setup: leave
session_mode off,
use the short scope name in required_scopes (not openid / profile / email),
and pin jwks_url only if you do not want discovery.3
Create an MCP application and attach the auth
Go to Agent Gateway → Applications → New Application.
- Name: e.g.
entra-mcp - Protocol:
MCP - Authentication → Identity provider: select
entra-mcp - Allowed client IDs (optional): the app registration’s client ID
4
Connect from Cursor
Open the application → Connect tab and copy the Cursor URL:Add it as an MCP server in Cursor and complete the Entra login. Confirm the Web
redirect URI from step 1 is registered, or Entra will reject the callback.
5. Get a test token (optional M2M)
Client credentials are not what Cursor uses. Use this to decode a token and confirm issuer, audience, and scopes, or as the token a service sends in §3:access_token and confirm:
iss=https://login.microsoftonline.com/{tenant_id}/v2.0aud=api://{client_id}(or the bareclient_id)azp= the calling application’s client ID (what Allowed client IDs matches)roles(app permissions) orscp(delegated) contains your scope/role
Troubleshooting
Back to Authentication.