Commit graph

1,042 commits

Author SHA1 Message Date
Jeremiah Lowin
0e4d519c86
Rename Enabled transform to Visibility (#2950) 2026-01-19 20:46:58 -05:00
Jeremiah Lowin
ba18a716bf
Add client utilities for downloading skills (#2948) 2026-01-19 20:10:39 -05:00
Jeremiah Lowin
16ffc9432f
Add Skills Provider for exposing agent skills as MCP resources (#2944) 2026-01-19 18:29:16 -05:00
Jeremiah Lowin
c0ef90e713
Add PromptsAsTools transform (#2946) 2026-01-19 18:19:53 -05:00
Jeremiah Lowin
d3327269d7
Add ResourcesAsTools transform (#2943) 2026-01-19 17:40:31 -05:00
Jeremiah Lowin
4d2feb0c29
Refactor transform list methods to pure function pattern (#2942) 2026-01-19 16:21:35 -05:00
Jeremiah Lowin
23bfdf0680
Consolidate test fixtures and refactor large test files (#2941) 2026-01-19 15:18:35 -05:00
Jeremiah Lowin
e376bfcfb2
Refactor server.py into mixins (#2939) 2026-01-19 11:36:00 -05:00
Jeremiah Lowin
c99e0c6351
Refactor OAuthProxy into focused modules (#2935) 2026-01-19 10:10:07 -05:00
Jeremiah Lowin
352ff82eab
Refactor Client class into mixins and add timeout utilities (#2933) 2026-01-19 09:54:47 -05:00
Jeremiah Lowin
71d6f49e14
Bump dependencies (#2931) 2026-01-19 08:38:48 -05:00
Jeremiah Lowin
b25ac3f5fa
Move session visibility logic to enabled.py (#2924) 2026-01-19 08:29:23 -05:00
Jeremiah Lowin
d8ab493664
Add session-specific visibility control via Context (#2917) 2026-01-18 22:31:06 -05:00
Jeremiah Lowin
c3111a8978
Unify discovery API: deduplicate at protocol layer only (#2919) 2026-01-18 21:01:53 -05:00
Jeremiah Lowin
ed0587d683
Immutable transform wrapping for providers (#2913) 2026-01-18 19:37:29 -05:00
Jeremiah Lowin
f603fe094a Remove sync notification infrastructure
Remove send_notification_sync() method, notification queue, and background flusher task. Component add/remove operations happen outside sessions and no longer need notifications.
2026-01-18 17:31:11 -05:00
Jeremiah Lowin
510738b52e Support VersionSpec in enable/disable for range-based filtering
Change version parameter from str to VersionSpec in enable()/disable()
to support range-based version filtering.

- Add match_none parameter to VersionSpec.matches() for controlling
  whether unversioned components match (defaults to True for backward
  compatibility, False for enable/disable filtering)
- Update Enabled transform to use VersionSpec and call matches() with
  match_none=False so unversioned components don't match version specs
- Update enable()/disable() signatures to accept VersionSpec
- Add comprehensive tests for version range matching

Examples:
- disable(version=VersionSpec(eq="v2")) - disable only v2
- disable(version=VersionSpec(gte="v2")) - disable v2 and later
- disable(version=VersionSpec(gte="v1", lt="v3")) - disable v1, v2
2026-01-18 16:00:05 -05:00
Jeremiah Lowin
c4f506b097 Update test_local_provider.py 2026-01-18 15:01:51 -05:00
Jeremiah Lowin
84d7d3b281 Support plural names/keys in enable/disable API
Change enable() and disable() to accept sets: names, keys, tags.
Use key-based disable for decorator enabled=False to scope exactly.
2026-01-18 14:58:29 -05:00
Jeremiah Lowin
50ba6ea5a4 Refactor visibility to mark-based enabled system
Rename Visibility to Enabled, collapse VisibilityRule into the transform,
and move enabled filtering from Provider to Server level so server-level
transforms can override provider-level disables.
2026-01-18 14:36:33 -05:00
Jeremiah Lowin
17d43d7991 Address review feedback: validation and edge cases 2026-01-17 19:50:33 -05:00
Jeremiah Lowin
dada8893a9 Add MCP-compliant pagination for list operations
Server authors opt-in by setting list_page_size on FastMCP.
Client convenience methods auto-fetch all pages transparently.
Use _mcp methods with cursor parameter for manual pagination.
2026-01-17 19:30:24 -05:00
Jeremiah Lowin
de1bf9864a fix: update remaining test to use get_prompt 2026-01-17 14:46:58 -05:00
Jeremiah Lowin
850f0a0050 fix: update all tests to use get_prompt instead of _get_prompt 2026-01-17 14:46:21 -05:00
Jeremiah Lowin
2c9cae9a98 refactor: reverse visibility for get_prompt/_get_prompt methods 2026-01-17 14:42:45 -05:00
Jeremiah Lowin
b9e32ca6a6 refactor: reverse visibility for list_resource_templates/_list_resource_templates methods 2026-01-17 14:41:08 -05:00
Jeremiah Lowin
61d98b41d1 refactor: reverse visibility for get_resource/_get_resource methods 2026-01-17 14:40:16 -05:00
Jeremiah Lowin
d6a334257c refactor: reverse visibility for list_resources/_list_resources methods 2026-01-17 14:39:41 -05:00
Jeremiah Lowin
b13e1c7caf refactor: reverse visibility for get_tool/_get_tool methods 2026-01-17 14:38:07 -05:00
Jeremiah Lowin
5fe471dc60 refactor: reverse visibility for list_tools/_list_tools methods 2026-01-17 14:32:53 -05:00
Jeremiah Lowin
3d98862995 Fix auth test to expect None instead of AuthorizationError 2026-01-17 14:25:29 -05:00
Jeremiah Lowin
78ab933dc5 Fix transform application in FastMCPProvider and MCP handlers
FastMCPProvider now calls _get_* methods instead of get_* to ensure
nested server transforms are applied during lookups. Also converts
string versions to VersionSpec in MCP handlers.
2026-01-17 12:37:37 -05:00
Jeremiah Lowin
5b24ea393d Refactor FastMCP to use inherited _get_* methods from Provider
- get_*() now does aggregation + component auth (raises AuthorizationError)
- Deleted _get_*() overrides - inherited from Provider applies transforms
- Simplified AuthMiddleware to global auth only
- Changed version params to VersionSpec | None (not str | None)
- Updated tests to use _get_*() where visibility filtering is expected
2026-01-17 12:15:01 -05:00
Jeremiah Lowin
5ade5a4838 Simplify Provider transform architecture
Replace _get_all_transforms() with a .transforms property that returns
[*self._transforms, self._visibility]. This cleanly separates user transforms
from visibility filtering while keeping visibility applied last (outermost).

Also:
- AuthMiddleware now uses get_* instead of _get_* for proper component auth
- Remove redundant _is_component_enabled checks (visibility is a transform)
- Delete dead code (get_component method)
- Add versions field to FastMCPMeta
- Replace asserts with NotFoundError in component_service
2026-01-17 11:35:47 -05:00
Jeremiah Lowin
ddd2058f97 Merge remote-tracking branch 'origin/main' into refactor-provider-inheritance-v2
# Conflicts:
#	src/fastmcp/server/server.py
2026-01-17 08:41:58 -05:00
Jeremiah Lowin
33c371cb37
Add version discovery and calling a certain version for components (#2897) 2026-01-17 08:27:39 -05:00
Jeremiah Lowin
6ba5e5d194 Fix type errors and add type ignore comments
- Add None checks in auth and tool transform tests
- Add assertions in component_service.py for None returns
- Add type ignore comments for max() with version_sort_key
2026-01-17 07:23:29 -05:00
Jeremiah Lowin
d3ae0ed450 Fix transform application and update tests for None return values
- Override _get_tool/resource/template/prompt in FastMCP to apply
  server transforms over provider aggregation
- Update FastMCPProvider get_* methods to check for None (not
  NotFoundError since get_* now returns None)
- Update versioning tests to expect None instead of NotFoundError
  when requesting filtered/nonexistent versions
2026-01-16 22:21:40 -05:00
Jeremiah Lowin
66d713b367 Merge main into refactor-provider-inheritance-v2
Resolved conflicts to combine Provider inheritance refactor with versioning feature:
- FastMCP now properly inherits from Provider
- get_tool/resource/template/prompt return None instead of raising NotFoundError
- Deduplication uses version_sort_key to keep highest version per name/URI
- _source_* methods eliminated in favor of inherited _* methods
2026-01-16 22:13:29 -05:00
Jeremiah Lowin
53e220a99e
Rename _fastmcp metadata namespace to fastmcp and make non-optional (#2895) 2026-01-16 21:35:53 -05:00
Jeremiah Lowin
a6cd764b5f
Add component versioning and VersionFilter transform (#2894) 2026-01-16 20:53:18 -05:00
Bill Easton
81cbb9bee2
Add enable_rich_logging setting to disable rich formatting (#2893)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Bill Easton <strawgate@users.noreply.github.com>
2026-01-16 20:29:29 -05:00
Jeremiah Lowin
85f32959b1 Refactor FastMCP to inherit from Provider
FastMCP now properly inherits from Provider, eliminating ~200 lines of
duplicated _source_* methods. Key changes:

- get_tool/resource/prompt return None instead of raising NotFoundError
- Visibility filter separated from transforms (applied last)
- Nested server middleware runs on both list and execution operations
- Resource auth failure doesn't fall back to templates
- AggregateProvider kept as user-facing utility class
2026-01-16 16:50:56 -05:00
Jeremiah Lowin
c8c84ff911
Add session-scoped state persistence (#2873) 2026-01-16 14:11:21 -05:00
Marcus Shu
083999ca14
Add client_secret_post authentication to IntrospectionTokenVerifier (#2884) 2026-01-16 13:07:33 -05:00
Chris Guidry
eaf2906916 Adopt OpenTelemetry MCP semantic conventions
Updates FastMCP's telemetry to align with the new MCP semantic conventions
from open-telemetry/semantic-conventions#2083. This gives us interoperability
with other MCP implementations while keeping fastmcp.* attributes for things
unique to our framework.

Changes:
- Span names now follow `{method} {target}` format (e.g., `tools/call greet`)
- Added `mcp.method.name` and `mcp.resource.uri` attributes
- Renamed `fastmcp.session.id` to standard `mcp.session.id`
- Kept fastmcp.* attributes for server name, component info, provider details

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 14:08:15 -05:00
Chris Guidry
e19cc17cbe Add tests for session ID capture on telemetry spans
Validates that session_id is captured on both client and server
spans when using HTTP transport, and that they share the same ID.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 10:01:57 -05:00
Chris Guidry
07b056b0ab Address CodeRabbit feedback
- Fix potential None session_id in span attributes
- Add return type annotation to _get_parent_trace_context
- Fix type checker issue with ClientFactoryT await pattern

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:55:11 -05:00
Chris Guidry
ad660c0c43 Address Jeremiah's telemetry feedback
A few improvements based on code review:

- Don't override existing trace context in `extract_trace_context` - if we're
  already in a valid trace (e.g., from HTTP propagation), preserve it rather
  than extracting from MCP meta
- Add exception recording to `delegate_span` to match `server_span` pattern
- Remove unused `get_meter` function (metrics not implemented yet)
- Return `None` instead of `{}` from `inject_trace_context` when nothing to inject
- Clean up trivial tests that were just testing OpenTelemetry's own API

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:45:41 -05:00
Chris Guidry
0d513d76b0 Fix test_multi_client_with_logging to filter OpenTelemetry logs
The test was checking caplog.records length but OpenTelemetry emits
internal warning logs that were getting captured. Filter to only the
test's logger to avoid flaky failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 09:45:41 -05:00