Skip to content

feat: adds FastMCP On-Behalf-Of token exchange Python example#81

Merged
priley86 merged 4 commits intomainfrom
mcp-quickstarts-obo-python
Apr 30, 2026
Merged

feat: adds FastMCP On-Behalf-Of token exchange Python example#81
priley86 merged 4 commits intomainfrom
mcp-quickstarts-obo-python

Conversation

@priley86
Copy link
Copy Markdown
Contributor

@priley86 priley86 commented Apr 27, 2026

🔑 FastMCP On-Behalf-Of Token Exchange Python MCP Quickstart updates

Builds on the SDK changes released in auth0-api-python which add On-Behalf-Of Token Exchange support in:
https://pypi.org/project/auth0-api-python/1.0.0b9/

With our FastMCP quickstarts (based on the existing FastMCP JS Python CTE quickstart).

Changes applied:
Screenshot 2026-04-27 at 10 57 14 AM

  • also includes a small fix for Starlette route mounting discovered while testing

📘 Documentation

See the following docs-v2 updates for more details about how to use OBO:
auth0/docs-v2#1053
auth0/docs-v2#1074

Comment on lines +40 to +41
# Add discovery metadata route
*auth0_mcp.auth_metadata_router().routes,
Copy link
Copy Markdown
Contributor Author

@priley86 priley86 Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed from:

# Add discovery metadata route
Mount("/", app=auth0_mcp.auth_metadata_router()),
# Add discovery metadata route
*auth0_mcp.auth_metadata_router().routes,

In Starlette, a Mount at / is a catch-all that intercepts everything. By unpacking the router into specific Route objects (.well-known/oauth-protected-resource, .well-known/oauth-authorization-server, etc.), these are evaluated first based on specificity. Remaining requests fall through to the MCP app Mount. This was previously causing issues when using the "Connect" button in MCP Inspector after successfully authenticating.

python = "^3.10"
python-dotenv = "^1.1.1"
mcp = "^1.27.0"
auth0-api-python = {path = "./auth0-api-python-obo", develop = true}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporarily included until auth0-api-python is released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated reference to 1.0.0b9 release: 06ac20b

@priley86 priley86 marked this pull request as ready for review April 30, 2026 15:57
@priley86 priley86 merged commit fcdc03e into main Apr 30, 2026
1 check passed
@priley86 priley86 deleted the mcp-quickstarts-obo-python branch April 30, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants