Commit graph

3,289 commits

Author SHA1 Message Date
Lawrence
d191995840
Update CSP to allow data URI images on OAuth screens (#2405)
* Update CSP to allow data URI images

* Fix formatting issue
2025-11-15 10:30:31 -05:00
Patrick Stöckle
18d4a6ab63
chore(typos): fix additional typos (#2396) 2025-11-08 10:47:56 -05:00
Jeremiah Lowin
0fa3097153
Add version badge for DebugTokenVerifier in documentation (#2390)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2025-11-06 18:25:26 -05:00
William Easton
05ac9457b8
Fix duplicate keyword argument error in configure_logging (#2381)
Allow traceback-related kwargs to override defaults by building a dict
with defaults first, then updating with user-provided values.

Fixes #2356

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-11-06 10:11:16 -05:00
Jeremiah Lowin
f8b896490e
Fix Windows test timeout and restore parallel testing (#2383)
OAuth consent tests were timing out on Windows due to SQLite database
locking when OAuthProxy instances used the default DiskStore without
explicit MemoryStore configuration. Added explicit client_storage=MemoryStore()
to three tests in TestConsentPageServerIcon.

Also restored parallel testing on Windows (--numprocesses auto) which
was previously disabled but is now safe with proper test isolation.
2025-11-05 20:25:10 -05:00
Cemal Kılıç
f540385b58
feat: add algorithm configuration to Supabase auth provider (#2376) 2025-11-05 20:21:10 -05:00
Jeremiah Lowin
48fc8cbc9a
Fix consent form action for subpath mounting (#2382)
* Fix consent form action for subpath mounting

When a FastMCP server is mounted at a subpath (e.g., /api/v1), the consent
form used a hardcoded absolute path (/consent/submit) that didn't include
the mount prefix, causing 404 errors on submission.

Changed the form to use an empty action (action="") which submits to the
current URL, making it work correctly regardless of mount path. Also
consolidated the consent endpoints to handle both GET and POST at /consent.

Fixes #2380

* Update integration test to use /consent instead of /consent/submit
2025-11-05 20:20:38 -05:00
Giovanna Zanardini
a6ddde27df
Allow OAuth instance to use the same httpx factory as the Transport (#2324)
* Allow OAuth instance to use the same httpx factory as the Transport

* Fix test

* Update SSL verification mode assertion in tests

* This is actually not needed

* Creating a Client instance is not needed for this test

* Fix test

* Apply httpx_client_factory fix to SSETransport

Extends the OAuth httpx_client_factory changes to SSETransport.
SSETransport had the same issues as StreamableHttpTransport where it
wasn't passing the custom httpx client factory to OAuth, causing
certificate verification settings to be ignored during OAuth flows.

Changes:
- Set httpx_client_factory before calling _set_auth()
- Pass httpx_client_factory to OAuth constructor
- Add test for SSETransport OAuth client factory propagation

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-04 12:14:28 -05:00
Jeremiah Lowin
a7563a39b0
Fix get_http_headers() returning empty dict in on_initialize middleware (#2370) 2025-11-04 11:56:43 -05:00
Jeremiah Lowin
a359b0b28d
Document client meta parameter for sending ancillary request data (#2367) 2025-11-04 11:32:31 -05:00
Jeremiah Lowin
80d10d23f4
Fix: URL-encode server name in Cursor deeplinks (#2369)
Server names with special characters (&, ?, #, etc.) were creating
malformed deeplink URLs. Now properly percent-encoded.
2025-11-04 11:26:57 -05:00
Jeremiah Lowin
c6a9b3df22
Fix Windows test timeouts from SQLite locking (#2368) 2025-11-04 10:58:49 -05:00
Jeremiah Lowin
5747cb6237
Fix OAuth metadata endpoint URLs when base_url differs from issuer_url (#2353)
* Fix OAuth metadata endpoint URLs when base_url differs from issuer_url

OAuth operational endpoints (/authorize, /token) are mounted at base_url,
but metadata was incorrectly declaring them at issuer_url. This caused
clients following the documented mounting pattern to receive incorrect
endpoint URLs in /.well-known/oauth-authorization-server.

Fixes #2287

* Update auth.py

* Remove unnecessary assertion from OAuthProvider init

* Add info log when issuer_url differs from base_url
2025-11-04 10:38:41 -05:00
Antonio Iorga
7e6610b7b6
Add meta to call tool (#2206)
* feat: Add optional meta parameter to Client tool call methods

* fix: Add support for mcp<1.19

* chore: cleaner solution

* Refactor call_tool to directly accept meta parameter and add tests for meta functionality

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-04 10:25:52 -05:00
William Easton
7d0c3700ed
Merge pull request #2361 from jlowin/fix-marvin
Switch marvin to prek from pre-commit
2025-11-03 21:29:55 -06:00
strawgate
49259ae938 switch marvin to prek from pre-commit 2025-11-03 21:22:22 -06:00
marvin-context-protocol[bot]
7ccaa8ac6d
chore: Update SDK documentation (#2265)
Co-authored-by: marvin-context-protocol[bot] <225465937+marvin-context-protocol[bot]@users.noreply.github.com>
2025-11-03 18:49:06 -05:00
Jeremiah Lowin
dcfd9ee387
Pin Cyclopts to v4.0.0 + compliance note (#2354)
* Pin cyclopts to v5.0.0a1+

* Document cyclopts/docutils licensing

* Update docs
2025-11-03 18:37:12 -05:00
Maxi Fernandez
8ad2dfc00c
fix: on_initialize is not using request params but the whole request (#2357)
* fix initialize type

* undo for clarity

* fix type hint
2025-11-03 16:04:02 -05:00
Jeremiah Lowin
9c861b232b
Add manual initialization control to Client (#2355)
* Add manual initialization control to Client

- Add auto_initialize parameter (default True) to control automatic initialization
- Make initialize() method public with idempotent caching
- Add comprehensive test suite for initialization behavior

* Document client initialization control and server instructions

- Expand documentation to cover auto_initialize parameter
- Show manual initialization for advanced use cases
- Document accessing server instructions via initialize_result

* Update client.mdx
2025-11-03 16:01:30 -05:00
Jeremiah Lowin
6cc9559f84
Bump ty to ==0.0.1a25 (#2350)
* Bump ty to >=0.0.1a25 with type fixes

Follow-up to #2295. Updates ty and fixes compatibility issues with alpha 25, including:

- Updated ignore comment syntax (possibly-unbound-attribute → possibly-missing-attribute)
- Fixed async generator type handling with anext()
- Fixed type narrowing for timeout parameters
- Converted base_url assignments to AnyHttpUrl after string manipulation
- Added CallToolResult to return type annotations
- Removed redundant type casts
- Fixed test form data to use strings instead of bytes

ty alpha 25 has limitations with isinstance() narrowing on unions (see pyproject.toml for details), requiring some targeted type ignores.

* Pin ty to ==0.0.1a25

Alpha releases can have breaking changes, so pin to the tested version.
2025-11-02 20:02:45 -05:00
Cole Murray
0e97a261cf
Security: Validate Cursor deeplink URLs and use safer Windows API (#2348)
* 🤖 Security: Validate Cursor deeplink URLs and replace cmd.exe on Windows

- Add URL scheme validation to reject non-cursor:// URLs
- Replace subprocess cmd.exe call with os.startfile() on Windows
- Add tests for scheme validation and error handling

* 🤖 Fix tests for cross-platform deeplink validation
2025-11-02 19:49:07 -05:00
Copilot
5499cda9d0
Fix lowest-direct dependency tests to actually test minimum versions (#2295)
* Initial plan

* Pin dev dependencies and use --resolution lowest-direct in pytest commands

Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>

* Update uv.lock

* bump ty version

* ty upper bound

* Update uv.lock

* Update ty lock

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-02 17:30:31 -05:00
nate nowack
aba7d762de
switch from pre-commit to prek (#2309)
* switch from pre-commit to prek

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

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

* fix prek tools list in contributing.mdx - include prettier, not pytest

* Use prek-action for caching

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-02 17:08:36 -05:00
Jeremiah Lowin
bbf3050ba7
Improve ToolResult and structured output documentation (#2349)
- Restructured confusing sections: 'Object-like Results' → 'Dictionaries and Objects', 'Non-object Results' → 'Primitives and Collections', 'Complex Type Example' → 'Typed Models'
- Simplified CodeGroup examples to show Tool Definition + MCP Result instead of 3-4 confusing tabs
- Split Primitives/Collections into separate CodeGroups for clarity
- Renamed 'Full Control with ToolResult' → 'ToolResult and Metadata' for better TOC visibility
- Flattened ToolResult documentation with inline field descriptions instead of nested headings
- Added version badge for ToolResult meta field (2.13.1)
- Added clarification that ToolResult meta is separate from @mcp.tool meta
- Improved example server with realistic metadata (execution time, character/word counts)
- Fixed code formatting (multi-line objects, trailing commas)
2025-11-02 17:07:48 -05:00
Brandon Shar
c18782f02b
Add meta support to ToolResult (#2283)
* Add meta to ToolResult

* add this at the client level and test the full integration

* add example

* slipped through linting somehow

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
2025-11-02 16:46:52 -05:00
Cole Murray
c8ddbff488
Security: Update authlib to 1.6.5 (CVE-2025-61920) (#2347)
Updates authlib from 1.6.1 to 1.6.5 to address CVE-2025-61920, which
fixes a denial of service vulnerability in JOSE implementation that
accepts unbounded JWS/JWT header and signature segments.
2025-11-02 11:46:55 -05:00
Jeremiah Lowin
c9ec1459e1
Mark flaky Windows test for retry (#2344)
* Mark flaky Windows test for retry

test_multi_client_transform_with_filtering occasionally times out on Windows CI during exception formatting in linecache.checkcache(). Add @pytest.mark.flaky with 3 retries.

* Remove unnecessary delay from flaky marker
2025-11-01 16:52:08 -04:00
Jeremiah Lowin
dab125e069
Remove test warnings (#2331) 2025-11-01 14:53:51 -04:00
Harshith Thota
321f404046
Added to_data_uri method for Image class. (#2227)
* Added to_data_uri method and path_to_data_uri classmethod for Image class.

* Removed path_to_data_uri classmethod and modified _get_mime_type to use mimetypes.guess_type function instead of hardcoded dictionary.

* Register image/webp with mimetypes before guess_type to support WEBP mimetype detection on Python 3.10.

* Improved branch coverage for Image.to_data_uri.

* Added Image._to_data_uri example in the docs.
2025-11-01 11:40:08 -04:00
Josh Thomas
08c49e62e8
Fix query-only resource templates not matching URIs without query strings (#2323)
* Fix query-only resource templates not matching URIs without query strings

* apply the same fix to `has_resource`
2025-11-01 11:27:37 -04:00
Jeremiah Lowin
443c44c507
Configure Marvin to auto-create PRs and label issues (#2319)
* Update marvin.yml

* Configure Marvin to auto-create PRs and label issues

* Make Marvin instructions more assertive with MUST
2025-10-31 10:38:15 -04:00
Jeremiah Lowin
de58bb0e6c
Add DebugTokenVerifier with custom sync/async validation (#2296)
* Add DebugTokenVerifier with custom sync/async validation

* move import
2025-10-31 10:38:01 -04:00
Jeremiah Lowin
87adacfc8b
Require uvicorn>=0.35 for websockets-sansio support (#2307)
Fixes #2299

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2025-10-31 10:22:55 -04:00
William Easton
d12f51d22c
Merge pull request #2311 from jlowin/claude/issue-2310-20251029-2141
Add maturity warnings for py-key-value backends
2025-10-30 13:01:35 -05:00
claude[bot]
237f0decd2 Add maturity warnings for py-key-value backends
Add warning notes to documentation directing users to review
py-key-value documentation for backend maturity and limitations
before production use.

Co-authored-by: William Easton <strawgate@users.noreply.github.com>
2025-10-29 21:43:31 +00:00
Jeremiah Lowin
e2d317eeb6
Add OIDCProxy to auth module exports (#2308)
Fixes #2298

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2025-10-29 14:28:26 -04:00
Jeremiah Lowin
1ca53b4134
Add base_authority parameter to AzureProvider for Azure Government support (#2306) 2025-10-29 14:06:21 -04:00
Jeremiah Lowin
463b336941
Fix Chrome CSP blocking OAuth consent form with custom protocol redirects (#2305)
* Fix Chrome CSP blocking OAuth consent form with custom protocol redirects

* Fix Chrome CSP blocking OAuth consent form with custom protocol redirects

Dynamically include custom protocol schemes in CSP form-action directive
when redirect URIs use custom protocols like cursor://
2025-10-29 14:04:56 -04:00
Jake Kaplan
9c750fe5e4
Merge pull request #2294 from jlowin/exec-info-from-run
Switch to `logger.exception` for `fastmcp run/inspect`
2025-10-28 11:22:40 -04:00
jake@prefect.io
4262468b44 use logger.exeception 2025-10-28 10:18:21 -04:00
jake@prefect.io
a2f710fa9d add exc_info to fastmcp run 2025-10-28 10:14:53 -04:00
Jeremiah Lowin
887e72b39b
Replace openapi-core with jsonschema-path (#2291) 2025-10-28 06:46:52 -07:00
Jeremiah Lowin
318da83f6b
Fix py-key-value-aio minimum version to 0.2.8 (#2288)
* Fix py-key-value-aio minimum version to 0.2.8

FernetEncryptionWrapper was introduced in 0.2.8, not 0.2.6.

Fixes #2284

* Update lockfile
2025-10-28 06:30:03 -07:00
coderabbitai[bot]
4ea896c246
📝 Add docstrings to enhancement/support-jwt-multiple-issuers (#2282)
* 📝 Add docstrings to `enhancement/support-jwt-multiple-issuers`

Docstrings generation was requested by @jlowin.

* https://github.com/jlowin/fastmcp/pull/2233#issuecomment-3453446122

The following files were modified:

* `src/fastmcp/server/auth/providers/jwt.py`

* Fix formatting issues in JWT provider docstrings

Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2025-10-27 19:26:25 -04:00
mhassaninmsft
b24d771457
Supporting Multiple Issuers For JWTVerifier Oauth Workflow (#2233)
* multiple issuers

* Update tests/server/auth/test_jwt_provider.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix static checks

---------

Co-authored-by: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-10-27 18:13:40 -04:00
Jeremiah Lowin
15dbe7ecf0
Add custom token verifier support to OIDCProxy (#2279)
* Add custom token verifier support to OIDCProxy

OIDCProxy now accepts an optional token_verifier parameter to support
non-JWT token formats like opaque tokens from providers such as Clerk.

When provided, the custom verifier is used instead of creating a default
JWTVerifier. Parameters that only apply to JWTVerifier creation (algorithm,
required_scopes) raise clear errors when specified alongside a custom
verifier. Parameters with other purposes (audience for OAuth flow,
timeout_seconds for config fetch) remain allowed.

The custom verifier's required_scopes are automatically loaded and
advertised through OAuth discovery endpoints.

* Document custom token verifier support in OIDC proxy
2025-10-27 13:38:20 -04:00
Jeremiah Lowin
6d600e36db
Remove trailing slashes from MCP endpoint URLs in docs (#2277) 2025-10-27 10:36:47 -04:00
William Easton
7999dcbf2c
Merge pull request #2276 from JonZeolla/fixdocs/key-value-project
fix(docs): correct the key_value repo link
2025-10-27 07:52:55 -05:00
Jon Zeolla
11277f6e21 fix(docs): correct the key_value repo link 2025-10-27 07:35:10 -04:00