Commit graph

28 commits

Author SHA1 Message Date
Jeremiah Lowin
270783e614
reverse CLAUDE.md/AGENTS.md symlink direction (#3294) 2026-02-25 11:18:59 -05:00
Jeremiah Lowin
59bb0a3ce7
Fix link to loq repository in AGENTS.md (#3289) 2026-02-24 19:45:56 -05:00
Jeremiah Lowin
d85cfb84e1
Revert to long-lived PR approach for auto-generated docs/schema (#3272)
🤖 Generated with Claude Code

https://claude.ai/code/session_01LUn4EnV6nZS5UgFz9wtyB3

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-22 11:13:06 -05:00
Jeremiah Lowin
27be9fe229
Exclude auto-generated python-sdk docs from CodeRabbit reviews (#3206)
* Exclude auto-generated python-sdk docs from CodeRabbit reviews

* Clarify that python-sdk doc changes in PR diffs are expected
2026-02-17 18:28:20 -05:00
Jeremiah Lowin
50b23299f8
Support async auth checks (#3152)
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2026-02-11 12:48:51 -05:00
Jeremiah Lowin
b13e1c7caf refactor: reverse visibility for get_tool/_get_tool methods 2026-01-17 14:38:07 -05:00
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
16cd343ec5
Add agent skills for testing and code review (#2846) 2026-01-12 11:24:39 -05:00
Jeremiah Lowin
9d8a608c37
Add documentation check to required PR workflow (#2730) 2025-12-25 10:52:37 -05:00
Jeremiah Lowin
049bd22827
Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665)
* Replace type: ignore[attr-defined] with isinstance assertions in tests

* Fix isinstance assertions in failing tests

- Fix enum test to check for ResponseEnum instead of str
- Fix binary resource test to check for BlobResourceContents instead of TextResourceContents
- Fix Root type tests to check attributes directly instead of isinstance checks

* Fix type errors without using type: ignore

- Remove execution methods from TransformingProvider (only handles transformations)
- Add execution methods to base Provider class with default implementations
- Fix type narrowing in tests using cast() instead of type: ignore
- Fix PromptResult type handling in prompt render tests
- Fix type narrowing in middleware test for arguments and structured_content
2025-12-21 16:37:20 -05:00
Jeremiah Lowin
0e5a8fed6c
feat: Provider abstraction for dynamic MCP components (#2622)
* feat: add Provider abstraction for dynamic components

Introduces a `Provider` base class that allows dynamic provision of
tools, resources, and prompts at runtime. Providers are queried after
static components, enabling database-backed tools, external integrations,
and other dynamic component sources.

```python
from fastmcp import FastMCP, Provider

class DatabaseProvider(Provider):
    async def list_tools(self, context):
        return await db.fetch_tools()

mcp = FastMCP("Server", providers=[DatabaseProvider()])
```

* Add execution methods to Provider interface

Enable providers to customize how components are executed, not just listed.
This unlocks MountedProvider (future) invoking wrapped server middleware.

- call_tool, read_resource, read_resource_template, render_prompt
- Server uses provider execution methods after filter checks
- Default implementations delegate to component methods

* Apply unified error handling to provider execution

- Document error semantics: list_* gracefully degrades, execution propagates
- Wrap provider call_tool/read_resource/render_prompt with masking logic
- ToolError/ResourceError/PromptError pass through, others wrapped
2025-12-16 22:05:43 -05:00
Jeremiah Lowin
8abd84bf1e
Revert "Revert "Refactor prompt behavior and add meta support (#2600)" (#2608)" (#2610)
This reverts commit f9e29cf58e.
2025-12-14 21:52:20 -05:00
Jeremiah Lowin
f9e29cf58e
Revert "Refactor prompt behavior and add meta support (#2600)" (#2608)
This reverts commit edb9d5ab65.
2025-12-13 14:57:50 -05:00
Jeremiah Lowin
edb9d5ab65
Refactor prompt behavior and add meta support (#2600)
* feat: add PromptResult as canonical internal type for prompts

Applies the same pattern as ResourceContent to prompts. PromptResult
wraps messages with description and meta. Public render() can return
either list[PromptMessage] or PromptResult (backwards compatible),
while private _render() always returns PromptResult.

* docs: fix incorrect PromptResult return type in example

* feat: add PromptResult canonical type with meta support

* fix: address PR #2600 review comments

Fixes test failures and code quality issues identified in PR review:

- Update 3 tests in test_server_interactions.py to access PromptResult.messages[0] instead of indexing directly
- Fix ProxyPromptManager to preserve meta field when converting GetPromptResult to PromptResult
- Fix ProxyPrompt.render() to return PromptResult instead of deprecated list[PromptMessage], preventing fastmcp tags from leaking into runtime meta
- Fix mask_error_details initialization to respect explicit False values
- Fix exception re-raising to preserve tracebacks (use bare raise instead of raise e)
- Update testing documentation to use pytest -n auto for parallel execution
2025-12-13 12:08:41 -05:00
Jeremiah Lowin
9cade6c8c8
Fix RFC 8414 path-aware authorization server metadata discovery (#2533)
* Fix RFC 8414 path-aware authorization server metadata discovery

Override get_well_known_routes() in OAuthProvider to rewrite the
authorization server metadata route to be path-aware based on issuer_url,
matching how protected resource metadata already works.

Closes #2527

* Update readme
2025-12-03 19:16:59 -05:00
Jeremiah Lowin
b501f05794
Switch to new OpenAPI parser as default (#2513)
* Switch to new OpenAPI parser as default

Remove the legacy OpenAPI parser and make the experimental parser the
default. The experimental parser (introduced in 2.11) offers better
performance, improved compatibility, and a more maintainable architecture.

- Delete legacy parser (server/openapi.py, utilities/openapi.py)
- Move experimental parser to main locations
- Remove enable_new_openapi_parser feature flag
- Update documentation to remove experimental references

* Add deprecation stubs for experimental OpenAPI imports

* Add deprecated enable_new_openapi_parser setting and deprecation tests

* SDK docs

* REview comments

* Fix docstrings

* Update docstring

* Review comments

* Fix broken links
2025-12-01 20:29:18 -05:00
nate nowack
aba7d762de
switch from pre-commit to prek (#2309)
* switch from pre-commit to prek

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix prek tools list in contributing.mdx - include prettier, not pytest

* Use prek-action for caching

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-02 17:08:36 -05:00
William Easton
c002bc389c
Small Clean-up (#2247)
* Project Clean-up

* Move pytest-asyncio to dev dependencies and update agents.md
2025-10-24 19:11:01 -04:00
Jeremiah Lowin
d4cc1fbf10
Add log level support for stdio and HTTP transports (#1840) 2025-09-19 13:46:30 -04:00
William Easton
84eea7c708
Automatically Create inline Snapshots (#1779)
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-09-19 13:35:58 -04:00
Jeremiah Lowin
c5c6a3ee06
Add development docs for FastMCP (#1719)
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-09-03 11:34:43 -04:00
nate nowack
77b425c47d
switch from pyright to ty (#1545) 2025-08-19 17:22:52 -04:00
Jeremiah Lowin
927ea433d9
Add code review guidelines for agents (#1520)
Co-authored-by: William Easton <strawgate@users.noreply.github.com>
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2025-08-16 16:15:46 -04:00
Jeremiah Lowin
2946041152
Update AGENTS.md (#1471) 2025-08-12 12:55:19 -04:00
Jeremiah Lowin
3730b7e106
Update agents.md; add github instructinos (#1410) 2025-08-08 13:33:23 -04:00
Jeremiah Lowin
bfc8efdf31
Consolidate agent instructions into AGENTS.md (#1404) 2025-08-08 11:55:06 -04:00
Jeremiah Lowin
a8c46b8efb Update AGENTS.md 2025-05-17 20:06:43 -04:00
Jeremiah Lowin
4978faefa5 Update AGENTS with repo overview 2025-05-17 19:18:37 -04:00