Commit graph

1,264 commits

Author SHA1 Message Date
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
38036b1f42 Add automatic MCP list change notifications and client message handling
Implements comprehensive notification system for tools, resources, and prompts with automatic client updates and flexible message handlers.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 22:33:06 -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
987dd85826 Update test_streamable_http.py 2025-06-22 20:08:36 -04:00
Jeremiah Lowin
ffe0c92d63 Alias streamable-http as http 2025-06-22 20:00:11 -04:00
Jeremiah Lowin
76e3df1bc1 Add "http" as an alias for streamable-http 2025-06-22 18:55:07 -04:00
Jeremiah Lowin
9b85d492e8 Add http as an alias for streamable http 2025-06-22 18:35:28 -04:00
Jeremiah Lowin
0142bb2af1
Merge branch 'protocol-update' into output-schema 2025-06-22 13:46:26 -04:00
Jeremiah Lowin
c685c30b8d
Merge branch 'protocol-update' into elicitation 2025-06-22 13:46:08 -04:00
Jeremiah Lowin
eb00f2238b Merge branch 'main' into protocol-update 2025-06-22 13:45:29 -04:00
Jeremiah Lowin
73e1aa2112 Apply pre-commit formatting changes
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 10:29:15 -04:00
Jeremiah Lowin
a7f14d90a4 Implement client-side argument serialization with focused tests
- Add pydantic_core.to_json() serialization for non-string prompt arguments
- Update type annotations to accept dict[str, Any] instead of dict[str, str]
- Add focused tests covering specific scenarios:
  * Client always serializes non-string args regardless of server types
  * Integration with server-side type conversion
  * Client serialization error with specific PydanticSerializationError
  * Server deserialization error with specific McpError match

This ensures MCP protocol compliance while maintaining developer experience
with typed arguments.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 10:18:48 -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
7a793f4309 Fix prompt argument type annotation to support mixed typing
Updated FunctionPrompt.render() to accept dict[str, Any] instead of
dict[str, str | Context] to preserve the developer experience of
passing properly typed arguments while also supporting string-only
arguments from MCP clients.

The _convert_string_arguments method now intelligently handles both
scenarios:
- Already-typed arguments are passed through unchanged
- String arguments are converted to expected types when needed

This maintains backward compatibility while enabling MCP spec compliance.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 08:34:49 -04:00
Jeremiah Lowin
8506f78453 Fix event loop conflict in inspect CLI command
Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 20:04:39 -04:00
Jeremiah Lowin
6a3a3077b7 Add fastmcp inspect command with detailed server analysis
- Add comprehensive server inspection utility supporting both FastMCP 1.x and 2.x
- Create detailed info dataclasses for tools, prompts, resources, and templates
- Implement CLI command with path:object notation and JSON output
- Add version reporting (fastmcp_version, mcp_version, server_version)
- Include comprehensive unit tests for utilities and CLI

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 16:40:54 -04:00
Jeremiah Lowin
cc69e56758 Add output schema to tool decorator 2025-06-20 18:58:23 -04:00
Jeremiah Lowin
337c2f8db5
Merge pull request #897 from owtaylor/openapi-recursive-components 2025-06-20 18:43:27 -04:00
Jeremiah Lowin
3bc585788f Add output schema to tools 2025-06-20 17:54:07 -04:00
Owen W. Taylor
14d1b8a94d openapi: Rewrite recursive #/components/schemas/ references
When a schema referenced another schema as #/components/schemas/...
that wasn't properly rewritten into #/$defs/..
2025-06-20 14:34:47 -04:00
Owen W. Taylor
bbf8165636 openapi: Improve pruning of unused defs
Defs that are used only by other unused defs were counted as
used. Fix this by tracing what defs use other defs recursively.
2025-06-20 14:34:41 -04:00
Jeremiah Lowin
fbe2fc3533 Add transport handling for trailing slashes 2025-06-20 13:12:23 -04:00
Jeremiah Lowin
18ae625fef Update docs and test 2025-06-20 13:06:48 -04:00
Jeremiah Lowin
a2f406faa4 Apply pre-commit formatting fixes 2025-06-20 12:17:47 -04:00
Jeremiah Lowin
42460480de Fix BearerAuthProvider audience type annotations to support List[str]
The audience parameter was typed as `str | None` but the implementation
already supported `List[str]`. This fix aligns the type annotations with
the actual functionality and adds comprehensive validation logic for all
audience type combinations.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 12:13:00 -04:00
Jeremiah Lowin
40ce687d0d Fix JWT issuer validation to support string values per RFC 7519
Resolves issue where BearerAuthProvider rejected tokens with non-URL
issuer claims. Works around the underlying SDK's URL validation while
maintaining RFC 7519 compliance for JWT processing.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 11:47:34 -04:00
Jeremiah Lowin
1d05578b3f Merge branch 'protocol-update' into elicitation 2025-06-20 10:08:08 -04:00
Jeremiah Lowin
02b2ec1adf Update types and tests for upcoming SDK release 2025-06-20 09:56:21 -04:00
Jeremiah Lowin
c0d3313ac6 Implement elicitation feature for FastMCP following sampling pattern
Added comprehensive elicitation support including:
- Client-side handler infrastructure following sampling pattern
- Server-side Context.elicit() method with type safety and validation
- Support for primitive types (str, int, float, bool) with automatic wrapping
- Support for dataclasses and other complex types
- Pattern matching with AcceptedElicitation, DeclinedElicitation, CancelledElicitation
- Comprehensive atomic test coverage for all scenarios

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 09:47:53 -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
085c5b765b Update docs and tests 2025-06-19 17:06:54 -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
607125abf8 Update tool manager 2025-06-19 11:04:50 -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
Jeremiah Lowin
97c21678f1
Merge pull request #843 from gorocode/feature/file-utility-type
Add File utility for wrapping binary data
2025-06-16 10:03:32 -04:00