fastmcp/tests
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
..
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 Add machine-to-machine client authentication (#4583) 2026-07-21 12:27:08 -04:00
conformance Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
contrib Speed up the unit test suite, and fix the task-notification race it surfaced (#4550) 2026-07-19 18:52:04 -04:00
deprecated Audit mode="legacy" pins in server tests and top-level stragglers 2026-07-20 16:00:27 -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 Merge remote-tracking branch 'origin/main' into feature/client-auto-default 2026-07-20 12:02:38 -04:00
prompts Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
resources Make the unit suite fast: in-process HTTP tests, no real sleeps, parallel Windows CI (#4554) 2026-07-20 10:51:14 -04:00
scripts Exempt maintainers from MRE auto-close (#4220) 2026-05-23 09:02:44 -04:00
server Let a server answer argument-completion requests (#4582) 2026-07-21 12:26:24 -04:00
telemetry Preserve telemetry attributes when a sampler does not forward them (#4539) 2026-07-19 09:00:04 -04:00
tools Audit mode="legacy" pins in server tests and top-level stragglers 2026-07-20 16:00:27 -04:00
utilities Restore upgraded dependency checks (#4576) 2026-07-20 18:46:30 -04:00
__init__.py Update type handling for resources 2024-11-29 19:42:46 -05:00
conftest.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_apps.py Audit mode="legacy" pins in server tests and top-level stragglers 2026-07-20 16:00:27 -04:00
test_apps_prefab.py Migrate to MCP Python SDK v2 (#4437) 2026-07-06 17:36:45 -04:00
test_compat.py Audit mode="legacy" pins in server tests and top-level stragglers 2026-07-20 16:00:27 -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 Mark transforming single-server config wrapper legacy-only 2026-07-20 16:34:42 -04:00
test_no_legacy_httpx.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_settings.py Forward-port HTTP host guard compatibility (#4474) 2026-07-08 20:55:56 -04:00