Commit graph

3,289 commits

Author SHA1 Message Date
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
Jason Cheng
f2a38d275c custom auth configuration for remote mcp server with mcp config class 2025-06-22 14:03:50 +08:00
Jeremiah Lowin
3933f4f96c
Merge pull request #904 from jlowin/feature/fastmcp-inspect-command 2025-06-21 20:20:02 -04:00
Jeremiah Lowin
84d5750f6d Update cli.mdx
Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 20:08:29 -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
bc1e185141 Use dataclasses.asdict() for better maintainability
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 16:43:40 -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
4741d9ea86
Merge pull request #902 from jlowin/docs 2025-06-20 20:49:05 -04:00
Jeremiah Lowin
e245155bc5 Simplify docs nav 2025-06-20 20:48:42 -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
ecd5aeeed8
Merge pull request #900 from jlowin/fix-api-ref-rendering 2025-06-20 18:32:27 -04:00
Jeremiah Lowin
4b77c3a405 Add docs 2025-06-20 18:23:47 -04:00
zzstoatzz
98a91cbd9e fix escaping problem 2025-06-20 17:15:33 -05:00
zzstoatzz
094d259389 remove xtra newline 2025-06-20 17:09:30 -05:00
zzstoatzz
006341871e ope 2025-06-20 17:08:24 -05:00
zzstoatzz
a7e3ae47bf fix rendering for some pages 2025-06-20 17:07:19 -05:00
Jeremiah Lowin
3bc585788f Add output schema to tools 2025-06-20 17:54:07 -04:00
Jeremiah Lowin
1aaadf25e9
Merge pull request #893 from jlowin/api-ref 2025-06-20 16:39:15 -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
zzstoatzz
5afe5b793e update path and mdxify 2025-06-20 12:59:11 -05:00
Jeremiah Lowin
55a99c40c1
Merge pull request #896 from jlowin/trailing-slash 2025-06-20 13:13:56 -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
d1ded43a43 Merge branch 'main' into trailing-slash 2025-06-20 12:54:09 -04:00
Jeremiah Lowin
ac95a3aaaf Update http.py 2025-06-20 12:53:42 -04:00
Jeremiah Lowin
b37686cf15 Use trailing slashes 2025-06-20 12:52:42 -04:00
Jeremiah Lowin
4b303f1ae0 Fix StreamableHTTP redirect issue for MCP spec compliance
Resolves 307 redirect from /mcp to /mcp/ by replacing Mount with explicit Route entries for both path variations. The MCP specification requires a single endpoint to handle both GET and POST requests without redirects.

Changes:
- Replace Mount with Route for both /mcp and /mcp/ paths
- Add PathNormalizingASGIApp wrapper to normalize trailing slashes for MCP SDK
- Apply same pattern to SSE transport for consistency
- Ensure both auth and non-auth configurations work correctly

This fixes the redirect issue mentioned in GitHub issue #828.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 12:29:25 -04:00
Jeremiah Lowin
fb9161d745
Merge pull request #895 from jlowin/claude-wt-20250620-120729 2025-06-20 12:28:51 -04:00
Jeremiah Lowin
ac252fc28f Fix CORS documentation example to properly handle preflight requests
The previous example only allowed GET methods, causing browser preflight
requests to fail with "Disallowed CORS method" errors. Updated to include
the required parameters for proper CORS support with MCP clients.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 12:27:22 -04:00
Jeremiah Lowin
f97ace175f
Merge pull request #894 from jlowin/claude-wt-20250620-120811 2025-06-20 12:25:01 -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
a0242e1c68
Merge pull request #892 from jlowin/claude-wt-20250620-113451 2025-06-20 11:54:52 -04:00
Jeremiah Lowin
7b5ef3e5e5 Use specific ValidationError instead of broad Exception catch
Addresses PR feedback to use more specific exception handling for
URL validation failures.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 11:50:16 -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
ee9c9b0731 Remove old docstring note 2025-06-20 10:09:28 -04:00
Jeremiah Lowin
520c98ecce Remove schema to type 2025-06-20 10:08:15 -04:00
Jeremiah Lowin
1d05578b3f Merge branch 'protocol-update' into elicitation 2025-06-20 10:08:08 -04:00
Jeremiah Lowin
e5364787e1
Merge pull request #888 from jlowin/protocol-typing 2025-06-20 10:05:29 -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
a63e9884ae Merge branch 'parent-depth' into elicitation 2025-06-20 07:03:41 -04:00
Jeremiah Lowin
f507fca384 Set type adapter parent depth to 3 2025-06-20 07:03:24 -04:00
Jeremiah Lowin
0def5c30aa Bump dependencies 2025-06-20 06:35:48 -04:00
Jeremiah Lowin
4f4f27a3d2
Merge pull request #882 from jlowin/docs-session-id-update 2025-06-19 18:39:34 -04:00
Jeremiah Lowin
28fe5082d2 Add session_id to context documentation
Fast follow to #881 to document the new session_id property.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-19 18:35:59 -04:00
Jeremiah Lowin
5154f87f30
Merge pull request #881 from jlowin/dev-20250619-173841 2025-06-19 18:27:00 -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