René's URL Explorer Experiment


Title: sketch: refactor lowlevel server to handler pattern by maxisbey · Pull Request #1968 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: sketch: refactor lowlevel server to handler pattern by maxisbey · Pull Request #1968 · modelcontextprotocol/python-sdk

X Title: sketch: refactor lowlevel server to handler pattern by maxisbey · Pull Request #1968 · modelcontextprotocol/python-sdk

Description: Replaces decorator-based handler registration with RequestHandler/NotificationHandler classes. Changes New files: request_handler.py and notification_handler.py with typed overloaded constructors Server dispatch: type(req) → req.method (string-based dispatch) Handler dicts: dict[type, Callable] → dict[str, RequestHandler] / dict[str, NotificationHandler] Registration: Decorator methods → constructor handlers list + add_handler() method Context: RequestContext built and passed directly to handlers; request_ctx contextvar removed Removed: All 12 decorator methods, tool cache, _make_error_result, _get_cached_tool_definition, new_server.py sketch Known breakages MCPServer._setup_handlers() — calls removed decorator methods ExperimentalHandlers — writes to handler dicts with type keys All lowlevel server tests — use decorator pattern All examples — use decorator pattern

Open Graph Description: Replaces decorator-based handler registration with RequestHandler/NotificationHandler classes. Changes New files: request_handler.py and notification_handler.py with typed overloaded constructors ...

X Description: Replaces decorator-based handler registration with RequestHandler/NotificationHandler classes. Changes New files: request_handler.py and notification_handler.py with typed overloaded constructors ...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/1968

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b7c4b25b-598f-14f8-87a6-892f82c715fb
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id96F0:265E5B:1C78327:25F6F1D:6A5D4E7B
html-safe-nonced438cda9dca4c4a2ea2633997b181e8509ac0dc1244bddcf8c81f07ea19d7f2f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkYwOjI2NUU1QjoxQzc4MzI3OjI1RjZGMUQ6NkE1RDRFN0IiLCJ2aXNpdG9yX2lkIjoiNjYwNjUzMDM2NTkxNzg0MzA2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb7f53a7dc001881ac77124ab2078c31a481a60caaf31abde584182cf37140e62
hovercard-subject-tagpull_request:3218864104
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/modelcontextprotocol/python-sdk/pull/1968/files
twitter:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
og:image:altReplaces decorator-based handler registration with RequestHandler/NotificationHandler classes. Changes New files: request_handler.py and notification_handler.py with typed overloaded constructors ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
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
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1968%2Ffiles
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
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%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F1968%2Ffiles
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=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
modelcontextprotocol https://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Notifications https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Fork 3.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Star 23.7k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 261 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 308 https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality 6 https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Code https://github.com/modelcontextprotocol/python-sdk
Issues https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests https://github.com/modelcontextprotocol/python-sdk/pulls
Actions https://github.com/modelcontextprotocol/python-sdk/actions
Projects https://github.com/modelcontextprotocol/python-sdk/projects
Models https://github.com/modelcontextprotocol/python-sdk/models
Security and quality https://github.com/modelcontextprotocol/python-sdk/security
Insights https://github.com/modelcontextprotocol/python-sdk/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
sketch/lowlevel-server-v2https://github.com/modelcontextprotocol/python-sdk/tree/sketch/lowlevel-server-v2
Conversation 49 https://github.com/modelcontextprotocol/python-sdk/pull/1968
Commits 17 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits
Checks 29 https://github.com/modelcontextprotocol/python-sdk/pull/1968/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
sketch: refactor lowlevel server to handler pattern https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#top
Show all changes 17 commits https://github.com/modelcontextprotocol/python-sdk/pull/1968/files
ec9815f sketch: lowlevel server v2 with overloaded handler classes maxisbey Jan 27, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/ec9815f636677549c94d6b1f5481bb04ee76c457
eb35b3c refactor: replace decorator-based handlers with RequestHandler/Notifi… maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/eb35b3ca8c1668e1cf9beceff1d5776d529142da
0b60fad refactor: split RequestContext into handler context hierarchy maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/0b60fad14c0255750e846f4ee7e820ebf646225a
bed7e3c rename: self.endpoint -> self.handler in handler classes maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/bed7e3c8d0c907d8f6725f3e253bfcdacb0b9299
860e8d6 refactor: decouple ExperimentalHandlers from Server internals, update… maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/860e8d6e9465542c10451770d5ea3f0d021517b8
17c459c refactor: update MCPServer to use RequestHandler pattern instead of d… maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/17c459c4e53e10f00c7b248a857509a328068d0c
8100870 refactor: collapse context hierarchy into single RequestContext class maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/8100870fb60f9395a794e439d59a2f3c3a81a783
d5c3b5f refactor: move _ping_handler below Server class maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/d5c3b5fd26549a9835d1d26c72cf9d286f61cc86
952a29c refactor: merge request_handler.py and notification_handler.py into h… maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/952a29cc389a10ea34b719d26830dd7250d52f49
6f0b041 refactor: move request_ctx contextvar to lowlevel server, remove per-… maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/6f0b041662ff219ad8bc8c8127b61258c9b951af
aa6d861 docs: fix migration guide — request_ctx contextvar still exists maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/aa6d861257fe196b90f00818f3b0d77b8842c4a0
24f1f39 docs: fix stale examples in migration guide maxisbey Jan 28, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/24f1f39bf4cdbbd3fa59ab9da308331128411652
8eb7299 refactor: address review — kw_only dataclass, type Experimental prope… maxisbey Jan 29, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/8eb72990bdc9401111f0fde3b72ff5c170a7aecc
cafb3e5 fix: allow ping handler override, add task overloads, update stale do… maxisbey Jan 29, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/cafb3e505ec63e823479fa8da7b744324b95ed9d
4255a99 docs: move lowlevel server sections to Breaking Changes in migration … maxisbey Jan 29, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/4255a996733d7577e2103a8e4c06488439bba494
044e128 Update src/mcp/server/lowlevel/__init__.py maxisbey Jan 30, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/044e12813b0da9f5d510d6cff829b7e014dc84de
f10995e refactor: remove request_ctx from lowlevel public API, fix experiment… maxisbey Jan 30, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/1968/commits/f10995ed9810fd62f456ee2b5c3028e763ad05e0
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
index.md https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-9fdad40404ae06571e2184d17271a7cbe176853a3066edde9479316a02e702b3
migration.md https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
request_context.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-8d05f99b9f074e62f6f7dc4eb823393ef4218b9c2a7c5b4b966f941055e5242d
task_result_handler.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-18b65113e22e1d5975f5a057cd352f32f933adaf3cd9c4484a8b40521298c223
__init__.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-23afa7c38ae84d72d250bef2c82600dea679b780385858d1f71047a5fa04e218
experimental.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-3e62e66c84aff2e748e8c750f1144de569f6e6e0fe2b9a45ab39794032b10b92
handler.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-dafaa033c6bf87c0e004dc6c140c8d0bd7ea12bb10c15b39c37ae35a52c8d80e
server.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-b21bf5e21c058ccfddb404c209f2d4288e4f32b121111ffc9d466638631d13e4
server.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-51d6996c0b80b8a5c42e7071451cb9ed3c91b398facebe99b94aad911059190e
context.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-39333468a87a8b7df9e7916239f97203647716e5465b846328ec277e179c7ceb
helpers.py https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-1827c4e0b8b733a2e711d40022010f1d2872465203de61fd7a8ac77b2c966226
docs/experimental/index.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-9fdad40404ae06571e2184d17271a7cbe176853a3066edde9479316a02e702b3
View file https://github.com/modelcontextprotocol/python-sdk/blob/f10995ed9810fd62f456ee2b5c3028e763ad05e0/docs/experimental/index.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1968/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-9fdad40404ae06571e2184d17271a7cbe176853a3066edde9479316a02e702b3
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-9fdad40404ae06571e2184d17271a7cbe176853a3066edde9479316a02e702b3
docs/migration.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
View file https://github.com/modelcontextprotocol/python-sdk/blob/f10995ed9810fd62f456ee2b5c3028e763ad05e0/docs/migration.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1968/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-758ba107a728fccfdf0d098b2c06ded59127dd53ea287d630f72fb51040bc72d
src/mcp/server/experimental/request_context.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-8d05f99b9f074e62f6f7dc4eb823393ef4218b9c2a7c5b4b966f941055e5242d
View file https://github.com/modelcontextprotocol/python-sdk/blob/f10995ed9810fd62f456ee2b5c3028e763ad05e0/src/mcp/server/experimental/request_context.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1968/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-8d05f99b9f074e62f6f7dc4eb823393ef4218b9c2a7c5b4b966f941055e5242d
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-8d05f99b9f074e62f6f7dc4eb823393ef4218b9c2a7c5b4b966f941055e5242d
src/mcp/server/experimental/task_result_handler.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-18b65113e22e1d5975f5a057cd352f32f933adaf3cd9c4484a8b40521298c223
View file https://github.com/modelcontextprotocol/python-sdk/blob/f10995ed9810fd62f456ee2b5c3028e763ad05e0/src/mcp/server/experimental/task_result_handler.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1968/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-18b65113e22e1d5975f5a057cd352f32f933adaf3cd9c4484a8b40521298c223
https://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-18b65113e22e1d5975f5a057cd352f32f933adaf3cd9c4484a8b40521298c223
src/mcp/server/lowlevel/__init__.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files#diff-23afa7c38ae84d72d250bef2c82600dea679b780385858d1f71047a5fa04e218
View file https://github.com/modelcontextprotocol/python-sdk/blob/f10995ed9810fd62f456ee2b5c3028e763ad05e0/src/mcp/server/lowlevel/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/1968/{{ revealButtonHref }}
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/1968/files
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.