-
Notifications
You must be signed in to change notification settings - Fork 569
feat(mcp): Patch FastMCP's resource, prompt handlers #5233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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
sentry-python/sentry_sdk/integrations/mcp.py
Lines 403 to 404 in 1822003
| if handler_type == "resource": | |
| uri = original_args[0] |
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]>
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.