René's URL Explorer Experiment


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

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files/:range(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:810946e7-6a16-7e3d-fd44-1d8da727d0cd
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD1FC:1956C7:1F8C14C:2ABD333:6A65551F
html-safe-nonce544be50efe402589f9bbda51fb0415dd32af97f89a42425c555614a02e0967e6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUZDOjE5NTZDNzoxRjhDMTRDOjJBQkQzMzM6NkE2NTU1MUYiLCJ2aXNpdG9yX2lkIjoiMzc3MDUzODk2NjE3MTA3OTk2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace158691eed735cfb5bcb6ae75f7296fdc9f2b86341776a828d44c9e09635d34b
hovercard-subject-tagpull_request:3876487059
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
twitter:imagehttps://avatars.githubusercontent.com/u/5655473?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/5655473?s=400&v=4
og:image:altMCP 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release309153364422b3c499922d1a2a6404910a58ed8e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F6583%2Ffiles%2F62471680ca982bbb6e4780ea63d8f41fedc19224
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fpull%2F6583%2Ffiles%2F62471680ca982bbb6e4780ea63d8f41fedc19224
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Reloadhttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Reloadhttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
getsentry https://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Notifications https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Fork 644 https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Star 2.2k https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Code https://github.com/getsentry/sentry-python
Issues 343 https://github.com/getsentry/sentry-python/issues
Pull requests 64 https://github.com/getsentry/sentry-python/pulls
Discussions https://github.com/getsentry/sentry-python/discussions
Actions https://github.com/getsentry/sentry-python/actions
Security and quality 2 https://github.com/getsentry/sentry-python/security
Insights https://github.com/getsentry/sentry-python/pulse
Code https://github.com/getsentry/sentry-python
Issues https://github.com/getsentry/sentry-python/issues
Pull requests https://github.com/getsentry/sentry-python/pulls
Discussions https://github.com/getsentry/sentry-python/discussions
Actions https://github.com/getsentry/sentry-python/actions
Security and quality https://github.com/getsentry/sentry-python/security
Insights https://github.com/getsentry/sentry-python/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fgetsentry%2Fsentry-python%2Fissues%2Fnew%2Fchoose
ericapisanihttps://github.com/ericapisani
masterhttps://github.com/getsentry/sentry-python/tree/master
py-2532-handle-removal-of-request_ctxhttps://github.com/getsentry/sentry-python/tree/py-2532-handle-removal-of-request_ctx
Conversation 17 https://github.com/getsentry/sentry-python/pull/6583
Commits 5 https://github.com/getsentry/sentry-python/pull/6583/commits
Checks 144 https://github.com/getsentry/sentry-python/pull/6583/checks
Files changed 3 https://github.com/getsentry/sentry-python/pull/6583/files
fix(mcp): support MCP SDK v2 handler signature and removed request_ctx https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224#top
Show all changes 5 commits https://github.com/getsentry/sentry-python/pull/6583/files
06bb878 fix(mcp): support MCP SDK v2 handler signature and removed request_ctx ericapisani Jun 16, 2026 https://github.com/getsentry/sentry-python/pull/6583/commits/06bb878c22d17959e83fb9c8754e97939df4e0cc
5b28fb5 fix logic issue ericapisani Jun 16, 2026 https://github.com/getsentry/sentry-python/pull/6583/commits/5b28fb5b0a09111237e2c0d8fe1aab48ab022f44
eb09e69 remove tests that were directly exercising the handler method ericapisani Jun 16, 2026 https://github.com/getsentry/sentry-python/pull/6583/commits/eb09e69c45856d31848dcf7a59d6ee5affbe7418
6247168 Rework the idempotency test to test the functionality via public meth… ericapisani Jun 17, 2026 https://github.com/getsentry/sentry-python/pull/6583/commits/62471680ca982bbb6e4780ea63d8f41fedc19224
787e77a Merge branch 'master' into py-2532-handle-removal-of-request_ctx ericapisani Jun 17, 2026 https://github.com/getsentry/sentry-python/pull/6583/commits/787e77afbaef131c166446267ee7e0861cad9fa1
Clear filters https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
mcp.py https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224#diff-6254d4b44f194cd66f20ea9eaa9a753e523162865eeb10459f96be62f386807b
conftest.py https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224#diff-e52e4ddd58b7ef887ab03c04116e676f6280b824ab7469d5d3080e5cba4f2128
test_mcp.py https://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224#diff-e64066cfcbfbe50ec059ca5a597edfc31702327dac3c44a863df86f145914da5
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
Please reload this pagehttps://github.com/getsentry/sentry-python/pull/6583/files/62471680ca982bbb6e4780ea63d8f41fedc19224
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.