Commit graph

662 commits

Author SHA1 Message Date
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
7e0a237945 Fix schema wrapping for non-object union types in output schemas 2025-06-30 14:12:40 -04:00
Jeremiah Lowin
b10bab9423 Fix output schema test 2025-06-28 08:14:31 -04:00
Jeremiah Lowin
c412a63d4e Update docs 2025-06-27 22:38:55 -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
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
Jeremiah Lowin
78f0196db5 Fix OpenAPI tests 2025-06-26 18:21:52 -04:00
Jeremiah Lowin
7b9696405b Remove legacy json parsing
Because the server now validates inputs, its no longer viable to provide a JSON string where e.g. an array is expected, so we can entirely remove FastMCP's "legacy json parsing" support from 1.x.

This is a breaking change (for legacy opt-in behavior)
2025-06-26 18:19:43 -04:00
Jeremiah Lowin
ddb38bacc4 Fix middleware tests 2025-06-26 18:13:32 -04:00
Jeremiah Lowin
6b2df6be51 Fix middleware tests 2025-06-26 17:57:30 -04:00
Jeremiah Lowin
aa66b81b73 Merge branch 'protocol-update' of https://github.com/jlowin/fastmcp into protocol-update 2025-06-26 15:22:41 -04:00
Jeremiah Lowin
b98b080c98 Implement TokenVerifier protocol for mcp-python-sdk compatibility
Fixes breaking changes from mcp-python-sdk PR #982 which updated
BearerAuthBackend to use TokenVerifier protocol instead of OAuth providers.

Changes:
- Add verify_token() method to BearerAuthProvider implementing TokenVerifier protocol
- Add verify_token() method to InMemoryOAuthProvider implementing TokenVerifier protocol
- Update BearerAuthBackend usage in setup_auth_middleware_and_routes() to pass TokenVerifier
- Add comprehensive unit tests for TokenVerifier implementations
- Add integration tests for BearerAuthBackend with TokenVerifier
- Add tests for HTTP auth setup functions

All existing functionality preserved with full backwards compatibility.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-26 15:08:31 -04:00
Jeremiah Lowin
0624a4ae53 Update tests for server input validation 2025-06-26 10:56:21 -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
6d033eeaf1 Add production-ready middleware examples with comprehensive tests
Implements timing, logging, rate limiting, and error handling middleware to showcase
FastMCP's middleware capabilities as a headline feature. Each middleware includes:

- Production-ready implementations with full configurability
- Comprehensive unit and integration tests with real FastMCP servers
- Updated documentation with teaching examples and production usage patterns

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 21:57:49 -04:00
Jeremiah Lowin
76e3df1bc1 Add "http" as an alias for streamable-http 2025-06-22 18:55:07 -04:00
Jeremiah Lowin
0142bb2af1
Merge branch 'protocol-update' into output-schema 2025-06-22 13:46:26 -04:00
Jeremiah Lowin
eb00f2238b Merge branch 'main' into protocol-update 2025-06-22 13:45:29 -04:00
Jeremiah Lowin
9714028cac Fix pyright type checking issues in tests
Add proper null checks and type assertions for prompt argument
handling in tests to satisfy pyright strict typing.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 09:55:40 -04:00
Jeremiah Lowin
7114242e1e Update schema description wording for clarity
Change from 'Arguments must be strings conforming to this JSON schema'
to 'Provide as a JSON string matching the following schema' for clearer
instruction to LLMs about string format requirements.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 09:46:11 -04:00
Jeremiah Lowin
817018bf3b Add automatic JSON schema descriptions for non-string prompt arguments
- Fix ValueError -> PromptError for consistent error handling
- Add automatic JSON schema descriptions to non-string prompt arguments
- Include comprehensive tests for argument description enhancement
- Verify enhanced descriptions are visible via MCP protocol

This helps developers understand the expected string format for complex
types when calling prompts from MCP clients.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 09:38:57 -04:00
Jeremiah Lowin
cc69e56758 Add output schema to tool decorator 2025-06-20 18:58:23 -04:00
Jeremiah Lowin
3bc585788f Add output schema to tools 2025-06-20 17:54:07 -04:00
Jeremiah Lowin
18ae625fef Update docs and test 2025-06-20 13:06:48 -04:00
Jeremiah Lowin
02b2ec1adf Update types and tests for upcoming SDK release 2025-06-20 09:56:21 -04:00
Jeremiah Lowin
60c6441d7b Fix formatting per pre-commit hooks
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-19 18:22:02 -04:00
Jeremiah Lowin
370c44b745
Merge branch 'main' into dev-20250619-173841 2025-06-19 18:21:18 -04:00
Jeremiah Lowin
942fd5c13e Add session_id property to Context for session-based data sharing
Exposes MCP session ID from HTTP headers to enable Redis-based data sharing
between tools. Returns None for stdio/memory transports as expected.

Fixes #875, addresses python-sdk#986, python-sdk#942, python-sdk#485

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-19 18:16:34 -04:00
Jeremiah Lowin
0beb79d11a Minor updates 2025-06-19 15:28:55 -04:00
Jeremiah Lowin
725c061d66 Fix import prefix behavior 2025-06-19 15:19:31 -04:00
Jeremiah Lowin
703589e6f5 Add proxy middleware test 2025-06-19 15:00:11 -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
a42c0c40b0 Add middleware for all current handlers 2025-06-18 21:41:28 -04:00
Jeremiah Lowin
c183e3a99c Updated list_tools 2025-06-18 21:17:38 -04:00
Jeremiah Lowin
e365c0b6fb Merge branch 'main' into middleware-2 2025-06-18 21:08:18 -04:00
Jeremiah Lowin
a2bb2314c7 Add key to component 2025-06-18 21:05:11 -04:00
Jeremiah Lowin
0702bad1c2 Add single-component methods 2025-06-18 19:47:19 -04:00
Jeremiah Lowin
8eaa6096b4 Make prefixes optional 2025-06-18 11:28:24 -04:00
Jeremiah Lowin
084e52badd Consolidate prefix logic 2025-06-17 20:23:47 -04:00
Goro
4c60119767 Add missing tests 2025-06-16 08:10:34 +02:00
Goro
57e0b03711 Run pre-commit and fix typing issues 2025-06-16 07:12:41 +02:00
Goro
d2b2243957 Add file utility type and tests 2025-06-16 00:23:11 +02:00
Jeremiah Lowin
d24d35639f Remove duplicate tests 2025-06-14 09:26:52 -04:00