Entra ID On-Behalf-Of MCP
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Entra ID On-Behalf-Of MCPverify my identity and list my recent emails"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Entra ID On-Behalf-Of MCP (FastMCP)
Example Model Context Protocol server that shows how Microsoft Entra ID On-Behalf-Of (OBO) works.
The MCP client authenticates to this server. The server does not forward that token to Microsoft Graph. It exchanges it at Entra for a new token whose audience is Graph, then calls Graph as the signed-in user.
User
|
| device code / MCP OAuth
v
Entra ID -- access token A (aud = MCP app, scp = access_as_user)
|
v
MCP client (Claude, VS Code, client_demo.py)
| Authorization: Bearer A
v
FastMCP server (this repo)
| POST /oauth2/v2.0/token
| grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
| requested_token_use=on_behalf_of
| assertion=A
| scope=https://graph.microsoft.com/User.Read
v
Entra ID -- access token B (aud = Graph, same user oid)
|
v
Microsoft Graph /me /me/messagesEntra OBO is not RFC 8693 Token Exchange. It is RFC 7523 jwt-bearer plus requested_token_use=on_behalf_of.
Tools
Tool | What it proves |
| Inbound JWT |
| OBO minted a different token; Graph |
| Second OBO with |
| Protocol, endpoint, and the rules that cause AADSTS50013 / 65001 |
Related MCP server: MCP Credentials Broker
1. Entra app registration
One confidential client is enough for this example. It plays two roles: resource (MCP audience) and client (the app that performs OBO).
Entra admin center → App registrations → New registration
Name:
entra-id-obo-mcpAccounts in this organizational directory only
Certificates & secrets → New client secret. Copy the value.
Expose an API
Application ID URI: accept
api://<application-client-id>Add scope
Name:
access_as_userWho can consent: Admins and users
Admin consent display name / description: allow the MCP server to take actions as the signed-in user
API permissions → Add a permission → Microsoft Graph → Delegated
User.ReadMail.ReadGrant admin consent for the tenant (required if the MCP client cannot request those Graph scopes at login)
Authentication
Platform: Mobile and desktop applications
Enable Allow public client flows (needed for the device-code demo client)
If you use
AUTH_MODE=proxy, also add a Web redirect URI:http://127.0.0.1:8000/auth/callback
Manifest → set
"requestedAccessTokenVersion": 2insideapi→ SaveCopy Application (client) ID and Directory (tenant) ID
Optional but useful: under Expose an API → Authorized client applications, add any first-party client you control (VS Code, a custom SPA) so users skip a second consent prompt for access_as_user.
2. Run the server
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# edit .env
python server.pyServer listens at http://127.0.0.1:8000/mcp.
Auth modes
| When to use it |
| You already have an Entra access token for |
| MCP hosts that speak the MCP OAuth spec and expect Dynamic Client Registration. FastMCP's |
3. Call it with the demo client
In a second terminal, same .venv and .env:
python client_demo.pyComplete the device-code login in a browser. The client requests only the MCP scope. Graph access happens later, inside the server, via OBO.
You should see whoami_mcp report audience_matches_mcp_app: true, then whoami_graph report a Graph aud and the same oid.
MCP host config (bearer)
{
"mcpServers": {
"entra-obo": {
"url": "http://127.0.0.1:8000/mcp",
"headers": {
"Authorization": "Bearer <entra-access-token-for-mcp-app>"
}
}
}
}Do not paste a Graph token into that header. Entra will reject the OBO exchange with AADSTS50013.
Why the extra hop
Tokens are resource-bound. Graph will not accept a token whose
audis your MCP app.Forwarding the user's raw token is a confused-deputy risk and breaks Conditional Access / token binding.
OBO keeps
oid/subas the user and records the MCP app asazp.Consent for Graph lives on the MCP app registration, not on whatever host launched the agent.
Common errors
Symptom | Cause |
| Assertion |
| No delegated grant for Graph on this app. Admin-consent |
| Mixed |
Guest user gets a token for the wrong tenant | OBO used |
OBO on a daemon token | OBO is user-delegation only. App-only traffic should use client credentials. |
Code map
server.py— FastMCP tools and auth wiringobo.py— MSALacquire_token_on_behalf_of, audience check, cache, Graph callsclient_demo.py— device-code login for the MCP audience, then tool callsconfig.py— environment
The raw Entra form this server sends:
POST https://login.microsoftonline.com/{tid}/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&client_id={mcp-app-id}
&client_secret=***
&assertion={inbound-mcp-access-token}
&scope=https://graph.microsoft.com/User.Read
&requested_token_use=on_behalf_ofTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
Remote MCP for A2A caller identity, scope policy, verdict receipts, and audit history.
An authenticated remote MCP server for user-owned devices and one-shot capability invocation.
Permissioned access to Outlook, OneDrive and Teams via the user's own Microsoft account
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceImplements the on-behalf-of flow with Entra ID to enable authorized calls to Microsoft Graph API via MCP tools.9-
- AlicenseAqualityFmaintenanceProvides secure OAuth2-based credential management for MCP servers, allowing agents to obtain short-lived token references without exposing raw secrets.722MIT
- FlicenseNot gradedqualityCmaintenanceMCP server that uses Microsoft Entra OAuth 2.0 On-Behalf-Of flow to access Microsoft Graph for Outlook data, enabling email, calendar, and contacts interactions via MCP tools.-
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to fetch the signed-in Microsoft Entra user's profile from Microsoft Graph via the GET /me endpoint using the provided bearer token.Apache 2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ejorgensen22/entra-id-obo-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server