Add get_user tool demonstrating OBO flow with Microsoft Graph #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Implements On-Behalf-Of (OBO) flow for calling Microsoft Graph API on behalf of authenticated users. Demonstrates token exchange pattern using Azure Managed Identity and App Service authentication.
Does this introduce a breaking change?
Pull Request Type
How to Test
git clone https://github.com/Azure-Samples/mcp-sdk-functions-hosting-python.git cd mcp-sdk-functions-hosting-python git checkout copilot/add-get-user-tool-obo-flowWhat to Check
Verify that the following are valid
get_user.pyimplements complete OBO token exchange flowazure-identity>=1.19.0,starlette>=0.49.1,uvicorn>=0.34.0Other Information
Implementation based on: anthonychu/mcp-sdk-functions-hosting-node-auth
OBO Flow:
Authorizationheader (App Service auth)ManagedIdentityCredentialobtains assertion token for exchangeOnBehalfOfCredentialexchanges user token for Graph token/meendpointKey Files:
get_user.py- New MCP server withget_current_usertoolpyproject.toml- Added azure-identity, starlette, uvicorn dependenciesREADME.md- OBO flow documentation and usage instructionsInfrastructure already configured for OBO (Entra app, federated identity, environment variables). Tool requires deployment to Azure - local execution returns informational message about missing auth context.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.