Skip to content

feat(auth): expose access token subject#2595

Open
MukundaKatta wants to merge 1 commit into
modelcontextprotocol:mainfrom
MukundaKatta:codex/python-sdk-access-token-subject
Open

feat(auth): expose access token subject#2595
MukundaKatta wants to merge 1 commit into
modelcontextprotocol:mainfrom
MukundaKatta:codex/python-sdk-access-token-subject

Conversation

@MukundaKatta
Copy link
Copy Markdown

Summary

  • Add optional subject and claims fields to AccessToken so token verifiers can preserve JWT sub and custom claims.
  • Expose Context.subject for higher-level MCP handlers that need the authenticated subject.
  • Add focused tests for auth-context propagation and the Context.subject convenience property.

Refs #1038.

Validation

  • uv run pytest tests/server/auth/middleware/test_auth_context.py tests/server/mcpserver/test_server.py::test_context_subject_reads_authenticated_access_token -q
  • uv run ruff format --check src/mcp/server/auth/provider.py src/mcp/server/mcpserver/context.py tests/server/auth/middleware/test_auth_context.py tests/server/mcpserver/test_server.py
  • uv run ruff check src/mcp/server/auth/provider.py src/mcp/server/mcpserver/context.py tests/server/auth/middleware/test_auth_context.py tests/server/mcpserver/test_server.py

@MukundaKatta MukundaKatta force-pushed the codex/python-sdk-access-token-subject branch from 67a80a6 to ec818af Compare May 15, 2026 02:25
@MukundaKatta MukundaKatta marked this pull request as ready for review May 15, 2026 02:26
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.

1 participant