Test the OAuth well-known metadata MCP clients discover #143

Merged
CrowderSoup merged 1 commit from claude/oauth-metadata-tests into main 2026-12-01 21:48:41 +00:00
Owner

MCP clients find vTodo's OAuth endpoints through the RFC 8414 and RFC 9728 well-known documents (/.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource, at the root and under /o/). django-oauth-toolkit serves them, but nothing in CI checked them.

This adds apps/api/tests/test_oauth_metadata.py, which checks that:

  • both documents are public and answer at both mount points
  • the issuer ends in /o, matching what the MCP server expects, and the authorize/token endpoints hang off it
  • dynamic client registration is advertised, PKCE S256 is supported, and implicit and password grants stay out
  • the root and /o/ forms describe the same authorization server

The test was written in September (branch task/114-oauth-metadata-coverage) and never merged. It's rebased onto today's main unchanged; it's a test-only change with no app code touched.

Tests

uv run pytest apps/api/tests/test_oauth_metadata.py: 5 passed on the rebased branch.

🤖 Generated with Claude Code

MCP clients find vTodo's OAuth endpoints through the RFC 8414 and RFC 9728 well-known documents (`/.well-known/oauth-authorization-server` and `/.well-known/oauth-protected-resource`, at the root and under `/o/`). django-oauth-toolkit serves them, but nothing in CI checked them. This adds `apps/api/tests/test_oauth_metadata.py`, which checks that: - both documents are public and answer at both mount points - the issuer ends in `/o`, matching what the MCP server expects, and the authorize/token endpoints hang off it - dynamic client registration is advertised, PKCE `S256` is supported, and `implicit` and `password` grants stay out - the root and `/o/` forms describe the same authorization server The test was written in September (branch `task/114-oauth-metadata-coverage`) and never merged. It's rebased onto today's `main` unchanged; it's a test-only change with no app code touched. ## Tests `uv run pytest apps/api/tests/test_oauth_metadata.py`: 5 passed on the rebased branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Add regression coverage for RFC 8414/9728 OAuth well-known metadata
All checks were successful
tests / pytest (push) Successful in 1m25s
b5292ea613
Task #114 asked for /.well-known/oauth-authorization-server and
/.well-known/oauth-protected-resource so MCP clients like Meta's Muse can
discover our OAuth endpoints instead of falling back to a pasted API key.

Both documents already exist (django-oauth-toolkit's metadata_urlpatterns,
wired up in config/urls.py back in 7be4037), verified by hand to return
correct, unauthenticated JSON at both the root and /o/-prefixed mount
points. Nothing exercised them in CI, so add tests that lock in the
current, correct behavior and would catch any future regression (issuer
mismatch, DCR/PKCE settings drifting, grant types reappearing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
CrowderSoup deleted branch claude/oauth-metadata-tests 2026-12-01 21:48:42 +00:00
Sign in to join this conversation.
No description provided.