fastmcp/tests/client
Jeremiah Lowin f038cf3be7
Add machine-to-machine client authentication (#4583)
* Add M2M client credentials auth providers

Wrap the SDK's client_credentials and private_key_jwt OAuth providers as
FastMCP-idiomatic ClientCredentialsOAuthProvider and PrivateKeyJWTOAuthProvider,
enabling browser-free client authentication via Client(auth=...).

* Fix M2M token cache collision and explicit-scope drop

Namespace the token cache by client_id so distinct clients sharing one store don't overwrite each other's tokens; pin caller-supplied scopes so the token request keeps them; fix CodeQL URL-substring check in tests; drop unused logger.

* Preserve step-up scope union, scope-aware token cache, restore token expiry

Only pin the caller's explicit scopes on initial authorization, leaving the SDK's step-up scope union intact; namespace the token cache by requested scopes as well as client_id; restore persisted absolute expiry on init so an expired stored token is re-fetched.

* Skip expiry restore for non-expiring reloaded tokens

* Distinguish expires_in=0 from omitted when restoring expiry

* Scope step-up flag to the flow via ContextVar; runnable JWT signing example
2026-07-21 12:27:08 -04:00
..
auth Add machine-to-machine client authentication (#4583) 2026-07-21 12:27:08 -04:00
client Unpin tests whose defects #4579 fixed 2026-07-20 18:02:21 -04:00
sampling Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
tasks Merge remote-tracking branch 'origin/main' into feature/client-auto-default 2026-07-20 12:02:38 -04:00
telemetry Merge remote-tracking branch 'origin/main' into feature/client-auto-default 2026-07-20 12:02:38 -04:00
transports Default fastmcp.Client to mode="auto"; surface extensions=/result_claims= 2026-07-19 21:22:49 -04:00
__init__.py clean up test inits 2025-05-31 19:32:08 -04:00
minimal_stdio_server.py Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
test_client_extensions.py Merge remote-tracking branch 'origin/main' into feature/client-auto-default 2026-07-20 12:02:38 -04:00
test_elicitation.py Audit tests/client/ mode="legacy" pins 2026-07-20 15:43:04 -04:00
test_elicitation_enums.py Default fastmcp.Client to mode="auto"; surface extensions=/result_claims= 2026-07-19 21:22:49 -04:00
test_logs.py Audit tests/client/ mode="legacy" pins 2026-07-20 15:43:04 -04:00
test_notifications.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_oauth_callback_race.py Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
test_oauth_callback_xss.py Escape all HTML to prevent XSS attack (#2090) 2025-10-14 12:30:21 -07:00
test_openapi.py Audit tests/client/ mode="legacy" pins 2026-07-20 15:43:04 -04:00
test_progress.py Guard default progress handler against zero totals (#3432) 2026-03-07 11:41:11 -05:00
test_roots.py Default fastmcp.Client to mode="auto"; surface extensions=/result_claims= 2026-07-19 21:22:49 -04:00
test_sampling.py Default fastmcp.Client to mode="auto"; surface extensions=/result_claims= 2026-07-19 21:22:49 -04:00
test_sampling_result_types.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_sampling_tool_loop.py Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
test_slim_package_boundaries.py Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
test_sse.py Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
test_stdio.py Restore upgraded dependency checks (#4576) 2026-07-20 18:46:30 -04:00
test_streamable_http.py Audit tests/client/ mode="legacy" pins 2026-07-20 15:43:04 -04:00