Commit graph

115 commits

Author SHA1 Message Date
Jeremiah Lowin
4963b516c2
Fix: resolve root-level $ref in outputSchema for MCP spec compliance (#2720) (#2727)
Co-authored-by: lif <1835304752@qq.com>
2025-12-25 08:53:52 -05:00
Chris Guidry
17520ec5d5 Add execution field to base Tool class
The base Tool class now has an optional `execution` field for storing
task execution metadata (SEP-1686). This lets gateways/proxies preserve
execution info when forwarding tools from backends - previously this
metadata was lost because Tool had no way to store it.

FunctionTool continues to derive execution from task_config as before.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 17:07:49 -05:00
Jeremiah Lowin
b291abb460 Fix inline snapshots for task_config rename 2025-12-06 21:05:11 -05:00
Jeremiah Lowin
a231ea4c3c Add TaskConfig for SEP-1686 execution modes
Expose the full MCP task execution modes (forbidden/optional/required)
via TaskConfig instead of just boolean task=True/False.
2025-12-06 21:01:11 -05:00
Jeremiah Lowin
0cf12fa30c
Add regression tests for functools.wraps + Context (#2524) (#2566)
Follow-up to PR #2563 which fixed the signature handling in
create_function_without_params. These tests ensure the fix
works end-to-end for all object types that support Context injection.
2025-12-06 12:32:39 -05:00
Chris Guidry
66aaf420c9
[2.14] SEP-1686 tasks (#2378)
* Implement MCP background tasks (SEP-1686) using Docket

Adds support for background task execution via the MCP task protocol,
powered by Docket for task queue management.

- Tools, resources, and prompts can be marked with `task=True` to run async
- Progress dependency for tracking task progress
- CurrentDocket and CurrentWorker dependencies for advanced use cases
- Client API with `.call_tool(..., task=True)` returns task handles
- Task status notifications via subscriptions
- CLI worker command for distributed task processing

Configuration via environment:
- FASTMCP_ENABLE_DOCKET=true
- FASTMCP_ENABLE_TASKS=true
- FASTMCP_DOCKET_URL=redis://... (or memory:// for single-process)

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

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

* Fix tasks example import (TaskStatusResponse → GetTaskResult)

The example was using a non-existent TaskStatusResponse type.
Updated to use mcp.types.GetTaskResult which is what the
on_status_change callback actually receives.

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

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

* Fix env var name in Docket error messages

The error messages referenced FASTMCP_EXPERIMENTAL_ENABLE_DOCKET but the
actual setting is FASTMCP_ENABLE_DOCKET.

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

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

* Remove deprecated code re-added from pre-#2329 branch

- Remove ExtendedEnvSettingsSource (FASTMCP_SERVER_ prefix support)
- Remove dependencies parameter from FastMCP.__init__

* Replace fakeredis git pin with PyPI release

* Remove redundant fakeredis dev dep (pulled via pydocket)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-12-04 20:10:35 -05:00
Jeremiah Lowin
fe2ec99cc0
Validate tool names at registration time (SEP-986) (#2540) 2025-12-03 20:12:06 -05:00
Jeremiah Lowin
f6635aa15b Fix type errors in oauth_proxy and test_auth_integration
- Add null checks for client_id before using in OAuthTransaction, AuthorizationCode, AccessToken, RefreshToken
- Add null check for redirect_uris before len() call
- Import AuthorizeError from mcp.server.auth.provider
2025-11-15 12:21:15 -05:00
Brandon Shar
c18782f02b
Add meta support to ToolResult (#2283)
* Add meta to ToolResult

* add this at the client level and test the full integration

* add example

* slipped through linting somehow

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-02 16:46:52 -05:00
Jeremiah Lowin
e036cba383
Add Pydantic-compatible input validation (#2073) 2025-10-14 11:49:30 -07:00
Jeremiah Lowin
1f11b5e641
Refactor mounting logic from managers to server (#2069) 2025-10-11 18:28:21 -04:00
William Easton
664b67d26f
Fix exclusion of content helpers if they are in a list 2025-10-03 15:02:26 -05:00
Jeremiah Lowin
a41600d838
Fix: Remove JSON schema title metadata while preserving parameters named 'title' (#1872) 2025-09-23 10:19:34 -04:00
William Easton
408415c174
Merge branch 'main' into content_block_handling 2025-09-07 10:17:41 -05:00
William Easton
fe4f31c2c7
Enable more type checking rules (#1775) 2025-09-07 11:11:44 -04:00
William Easton
64010ff276
Cleanup content conversion 2025-09-06 17:32:33 -05:00
William Easton
d7a74419b2
Preserve order in mixed text/image tool returns (#1704)
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-09-06 14:22:29 -04:00
William Easton
0114f0ad3c
PR Clean-up 2025-08-25 10:18:39 -05:00
William Easton
1a72bfa4a7
Merge branch 'main' into main 2025-08-25 10:06:59 -05:00
William Easton
94b1eb9d6e
feat: introduce inline snapshots (#1605)
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-25 10:08:55 -04:00
pldesch-chift
6575768d4d
Refactor TransformedTool
- Remove _find_referenced_defs method
- Update merging of defs in _merge_schema_with_precedence.
- Adjust tests in test_tool_transform.py to reflect these changes.
2025-08-25 09:33:16 +02:00
pldesch-chift
68f264ec01
Implement _find_referenced_defs method for schema reference resolution and enhance _merge_schema_with_precedence to prune unused $defs. Add comprehensive tests for new functionality in test_tool_transform.py. 2025-08-22 10:53:59 +02:00
Jeremiah Lowin
a302385361
fix: eliminate pytest warnings (#1559)
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2025-08-21 07:49:42 -04:00
Jeremiah Lowin
26969e80c3
Add mounted_components_raise_on_load_error setting for debugging (#1534)
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-18 13:42:33 -04:00
Jeremiah Lowin
1df4771909
Ensure transformed tools generate structured content (#1443) 2025-08-11 12:34:43 -04:00
Jeremiah Lowin
19a4dd85d4
Ensure resource + template names are properly prefixed when importing/mounting (#1423) 2025-08-08 21:29:07 -04:00
Jeremiah Lowin
3e53e62f24
Add meta support to tool transformation utilities (#1295) 2025-07-29 17:34:07 -04:00
Jeremiah Lowin
3fc2510110
Add meta parameter support to tools, resources, templates, and prompts decorators (#1294) 2025-07-29 17:16:05 -04:00
Muhammad Khalid
a63d44576b
Fix: prune hidden parameter defs (#1257) 2025-07-28 14:00:56 -04:00
William Easton
653fe0f89f
Log tool name on transform validation error (#1238) 2025-07-23 09:56:17 -04:00
Jeremiah Lowin
f950b8ca95
Support from __future__ import annotations (#1199) 2025-07-20 21:05:13 -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
nate nowack
0977d552ff
Fix tool output schema generation to respect Pydantic serialization aliases (#1148)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-15 07:08:56 -07:00
Jeremiah Lowin
9326cb91db Fix title field preservation in tool transformations
Add title parameter to Tool.from_tool() and TransformedTool.from_tool()
to properly inherit or override title field when transforming tools.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 09:53:49 -04:00
Jeremiah Lowin
0600834da4 Fix single-element list unwrapping in tool content
Single-element lists like [1] were being incorrectly unwrapped to "1"
in unstructured content while multi-element lists remained as lists.
This created inconsistent behavior where the structure was lost for
single items.

This fix ensures lists always preserve their structure in unstructured
content regardless of length, making behavior consistent and predictable.

Also removes pretty-printing from JSON serialization for more compact
output across tools, prompts, and resources.

Fixes #1064

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 12:07:16 -04:00
Jeremiah Lowin
7e983ce5b7 Fix static typing 2025-07-07 10:22:48 -04:00
William Easton
8cdce8d848
Keep json schema $defs on transform 2025-07-06 21:13:50 -05:00
Jeremiah Lowin
ef742d9400
Ensure multi-client configurations use new ProxyClient (#1045)
* Validate elicitation responses are dicts

* Ensure advanced MCP features are forwarded through proxy

* Use proxy client in tests
2025-07-05 11:57:03 -04:00
Jeremiah Lowin
228425e309
Avoid propagating logs (#1042)
* Avoid propagating logs

* Set up caplog for non-root loggers

* Update tests
2025-07-04 12:22:11 -04:00
Jeremiah Lowin
7e0a237945 Fix schema wrapping for non-object union types in output schemas 2025-06-30 14:12:40 -04:00
Jeremiah Lowin
7d3dcdca03 Add tests for title priority logic in tools
- Test that explicit title takes priority over annotations.title
- Test that annotations.title is used as fallback when no explicit title
- Ensures the improved to_mcp_tool logic works correctly
- Add proper type guards for annotations None checks

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 19:58:38 -04:00
Jeremiah Lowin
24deabf568 Add title field support to FastMCP components
- Add optional title field to FastMCPComponent base class
- Support title parameter in all component decorators (@tool, @resource, @prompt)
- Include title in MCP protocol serialization when provided
- Add get_display_name() method to prefer title over name for display
- Add comprehensive tests for title functionality

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-28 18:11:29 -04:00
Jeremiah Lowin
c412a63d4e Update docs 2025-06-27 22:38:55 -04:00
Jeremiah Lowin
5520102821 Update failing tests 2025-06-27 22:06:35 -04:00
Jeremiah Lowin
b3799e7a73 Update typing 2025-06-27 21:54:17 -04:00
Jeremiah Lowin
db24c85359 Update all tests 2025-06-27 21:41:37 -04:00
Jeremiah Lowin
a7eb2da273 Update output schema control 2025-06-27 20:17:10 -04:00
Jeremiah Lowin
ddb557ba30 Update for 'result' kwarg instead of 'value' 2025-06-27 15:44:46 -04:00
Jeremiah Lowin
d8dc28b9b2 Add structured content & update almost all tests 2025-06-27 15:40:52 -04:00
Jeremiah Lowin
1e29149d5f Merge branch 'main' into output-schema 2025-06-26 19:30:35 -04:00