Enterprise setup with Entra and an MCP gateway
Configure Entra tokens, group access and optional Azure APIM or Cloudflare MCP portals for Telvine, with audience examples and troubleshooting.
Entra is the identity provider. An MCP gateway is an optional access layer. Telvine is the upstream server that serves governed skills and MCP App UI components.
The integration contract is a per-user Entra access token for the API audience configured in Telvine. Signing into a gateway is a separate step from obtaining that token. A gateway login token, Microsoft Graph token or shared backend credential does not establish the user's Entra groups in Telvine.
What happens on a request
1. The user signs in through an OAuth client registered in Entra.
2. Entra issues an access token for the Telvine-facing API registration.
3. The agent sends that token to the MCP endpoint.
4. An optional gateway validates/routes the request.
5. Telvine validates the same Entra token and applies its group policies.
6. The agent receives only permitted, live components.
The network paths are:
Without a gateway:
agent → https://api.telvine.com/mcp
With Azure APIM:
agent → https://your-gateway.example/telvine/mcp → https://api.telvine.com/mcp
With a portal doing per-user upstream OAuth:
agent → portal login → Entra authorization for the upstream API → Telvine
A gateway can decide whether Finance may connect to Telvine. Telvine can then decide which individual skills or app components Finance may discover and load. These are separate policies.
Choose the connection method first
| Method | How the downstream token is acquired | Telvine support |
|---|---|---|
| Agent or enterprise adapter supplies a Bearer header | Its configured OAuth client obtains and refreshes an Entra token | The current endpoint validates supplied tokens. |
| APIM forwards a Bearer header | The agent or an adapter obtains the Entra token; APIM validates and preserves it | The documented forwarding pattern below. APIM validation alone does not perform user sign-in. |
| Cloudflare portal performs per-user upstream OAuth | A manually registered Entra OAuth client is configured in the portal | Cloudflare offers manual upstream OAuth configuration. Validate the tenant-specific setup and downstream token before rollout. |
| Agent expects Telvine to discover OAuth automatically from its URL | Telvine would advertise authorization metadata and the client would start sign-in | Native MCP OAuth discovery and automated client registration are not implemented by Telvine today. |
Start with a direct authenticated call before adding a gateway. This separates identity/audience problems from gateway routing problems.
1. Create the Entra API registration
Your Entra administrator creates a single-tenant app registration representing access to the Telvine endpoint. For example, name it Telvine Skills API.
Record these values:
| Value | Example placeholder | Where it is used |
|---|---|---|
| Directory (tenant) ID | <TENANT_ID> | Entra authority, gateway validation and Telvine governance settings |
| API application (client) ID | <API_CLIENT_ID> | The audience expected by Telvine |
| Application ID URI | api://<API_CLIENT_ID> | Prefix used when requesting a delegated scope |
| Delegated scope | api://<API_CLIENT_ID>/Telvine.Read | OAuth permission requested by the agent, adapter or portal |
Expose a delegated scope such as Telvine.Read under Expose an API and grant the appropriate administrator consent. Scope names are an Entra configuration choice; the current Telvine verifier checks the audience, identity and groups, rather than a particular scope string. The APIM example also checks Telvine.Read at the gateway.
Configure this API registration to issue v2 access tokens. In the Microsoft Graph app-manifest format this is api.requestedAccessTokenVersion: 2; older manifest documentation calls it accessTokenAcceptedVersion. The token version is controlled by the resource/API registration, not just by using a /v2.0 authorization URL.
See Microsoft's API scope configuration and application manifest reference.
2. Put group object IDs in the access token
On the API registration, configure group claims for access tokens. Use Entra group object IDs, matching the IDs you will enter in Telvine; display names such as Finance are not access-policy identifiers.
For a small test, include security-group claims. For production, consider application-assigned groups so tokens include only the relevant memberships. Configure group assignment and membership according to your Entra licensing and directory policy.
Telvine reads the signed groups claim. It does not query Microsoft Graph, provision users through SCIM or maintain a second copy of the directory. Group-policy changes in Telvine are checked on each request; Entra membership changes are reflected when fresh tokens contain the updated claims.
Entra can replace a long group list with overage indicators. Telvine rejects tokens with hasgroups or a group-overage _claim_names.groups marker. It does not follow the Graph URL supplied in a token. Reduce the included groups or add a separately designed Graph-resolution integration before rollout.
See Microsoft's group-claim configuration guidance.
3. Configure Telvine
Sign into the Telvine dashboard as a Telvine organization administrator, then open Governance:
- Enter
<TENANT_ID>as the Entra tenant ID. - Enter
<API_CLIENT_ID>as the API audience. For the v2 setup above this is the bare application client ID, notapi://<API_CLIENT_ID>/Telvine.Read. - Save the policy.
- Set each governed component's audience to the authenticated organization or selected Entra group IDs.
- Enable independent approval if your rollout requires a second administrator to approve releases.
- Publish, evaluate and release the intended versions to stable.
The client application ID used to sign the user in is a different value from the API application ID accepted as the audience. Do not put the agent/portal OAuth client's ID into the API audience field.
The current mapping supports one Entra tenant per Telvine organization and one Telvine organization per linked tenant. Once enabled, Entra is mandatory for runtime MCP calls: Telvine read keys and Clerk dashboard sessions cannot bypass this runtime policy. Dashboard administration continues through Clerk; an Entra runtime token does not automatically grant dashboard administrator rights.
4. Obtain a token for the API
Register the agent, adapter or portal as an OAuth client in Entra. Give that client delegated permission to api://<API_CLIENT_ID>/Telvine.Read, configure the redirect URI its OAuth implementation uses and complete the required consent.
For an interactive client, use an OAuth authorization-code flow with PKCE where the client supports it. A public client must not embed a client secret. A portal acting as a confidential client keeps its secret in its own server-side secret store. The OAuth implementation is responsible for acquiring and refreshing tokens; copying a short-lived token into a header is a connectivity test, not a production refresh strategy.
The tenant-specific endpoints are:
authorization_endpoint = https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/authorize
token_endpoint = https://login.microsoftonline.com/<TENANT_ID>/oauth2/v2.0/token
scope = api://<API_CLIENT_ID>/Telvine.Read
Where the client's refresh flow needs it, request offline_access as well. Consult its OAuth implementation for exact scope and redirect settings. This guide describes delegated user access; it does not equate a daemon/service principal with a user's group membership.
Before adding the gateway, verify the access token locally. Its claims should include:
{
"iss": "https://login.microsoftonline.com/<TENANT_ID>/v2.0",
"aud": "<API_CLIENT_ID>",
"tid": "<TENANT_ID>",
"oid": "<USER_OBJECT_ID>",
"groups": ["<FINANCE_GROUP_OBJECT_ID>"],
"scp": "Telvine.Read",
"exp": 1900000000
}
This is a claim-shape illustration, not a usable token. Decoding claims alone does not verify a signature; Telvine performs signature verification against Microsoft's tenant-specific signing keys. Do not paste live access tokens into public debugging sites or support messages.
Test discovery with an access token already obtained by your OAuth client:
curl --fail-with-body https://api.telvine.com/mcp \
-H "Authorization: Bearer $ENTRA_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
--data '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"telvine_list_skills","arguments":{}}}'
Use your configured API URL for a local or separately hosted environment. A successful response with no skills can mean the token is valid but no permitted skill has a live stable version.
5A. Add Azure API Management
Create an APIM HTTP API/operation whose public path is /telvine/mcp and whose upstream is https://api.telvine.com/mcp. Configure the operation to preserve the end-user Authorization header.
The following operation policy illustrates Entra validation and path rewriting. Replace the named values with your tenant and API client IDs; adapt the surrounding inherited policies to your APIM configuration:
<policies>
<inbound>
<base />
<validate-azure-ad-token tenant-id="{{entra-tenant-id}}"
header-name="Authorization"
failed-validation-httpcode="401">
<audiences>
<audience>{{telvine-api-client-id}}</audience>
</audiences>
<required-claims>
<claim name="scp" match="any" separator=" ">
<value>Telvine.Read</value>
</claim>
</required-claims>
</validate-azure-ad-token>
<set-backend-service base-url="https://api.telvine.com" />
<rewrite-uri template="/mcp" copy-unmatched-params="false" />
</inbound>
<backend><forward-request /></backend>
<outbound><base /></outbound>
<on-error><base /></on-error>
</policies>
Add rate limits, networking rules or subscription requirements according to your platform policy. If an agent cannot send an APIM subscription header, address that explicitly in its adapter or API configuration; do not assume an Entra token is also an APIM subscription key.
Preserve Accept, Content-Type, MCP-Protocol-Version and, when present, Mcp-Session-Id. Relay session response headers back to the client. Configure CORS for browser-based clients where needed. Do not replace the user token with a managed-identity or shared backend token if Telvine is expected to make user-group decisions.
If your gateway accepts tokens for a different gateway audience, those tokens cannot simply be forwarded to Telvine. The integration must obtain a separate token for the configured Telvine API audience. An on-behalf-of design requires its own Entra configuration and implementation; APIM token validation is not a token exchange.
See Microsoft's validate-azure-ad-token policy reference.
5B. Add a Cloudflare MCP portal
Treat portal authentication and upstream API authorization as two separate flows:
- Portal authentication decides which people can use the portal and reach a server.
- Upstream authorization must supply a per-user Entra access token with the Telvine API audience and groups.
Cloudflare documents manual upstream OAuth credentials for providers without dynamic client registration. For an Entra-based upstream flow, register a confidential OAuth client in your tenant and configure the portal's manual OAuth settings with the tenant-specific endpoints above, its client ID, the delegated API scope and the appropriate token-endpoint authentication method.
Use the exact redirect URI displayed by Cloudflare. Its documented shared manual-OAuth callback is https://oauth-callbacks.cloudflareaccess.com/cdn-cgi/access/outbound-oauth-callback; confirm the setting in the portal you are configuring. Store client secrets in Cloudflare's secret configuration, never in a plugin, UI bundle or skill file.
Choose per-user upstream authorization when Telvine must apply user-group policy. A shared administrator token or static Bearer credential identifies that shared principal, not each portal user. Telvine does not use Cf-Access-Jwt-Assertion, forwarded emails or custom group headers as substitutes for an Entra API access token.
Cloudflare documents this OAuth mechanism, but a live Cloudflare-to-Entra-to-Telvine configuration has not yet been verified by Telvine's integration tests. Confirm the downstream token's audience and group claims, resource forwarding and any MCP Apps host behavior in your tenant before describing the setup as production-ready.
See Cloudflare's MCP server portal and upstream OAuth documentation.
Make gateway policy mandatory when required
Routing agents through a gateway does not by itself prevent direct calls to the upstream. The current public Telvine endpoint still accepts a valid configured Entra token directly.
If APIM or Cloudflare must be a mandatory security boundary, arrange an upstream network/authentication restriction that admits only your gateway, such as a separately operated private deployment or a verified gateway-authentication layer. This is an additional deployment requirement; a DNS alias, a browser Origin allowlist or a client configuration pointing at the gateway does not enforce it. Do not describe a public upstream as gateway-only until that restriction has been implemented and tested.
Verify the enterprise policy
Use two real test users and fresh access tokens:
- Put Alice in the Finance group; leave Bob out.
- Assign a stable component to the Finance group in Telvine.
- Alice can discover and load it. Bob cannot discover it or fetch its resource by guessing an ID or URI.
- Change the Telvine policy and retry discovery and reads.
- Change Entra membership, obtain fresh tokens and repeat the checks.
- If approvals are enabled, confirm an unapproved candidate cannot be delivered and a passing, approved stable version can.
- Repeat through the gateway, preserving the same end-user identity.
A gateway's access log proves a request reached an upstream. It does not prove a skill completed successfully or an MCP App rendered; those are separate runtime observations.
Troubleshooting
| Symptom | Check |
|---|---|
401 missing_authorization | The agent/gateway did not send a Bearer header. |
401 invalid_token | The tenant is not linked to the intended Telvine organization, or the token shape is invalid. |
401 invalid_identity_or_groups | Check expiry, signature, v2 issuer, audience and group-overage markers. A Graph token or gateway-only token has the wrong audience. |
403 entra_identity_required | A Telvine read key or Clerk session was used after Entra was enabled. |
403 origin_not_allowed | A browser Origin is absent from MCP_ALLOWED_ORIGINS on the API operator's deployment. Native clients may omit Origin. |
| Successful discovery, empty results | Check group object IDs, token group claims, stable version, stored artifacts and required approval. |
| Works directly, fails through APIM | Check path rewriting, inherited header changes, subscription requirements and audience validation. |
| Portal login succeeds, upstream call fails | Check the portal's separate upstream OAuth authorization and the token sent to Telvine. |
403 organization_admin_required in Governance | Runtime Entra identity and Clerk dashboard administrator rights are separate. |
Current boundaries
The implemented runtime verifies supplied Entra tokens and applies saved access policy. It does not provide native MCP OAuth discovery, automatic client registration, a hosted sign-in/token-refresh service, Graph group-overage resolution or SCIM provisioning. The gateway patterns above still require tenant-specific configuration and live verification. The enterprise billing entitlement system is separate from these identity controls.