fastmcp/tests
Pierre Audonnet a57f1c8b20
Add subject field to AccessToken initialization (#4267)
* Add subject field to AccessToken initialization

Fixes #4266

Add `subject` property to the AccessToken.

```python
        return AccessToken(
            token=access_token_as_dict["token"],
            client_id=access_token_as_dict["client_id"],
            scopes=access_token_as_dict["scopes"],
            subject=access_token_as_dict["subject"],
            # Optional fields
            expires_at=access_token_as_dict.get("expires_at"),
            resource=access_token_as_dict.get("resource"),
            claims=access_token_as_dict.get("claims") or {},
        )
```

* Populate AccessToken.subject across all token verifiers

Closes #4266. get_access_token().subject was always None: the SDK's
AccessToken.subject wasn't carried into FastMCP's AccessToken by the
dependency-layer conversion, and none of the built-in TokenVerifiers
(JWT, introspection, and the OAuth-provider verifiers for Discord,
Clerk, Google, WorkOS, HuggingFace, GitHub, and Cognito) populated it
from the sub claim/field they already extract.

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2026-07-18 21:15:13 -04:00
..
apps Add default prefill to FormInput.collect_input (#3937) 2026-04-14 13:23:36 -04:00
cli Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
client Handle expired OAuth client registrations (#4520) 2026-07-18 15:16:27 -04:00
conformance Forward-port HTTP host guard compatibility (#4474) 2026-07-08 20:55:56 -04:00
contrib Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
deprecated Merge pull request #4453 from PrefectHQ/remove/deprecated-params 2026-07-07 07:59:53 -04:00
docs Skip live-import validation for frozen v2 doc snapshots 2026-07-07 07:53:10 -04:00
experimental Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
fs fix(fs): isolate same-named package imports across providers (#4361) 2026-06-24 10:57:01 -04:00
integration_tests Migrate to MCP SDK v2.0.0b2 (httpx2) (#4503) 2026-07-18 15:12:47 -04:00
prompts Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
resources Screen templated resource parameters for path traversal by default (#4482) 2026-07-17 17:42:48 -04:00
scripts Exempt maintainers from MRE auto-close (#4220) 2026-05-23 09:02:44 -04:00
server Add subject field to AccessToken initialization (#4267) 2026-07-18 21:15:13 -04:00
telemetry Expose telemetry attributes on span start (#4487) 2026-07-18 19:46:19 -04:00
tools Reject positional-only tool parameters (#4524) 2026-07-17 17:37:28 -04:00
utilities Add server-side identity assertion (SEP-990 ID-JAG) (#4483) 2026-07-18 19:52:15 -04:00
__init__.py Update type handling for resources 2024-11-29 19:42:46 -05:00
conftest.py Migrate to MCP SDK v2.0.0b2 (httpx2) (#4503) 2026-07-18 15:12:47 -04:00
test_apps.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_apps_prefab.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_compat.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_exceptions.py Emit one SERVER span per request and adopt spec-correct error codes (#4445) 2026-07-07 07:49:06 -04:00
test_fastmcp_app.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_json_schema_generation.py fix: resolve Pyright "Module is not callable" on @tool, @resource, @prompt decorators (#3540) 2026-03-17 18:11:42 -04:00
test_mcp_config.py Stabilize upgraded ty checks (#4526) 2026-07-17 17:46:53 -04:00
test_no_legacy_httpx.py Migrate to MCP SDK v2.0.0b2 (httpx2) (#4503) 2026-07-18 15:12:47 -04:00
test_settings.py Forward-port HTTP host guard compatibility (#4474) 2026-07-08 20:55:56 -04:00