Title: fix(mcp): support MCP SDK v2 handler signature and removed request_ctx by ericapisani · Pull Request #6583 · getsentry/sentry-python · GitHub
Open Graph Title: fix(mcp): support MCP SDK v2 handler signature and removed request_ctx by ericapisani · Pull Request #6583 · getsentry/sentry-python
X Title: fix(mcp): support MCP SDK v2 handler signature and removed request_ctx by ericapisani · Pull Request #6583 · getsentry/sentry-python
Description: MCP SDK v2 changed handler signatures from (name, arguments) to (ctx, params) and removed the request_ctx ContextVar. Add version detection to patch the correct entry-points (Server.init and add_request_handler for v2, decorator methods for v1), extract request context from the ServerRequestContext argument directly, and update tests to work with both SDK versions. Migration notes for MCP SDK v2 can be found here: https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.0.0a1 https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/migration.md What this PR does not do: address all breaking changes outlined in the migration guide. This is meant to fix the test failures on #6567 while still being comprehensive enough to make sense for the next developer who continues the migration. This was tested on the branch in #6567 to confirm it doesn't introduce regressions while addressing the v2 breaking change. Fixes PY-2532 Fixes #6574
Open Graph Description: MCP SDK v2 changed handler signatures from (name, arguments) to (ctx, params) and removed the request_ctx ContextVar. Add version detection to patch the correct entry-points (Server.init and add_re...
X Description: MCP SDK v2 changed handler signatures from (name, arguments) to (ctx, params) and removed the request_ctx ContextVar. Add version detection to patch the correct entry-points (Server.init and add_re...
Opengraph URL: https://github.com/getsentry/sentry-python/pull/6583
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files/:range(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:810946e7-6a16-7e3d-fd44-1d8da727d0cd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D1FC:1956C7:1F8C14C:2ABD333:6A65551F |
| html-safe-nonce | 544be50efe402589f9bbda51fb0415dd32af97f89a42425c555614a02e0967e6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUZDOjE5NTZDNzoxRjhDMTRDOjJBQkQzMzM6NkE2NTU1MUYiLCJ2aXNpdG9yX2lkIjoiMzc3MDUzODk2NjE3MTA3OTk2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e158691eed735cfb5bcb6ae75f7296fdc9f2b86341776a828d44c9e09635d34b |
| hovercard-subject-tag | pull_request:3876487059 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224 |
| twitter:image | https://avatars.githubusercontent.com/u/5655473?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5655473?s=400&v=4 |
| og:image:alt | MCP SDK v2 changed handler signatures from (name, arguments) to (ctx, params) and removed the request_ctx ContextVar. Add version detection to patch the correct entry-points (Server.init and add_re... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 137814779 |
| octolytics-dimension-repository_nwo | getsentry/sentry-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 137814779 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 309153364422b3c499922d1a2a6404910a58ed8e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width