Skip to content

Conversation

@sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Dec 15, 2025

Adapt to new FastMCP release that broke our integration. FastMCP v2.14.0+ registers its own handlers for prompts and resources directly, bypassing the Server decorators we patch.

@sentrivana sentrivana changed the title Patch FastMCP feat(mcp): Patch FastMCP's resource, prompt handlers Dec 15, 2025
@sentrivana sentrivana marked this pull request as ready for review December 15, 2025 14:00
@sentrivana sentrivana requested a review from a team as a code owner December 15, 2025 14:00
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Resource protocol extraction fails when URI passed as kwarg

The resource protocol extraction at line 404 accesses original_args[0] directly without checking if original_args is empty. With the new kwargs support added to _async_handler_wrapper, the URI can be passed as a keyword argument (in original_kwargs["uri"]), leaving original_args empty. This will raise an IndexError. The _prepare_handler_data function was correctly updated to handle both args and kwargs for resources, but the protocol extraction logic wasn't updated consistently.

sentry_sdk/integrations/mcp.py#L403-L404

if handler_type == "resource":
uri = original_args[0]

Fix in Cursor Fix in Web


@sentrivana sentrivana marked this pull request as draft December 15, 2025 14:14
@sentrivana sentrivana marked this pull request as ready for review December 16, 2025 07:29
@sentrivana sentrivana merged commit 61ea9e0 into toxgen/update Dec 16, 2025
152 checks passed
@sentrivana sentrivana deleted the ivana/fastmcp-update branch December 16, 2025 08:20
sentrivana added a commit that referenced this pull request Dec 16, 2025
FastMCP fix: #5233

---

Update our test matrix with new releases of integrated frameworks and
libraries.

## How it works
- Scan PyPI for all supported releases of all frameworks we have a
dedicated test suite for.
- Pick a representative sample of releases to run our test suite
against. We always test the latest and oldest supported version.
- Update
[tox.ini](https://github.com/getsentry/sentry-python/blob/master/tox.ini)
with the new releases.

## Action required
- If CI passes on this PR, it's safe to approve and merge. It means our
integrations can handle new versions of frameworks that got pulled in.
- If CI doesn't pass on this PR, this points to an incompatibility of
either our integration or our test setup with a new version of a
framework.
- Check what the failures look like and either fix them, or update the
[test
config](https://github.com/getsentry/sentry-python/blob/master/scripts/populate_tox/config.py)
and rerun
[scripts/generate-test-files.sh](https://github.com/getsentry/sentry-python/blob/master/scripts/generate-test-files.sh).
See
[scripts/populate_tox/README.md](https://github.com/getsentry/sentry-python/blob/master/scripts/populate_tox/README.md)
for what configuration options are available.

 _____________________

_🤖 This PR was automatically created using [a GitHub
action](https://github.com/getsentry/sentry-python/blob/master/.github/workflows/update-tox.yml)._

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants