Commit graph

47 commits

Author SHA1 Message Date
Jeremiah Lowin
4a9f02c87c
Upgrade to MCP 1.17+ with RFC 9728 compliance (#2122)
* Upgrade to MCP 1.17+ with RFC 9728 compliance

Updates FastMCP to require MCP 1.17+ and implements RFC 9728-compliant
OAuth protected resource metadata URL handling.

The key change is that .well-known/oauth-protected-resource endpoints
are now registered at path-aware locations. For example, if an MCP
server is mounted at /mcp, the metadata endpoint is now at
/.well-known/oauth-protected-resource/mcp instead of
/.well-known/oauth-protected-resource.

This ensures proper OAuth discovery for path-based resource servers
and aligns with the MCP SDK's implementation of RFC 9728 §3.1.

Changes include:
- Update minimum MCP version from 1.12.4 to 1.17.0
- Use build_resource_metadata_url() for RFC 9728 compliance
- Configure CI to test with latest package versions (--upgrade)
- Update tests for path-aware metadata URLs
- Add icons field to Tool model (introduced in MCP 1.17)

* Fix RemoteAuthProvider integration tests for RFC 9728

* Fix parameterized test for nested base URL paths
2025-10-17 09:29:23 -04:00
Jeremiah Lowin
1f11b5e641
Refactor mounting logic from managers to server (#2069) 2025-10-11 18:28:21 -04:00
Jeremiah Lowin
91af3cd2ae
Internal refactor of MCP handlers (#2005) 2025-10-05 08:45:10 -04:00
William Easton
fe4f31c2c7
Enable more type checking rules (#1775) 2025-09-07 11:11:44 -04:00
Jeremiah Lowin
0691701951
Add _fastmcp meta namespace (#1290) 2025-07-29 15:07:53 -04:00
Jeremiah Lowin
337cd41f5f Sort tags for deterministic output 2025-07-28 18:11:32 -04:00
Jeremiah Lowin
eda798fa0a Note that OpenAPI components automatically load tags 2025-07-28 18:06:24 -04:00
Jeremiah Lowin
4a38784194
Introduce experimental OpenAPI parser with improved performance and maintainability (#1209) 2025-07-21 16:17:36 -04:00
Martin Melka
3543c13ca9
Fix nesting when making OpenAPI arrays and objects optional (#1178) 2025-07-18 08:26:42 -04: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
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
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
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
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
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
96194bd40f Remove asyncio mark 2025-07-06 21:14: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
f052ae2d6a Split giant test file into smaller files 2025-07-03 20:31:03 -04:00
Jeremiah Lowin
f14be9ab77 Fix OpenAPI array parameter explode handling 2025-07-01 19:06:35 -04:00
Jeremiah Lowin
d8dc28b9b2 Add structured content & update almost all tests 2025-06-27 15:40:52 -04:00
Jeremiah Lowin
78f0196db5 Fix OpenAPI tests 2025-06-26 18:21:52 -04:00
Jeremiah Lowin
68ab760240 Merge branch 'main' into protocol-update 2025-06-26 09:25:39 -04:00
Jeremiah Lowin
e68fa0653b Use proper isinstance(Enum) check instead of hasattr
Replace hasattr(param_in, 'value') with isinstance(param_in, Enum)
for more robust enum detection as suggested in review.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 21:00:39 -04:00
Jeremiah Lowin
f566e9a60f Fix parameter location enum handling in OpenAPI parser
Fixes issue where ParameterLocation enum values from openapi_pydantic
were not properly converted to strings, causing validation errors.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 20:38:00 -04:00
Jeremiah Lowin
02b2ec1adf Update types and tests for upcoming SDK release 2025-06-20 09:56:21 -04:00
Jeremiah Lowin
725c061d66 Fix import prefix behavior 2025-06-19 15:19:31 -04:00
Jeremiah Lowin
2e31b2704b Update tests 2025-06-19 14:05:19 -04:00
Jeremiah Lowin
35e13ef9bf Update resource manager 2025-06-19 12:22:14 -04:00
Jeremiah Lowin
8eaa6096b4 Make prefixes optional 2025-06-18 11:28:24 -04:00
Jeremiah Lowin
20f4117b47 Update tests 2025-06-10 21:06:20 -04:00
Jeremiah Lowin
3de00e3aa2 Add tests 2025-06-10 20:47:08 -04:00
Jeremiah Lowin
b1714bcf7b Clean up route maps 2025-06-10 20:19:41 -04:00
Jeremiah Lowin
1866c17400 Update tests 2025-06-10 17:08:23 -04:00
Jeremiah Lowin
3a3c01708d Split Tool into Tool and FunctionTool 2025-06-04 10:19:14 -04:00
Jeremiah Lowin
3e2fbb606b
Merge branch 'main' into fix-typing 2025-05-31 20:47:12 -04:00
Jeremiah Lowin
f1e3713fc6 Update test typing 2025-05-31 20:41:18 -04:00
Jeremiah Lowin
2390fb4da6 clean up test inits 2025-05-31 19:32:08 -04:00
Jeremiah Lowin
b924dd54d4 Add tests 2025-05-23 17:31:46 -04:00
Jeremiah Lowin
ae960e2f5a Update tests for new names 2025-05-23 17:16:32 -04:00
Jeremiah Lowin
9350d558c6 Update test_openapi.py 2025-05-23 15:42:56 -04:00
Jeremiah Lowin
213abc4244 Pass client headers through to OpenAPI client 2025-05-23 12:38:24 -04:00
Jeremiah Lowin
6436adaaf3 Split into routemapfn and mcpcomponentfn 2025-05-23 11:03:57 -04:00
Jeremiah Lowin
aa2747497c Add route_map_fn for fine control 2025-05-22 22:10:45 -04:00
Jeremiah Lowin
6cac09cf2a Add support for RouteMap tags, update docs 2025-05-22 21:59:16 -04:00
Jeremiah Lowin
702412e28b Remove custom names 2025-05-22 21:11:46 -04:00