Commit graph

82 commits

Author SHA1 Message Date
Jeremiah Lowin
07d89c4038
Add transform system for modifying components in provider chains (#2836)
* Consolidate tool transformation logic into TransformingProvider

Tool transformations were previously scattered across LocalProvider,
ProxyProvider, and MCPConfig. This consolidates all transformation
logic into TransformingProvider via with_transforms(tool_transforms={...}).

- Add tool_transforms parameter to TransformingProvider
- Add tool_transforms to Provider.with_transforms()
- Remove transformation storage from LocalProvider and ProxyProvider
- Remove add_tool_transformation() and remove_tool_transformation() from FastMCP
- Add tool_transforms parameter to factory methods (from_openapi, from_fastapi, create_proxy)
- Update tests to use new patterns

* Fix: reject tool lookups by pre-transform name

* Add collision validation for tool_transforms and fix docstring examples

- Validate duplicate target names in tool_transforms raise ValueError
- Fix docstring examples to use arguments/ArgTransformConfig (not args/ArgTransform)
- Add test for collision validation

* Add server-level tool transform APIs and fix task registration

- Add AggregateProvider to present multiple providers as one
- Add _get_root_provider() to apply server-level transforms uniformly
- Fix _docket_lifespan to use root provider (ensures renamed tools
  register with correct keys for background execution)
- Add tool_transforms kwarg to __init__ (non-deprecated)
- Add add_tool_transform(), remove_tool_transform(), tool_transforms property
- Deprecate old API names (tool_transformations, add_tool_transformation, etc.)
- Update tests to use new API

* Add graceful degradation for provider errors in AggregateProvider

* Match original behavior: parallel queries with DEBUG logging

* Refactor transforms to middleware-style call_next pattern

Replaces the ad-hoc transformation system with a unified Transform
abstraction using the same call_next pattern as server middleware.

Key changes:
- New src/fastmcp/server/transforms/ module with Transform base class
- Namespace, ToolTransform, Visibility all implement the same interface
- Transforms compose via functools.partial chain building
- Visibility is now just the first transform in provider._transforms
- Server-level transforms apply after provider aggregation
- Task registration now applies full transform chain

Removes TransformingProvider, _BoundTransform, ComponentSource protocol.
User-facing API unchanged: mount(), add_transform(), enable/disable all
work as before.

* Add comprehensive transforms and visibility documentation

New docs/servers/providers/transforms.mdx covering:
- Mental model for middleware-style transform pattern
- Built-in transforms (Namespace, ToolTransform)
- Server vs provider-level transforms and ordering
- Tool modification (immediate vs deferred)
- Custom transform creation

New docs/servers/visibility.mdx covering:
- Enable/disable API for runtime visibility control
- Keys and tags for targeting components
- Allowlist mode with only=True
- Server vs provider visibility layering

Updates existing docs to reference new pages and simplifies
redundant content. Visibility is documented as a user feature,
not as an implementation detail.

* Restructure transforms docs and delete tool-transformation pattern

* Cleanup: simplify get_tasks and remove unused Provider.get_component

* Update loq

* Update loq limits and add loq note to AGENTS.md

* Deprecate add_tool_transformation and tool_transformations param

* Address PR review feedback: remove redundant imports, fix path reference

* Add missing imports to code examples in v3-features.mdx
2026-01-12 22:11:16 -05:00
Jeremiah Lowin
1b723f302d
Decorators return functions instead of component objects (#2856) 2026-01-12 21:58:07 -05:00
Jeremiah Lowin
daa2dace2f
Add standalone decorators and eliminate fastmcp.fs module (#2832) 2026-01-10 12:16:35 -05:00
Jeremiah Lowin
42dcb8918d
Add --reload flag for auto-restart on file changes (#2816) 2026-01-09 08:44:27 -05:00
Shea Parkes
6ce967643e
Enhance documentation on tool transformation (#2781) 2025-12-29 14:30:34 -05:00
Jeremiah Lowin
1d17334803
Reorganize docs around provider architecture (#2723) 2025-12-25 09:00:20 -05:00
William Easton
8e0c6c8685
docs: clarify pytest-asyncio dependency and asyncio mode configuration (#2399)
* docs: clarify pytest-asyncio dependency and asyncio mode configuration

Added a Prerequisites section to the testing documentation explaining:
- pytest-asyncio is required for async test functions and fixtures
- Recommended configuration: asyncio_mode = 'auto' in pyproject.toml
- This eliminates need for @pytest.mark.asyncio decorators

Resolves #2372

Co-authored-by: William Easton <strawgate@users.noreply.github.com>

* feat: add testing_demo example with comprehensive test suite

Add a standalone example project demonstrating FastMCP testing patterns:
- Tools, resources, and prompts with full test coverage
- pytest-asyncio configuration in pyproject.toml
- 18 passing tests showing async fixtures, parametrized tests, and more
- Documentation explaining testing best practices

Co-authored-by: William Easton <strawgate@users.noreply.github.com>

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-11-15 10:34:29 -05:00
William Easton
2f13119684
Add Documentation for FastMCP Server Testing (#2244)
* Add doc with recommendations for server testing

* Updates to testing doc

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add to sidebar under patterns

* Update docs/patterns/testing.mdx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-24 19:11:21 -04:00
Andrew McLachlan
98fb0a6115
Fix missing import in Tool Transformation docs. (#2108) 2025-10-15 17:49:19 -07:00
Al Duncanson
c8603bfd3b
fix: wrong server name in explicit server entrypoint doc 2025-10-10 00:02:13 -04:00
Mark
b12886229f
Update tool-transformation.mdx (#2009) 2025-10-08 08:53:41 -04:00
William Easton
05dc0f4771
Add client method wrapping examples to Tool Transformation docs (#2002)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-10-04 19:51:01 -04:00
Jeremiah Lowin
f4ab2e8127
Enhance inspect command with structured output and format options (#1481) 2025-08-26 10:39:28 -04:00
Jeremiah Lowin
465e4033e7
Improve fastmcp.json environment configuration and project-based deployments (#1631) 2025-08-25 22:09:27 -04:00
Jeremiah Lowin
1f3f82d245
Implement typed source system for FastMCP configuration (#1607) 2025-08-24 16:32:37 -04:00
Jeremiah Lowin
2d3d5392f1
feat: introduce fastmcp.json configuration system (#1517) 2025-08-19 16:06:04 -04:00
Jeremiah Lowin
7beeb949a0
Update deployment docs (#1486) 2025-08-13 21:55:30 -04:00
Jeremiah Lowin
c6768dad5f
Add documentation for get_access_token() dependency function (#1446)
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2025-08-11 13:01:44 -04:00
Jeremiah Lowin
d52d6d8fff
Support factory functions in fastmcp run (#1384) 2025-08-06 13:12:52 -04:00
Osvald Nigola
85d04a2880
Fix typo in decorating-methods.mdx (#1344) 2025-08-03 09:45:10 -04:00
Jeremiah Lowin
b46d4934a8
Add comprehensive OAuth 2.1 authentication system with WorkOS integration (#1327) 2025-08-01 17:06:55 -04:00
Jeremiah Lowin
3e53e62f24
Add meta support to tool transformation utilities (#1295) 2025-07-29 17:34:07 -04:00
Adam Conway
36c6d698fa
Update --name flag (#1239) 2025-07-23 10:41:54 -04:00
Jeremiah Lowin
1ea3ee82fe
Merge pull request #1138 from strawgate/run-mcp-config 2025-07-19 21:18:40 -04:00
Jeremiah Lowin
a65bfd10be
Add --python, --project, and --with-requirements options to CLI commands (#1190) 2025-07-19 21:16:09 -04:00
Jeremiah Lowin
74518fb7b2 Add docs 2025-07-19 21:15:38 -04:00
William Easton
1b953820b3
[🐶] Transform MCP Server Tools (#1132)
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-07-19 15:52:47 -04:00
Jeremiah Lowin
ea54851736
Fix mcp-json output format to include server name (#1185)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-19 13:31:11 -04:00
David Ben Kalifa
15f01a01d8
feat: Add --path Option to CLI for HTTP/SSE Route (#1087)
* add path to cli

* update cli.mdx

* update test
2025-07-08 11:20:15 -04:00
Jeremiah Lowin
e67b597c69
Add --copy documentation (#1076) 2025-07-07 13:46:03 -04:00
Jeremiah Lowin
45c4ceb1bd
Update environment note (#1075)
* Update environment note

* Update memory.py
2025-07-07 13:44:19 -04:00
Jeremiah Lowin
f9a698dcf9
Add MCP json output from CLI (#1056) 2025-07-06 10:23:50 -04:00
Jeremiah Lowin
84f0229acc
Add Claude Code install integration (#1053)
* Add Cursor support

* Use url-safe encoding

* Add claude code integration

* Delete test_install_dependencies.py

* Fix windows tests
2025-07-05 21:23:47 -04:00
Jeremiah Lowin
e50f4ae965
Add Cursor support via CLI integration (#1052)
* Add Cursor support

* Use url-safe encoding
2025-07-05 20:30:47 -04:00
Jeremiah Lowin
232edc2b07 Update testing.mdx 2025-07-03 12:36:10 -04:00
Jeremiah Lowin
5ddb54bbd4 Clean up docs 2025-07-03 11:24:53 -04:00
Jeremiah Lowin
756e5c31e3 Reapply "Add CLI banner"
This reverts commit 41359ec99d.
2025-07-02 18:28:29 -04:00
Jeremiah Lowin
41359ec99d
Revert "Add CLI banner" 2025-07-02 00:53:20 -04:00
Jeremiah Lowin
3a528d86a3 Add CLI banner 2025-07-01 10:39:35 -04:00
Jeremiah Lowin
c412a63d4e Update docs 2025-06-27 22:38:55 -04:00
Jeremiah Lowin
ffe0c92d63 Alias streamable-http as http 2025-06-22 20:00:11 -04:00
Jeremiah Lowin
84d5750f6d Update cli.mdx
Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 20:08:29 -04:00
Jeremiah Lowin
dee2f33a81 Update doc icons 2025-06-19 17:28:00 -04:00
Jeremiah Lowin
233c4fb3fb Add docs 2025-06-10 11:06:31 -04:00
Jeremiah Lowin
fc2599144f Update docs 2025-06-09 20:44:13 -04:00
Jeremiah Lowin
f8854fb3fd Add documentation 2025-06-09 17:18:04 -04:00
Jeremiah Lowin
d64077b03b remove empty parens from prompt 2025-06-05 14:56:10 -04:00
Jeremiah Lowin
5a0f57498f remove empty parens from tool 2025-06-05 14:55:32 -04:00
Jeremiah Lowin
f495de6f3a Ensure methods work/are documented 2025-06-05 10:59:32 -04:00
Jeremiah Lowin
b3f80c5374 Add empty parens to docs 2025-06-04 17:39:57 -04:00