Commit graph

1,264 commits

Author SHA1 Message Date
William Easton
c6501c1060
Support running fastmcp directly with an MCPConfig 2025-07-13 15:19:57 -05:00
Jeremiah Lowin
7ce0a59ea6
Fix optional parameter validation in OpenAPI integration (#1135)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-13 10:23:56 -04: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
b853bb85f9 Expand empty parameter filtering and add tests
Builds on PR #1128 by adding comprehensive filtering at parameter selection stage and test coverage for empty arrays/dicts.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 09:25:05 -04:00
Jeremiah Lowin
767de312f9
Fix middleware list result types (#1125)
* Catch more openapi changes

* Simplify middleware list operations to use lists directly

- Updated middleware signatures to work with list[Tool], list[Resource], etc instead of wrapper objects
- Removed unnecessary ListToolsResult, ListResourcesResult wrapper types
- Updated documentation to show simpler list-based filtering pattern
- Added tests for list-based middleware filtering

Closes #1121

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 18:04:20 -04:00
Magnus
912bba2385
fix: replace oneOf with anyOf in OpenAPI schemas to handle overlapping unions (#1119)
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-07-11 13:31:45 -04:00
Jeremiah Lowin
ce1a85ceaf
xfail when github token is not set (#1123) 2025-07-11 12:55:45 -04:00
Jeremiah Lowin
b0f45a85c4
Fix OpenAPI deepObject style parameter encoding (#1122)
* Fix OpenAPI deepObject style parameter encoding

Add support for deepObject style with explode=true to properly serialize
object parameters using bracket notation (param[key]=value) instead of
JSON strings. Fixes #1114.

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

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

* Create README_OPENAPI.md

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-11 12:50:19 -04:00
Jeremiah Lowin
e55c360389
Update github remote server tests with secret (#1112)
* Adding client tests for streamable http against official GitHub Remote MCP server

* Apply suggestions from code review

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

* Update tests/client/test_github_mcp_remote.py

applying review suggestions

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

* Update github server tests and move to integration

* Set GITHUB_TOKEN variable

* Revert "Set GITHUB_TOKEN variable"

This reverts commit a87d6a303a.

---------

Co-authored-by: Didier Durand <didduran@amazon.ch>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Didier Durand <durand.didier@gmail.com>
2025-07-10 10:48:42 -04:00
Jeremiah Lowin
5d95ddd8c0 Fix OpenAPI parameter name collisions with location suffixing
Resolves parameter conflicts when same name appears in path/query/header
and request body by adding double underscore suffixes (id__path, id__query).
Body parameters keep original names for natural REST API patterns.

Closes #1100

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 18:49:00 -04:00
Jeremiah Lowin
f25bef7e21 Add mirrored component support for proxy servers
Prevents enable/disable operations on mirrored components (tools, resources, prompts retrieved from proxy servers). Users must create local copies with .copy() and add them to their server to modify them. Local components take precedence over mirrored ones.

Closes #1102

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-09 17:54:40 -04:00
Jeremiah Lowin
4f4d06ffdb
Ensure the CLI accepts "streamable-http" as a valid transport (#1099)
* Ensure the CLI accepts "streamable-http" as a valid transport

* Add test for transport aliases
2025-07-09 09:35:26 -04:00
Jeremiah Lowin
09fae7541e
Fix OpenAPI tool name registration when modified by mcp_component_fn (#1096)
Resolves issue where tools modified by mcp_component_fn were registered
with original names but accessible with modified names, causing "Unknown tool"
errors. Now tools are registered using their final modified names.

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-08 21:28:46 -04:00
Jeremiah Lowin
c452164e86
Fix concurrent proxy client operations with session isolation (#1083)
* Refactor Client session state with ClientSessionState dataclass

Fixes #1068 by introducing ClientSessionState to encapsulate session management
attributes, simplifying Client.new() and preventing concurrent proxy client
context mixing through client factory pattern.

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

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

* Update proxy documentation for new client factory pattern

Documents the new session management behavior, client_factory parameter,
and concurrent operation safety introduced in v2.10.3 to fix #1068.

* Remove deprecation of client parameter and update documentation

- Undeprecated FastMCPProxy client parameter
- Made client_factory the advanced option for custom control
- Added detailed explanation of how client factories work internally
- Removed outdated note about proxy feature limitations
- Removed fabricated Advanced Usage section

* Re-do proxy documentation

* Fix deprecated client parameter to provide session isolation

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-08 17:22:43 -04:00
Dimitri Barbot
f977e480ca
Fix max recursion error when pruning OpenAPI definitions (#1092)
* Fix max recursion error when pruning open api definitions

* Remove mutable default parameter in def_is_referenced function
2025-07-08 17:21:58 -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
6c9263001b
Add output schema support for OpenAPI tools (#1073)
* Add output schema support for OpenAPI tools

Implement automatic output schema extraction from OpenAPI responses for
FastMCP tools, addressing issue #1070. Tools generated from OpenAPI specs
now have meaningful output schemas instead of null, improving agent
efficiency when working with structured API responses.

- Add extract_output_schema_from_responses() function to parse response schemas
- Enhance OpenAPITool to accept and use output schemas with proper wrapping
- Automatically wrap non-object responses to comply with MCP requirements
- Include schema definitions and compress unused ones
- Add comprehensive test suite covering object, array, and primitive responses
- Update existing tests to handle structured output with proper typing
- Maintain backward compatibility for specs without response schemas

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

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

* Move output schema tests to dedicated test file

Reorganize output schema tests into test_openapi_output_schemas.py to keep
the main test_openapi.py file focused and smaller, as requested. Added two
additional tests for schema definitions handling.

- Move all extract_output_schema_from_responses() tests to new file
- Add tests for schema definitions inclusion
- Remove output schema imports from main test file

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-07 12:51:01 -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
fe7155b675
Merge pull request #1071 from jlowin/version-copy
Ensure fastmcp version copy is plaintext
2025-07-07 11:14:40 -04:00
Jeremiah Lowin
7efecafbb7 Update test_cli.py 2025-07-07 10:46:59 -04:00
Jeremiah Lowin
4dcc757aa6 Ensure fastmcp version copy is plaintext 2025-07-07 10:31:17 -04:00
Jeremiah Lowin
d0278efa98
Merge pull request #1066 from strawgate/keep-defs-on-transform
Keep json schema $defs on transform
2025-07-07 10:26:43 -04:00
Jeremiah Lowin
7e983ce5b7 Fix static typing 2025-07-07 10:22:48 -04:00
Jeremiah Lowin
6b38fbc8bc Fix duplicate test 2025-07-07 10:13:57 -04:00
Jeremiah Lowin
f6fe3f5785
Merge branch 'main' into copy-flag 2025-07-07 10:09:10 -04:00
Jeremiah Lowin
3c75db5237 Reduce mocks 2025-07-07 09:59:49 -04:00
Jeremiah Lowin
7b90ea4cb5 Ensure test is platform agnostic 2025-07-07 09:51:12 -04:00
Jeremiah Lowin
c1aad2aa23 Remove heavily mocked tests 2025-07-07 09:48:36 -04:00
William Easton
8cdce8d848
Keep json schema $defs on transform 2025-07-06 21:13:50 -05:00
Jeremiah Lowin
15a50dda50 Remove asyncio.run 2025-07-06 21:15:47 -04:00
Jeremiah Lowin
96194bd40f Remove asyncio mark 2025-07-06 21:14:30 -04:00
Jeremiah Lowin
e9fa9fcf0d Add --copy flag for fastmcp version 2025-07-06 21:10:45 -04:00
Jeremiah Lowin
96cc3188de Add more tests 2025-07-06 21:04:18 -04:00
Jeremiah Lowin
6694d9a19a Add tests 2025-07-06 20:50:31 -04:00
Jeremiah Lowin
919d7e35ef Refactor from typer to cyclopts 2025-07-06 20:37:35 -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
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
hopeful0
f7dfd5be9c
Proxy support advanced MCP features (#1022)
* Proxy support advanced MCP features

* Optimize ProxyClient testing

* Add documentation for ProxyClient
2025-07-04 12:21:57 -04:00
Jeremiah Lowin
e182231fc8
Add path expansion to image/audio/file (#1038)
* Add path expansion to image/audio/file

* Make path tests platform agnostic
2025-07-04 09:51:30 -04:00
Jeremiah Lowin
61c191b920 Update test_openapi_compatibility.py 2025-07-03 21:09:27 -04:00
Jeremiah Lowin
68c355d740 Fix test to properly expect ValidationError with pytest.raises 2025-07-03 21:05:56 -04:00
Jeremiah Lowin
23d7337a97 Add comprehensive OpenAPI 3.0 vs 3.1 compatibility tests
Adds test coverage for specific differences between OpenAPI 3.0 and 3.1 that can cause validation issues, including the scenario reported in GitHub issue #1021.

Test coverage includes:
- OpenAPI 3.0 boolean exclusiveMaximum format vs 3.1 numeric format
- OpenAPI 3.0 nullable vs 3.1 type array format
- Complex schemas with $defs and multiple exclusive constraints
- Edge cases with both exclusiveMaximum and exclusiveMinimum

These tests serve as regression prevention and document expected behavior for both OpenAPI versions.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03 20:55:32 -04:00
Jeremiah Lowin
54276a589d
Merge pull request #1033 from jlowin/claude-wt-20250703-195810
Support 'scp' claim for OAuth scopes in BearerAuthProvider
2025-07-03 20:37:29 -04:00
Jeremiah Lowin
f052ae2d6a Split giant test file into smaller files 2025-07-03 20:31:03 -04:00
Jeremiah Lowin
63f3940c6f Support 'scp' claim for OAuth scopes in BearerAuthProvider
Some Identity Providers use 'scp' claim instead of the standard 'scope' claim for OAuth scopes. This change updates the scope extraction logic to support both claims, with 'scope' taking precedence when both are present.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03 20:18:54 -04:00
Jeremiah Lowin
cfd4ab7969
Merge pull request #1018 from jlowin/stateless-arg
Expose stateless_http kwarg for mcp.run()
2025-07-03 19:57:52 -04:00
Jeremiah Lowin
a52c28c319 Ensure tests use stateless mode 2025-07-03 19:55:49 -04:00