René's URL Explorer Experiment


Title: Add the todos-server reference example by maxisbey · Pull Request #3048 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Add the todos-server reference example by maxisbey · Pull Request #3048 · modelcontextprotocol/python-sdk

X Title: Add the todos-server reference example by maxisbey · Pull Request #3048 · modelcontextprotocol/python-sdk

Description: Adds examples/servers/todos-server/ — a Python port of the TypeScript SDK's reference server, examples/todos-server: a small project todo board where every server-side MCP feature has a real job, built on the high-level MCPServer. Motivation and Context The TypeScript SDK ships a reference host/server pair (cli-client + todos-server) that exercises tools, resources, prompts, sampling, elicitation, multi-round input_required flows, progress, logging, and subscriptions in one small, readable app, serving both protocol revisions (2026-07-28 and 2025-11-25) over stdio and Streamable HTTP. This PR brings the server half to the Python SDK so the two SDKs have a directly comparable reference workload — the TS cli-client connects to this server out of the box over HTTP. Notable porting decisions (details in the example README's "Fidelity" section): The three interactive tools (clear_done, prioritize, brainstorm_tasks) are written once as resolver dependencies (Resolve + Elicit/Sample, the latter from #3049): the framework carries the questions as InputRequiredResult rounds on 2026-07-28 connections and as push-style requests on pre-2026 ones, so no handler branches on the era and the example does no round bookkeeping. brainstorm_tasks shows the multi-round shape as a resolver chain — count/theme form → conditional custom-amount form → sampling round derived from the recorded answers. resources/subscribe/unsubscribe, logging/setLevel, and a dynamic resources/list (one entry per task, like the TS ResourceTemplate list callback) are registered on the low-level server via mcp._lowlevel_server.add_request_handler — the same pattern (and TODO(felix) gap) as the everything-server. Logging honours logging/setLevel on 2025 sessions and the per-request io.modelcontextprotocol/logLevel _meta opt-in on 2026-07-28 sessions, matching the TS server's semantics. The multi-round state is minted by the resolver framework and sealed by the server; REQUEST_STATE_SECRET maps to RequestStateSecurity(keys=[...]) like the TS example's HMAC env key. How Has This Been Tested? Drove this server and the TS reference server through an identical scripted scenario (~38 steps: all eight tools including the three-round brainstorm flow and its decline/cancel branches, resources, templates, prompts, completions, progress, logging thresholds, subscriptions) with the same client and scripted elicitation/sampling callbacks: stdio × both eras: every tool result text, structured output, elicitation form, sampling request, progress sequence, and log line matches the TS server — the resolver-generated elicitation form schemas are byte-identical to the TS literals. After normalizing pydantic-vs-zod JSON Schema cosmetics on tool schemas, the only remaining differences are SDK-level (Python includes the prompt description in prompts/get results and advertises experimental: {} on legacy initialize). Streamable HTTP × both eras: modern-era results identical, including subscriptions/listen streams (ack + per-mutation board updates on both servers). On the legacy HTTP leg the Python server's default stateful sessions serve push-style elicitation/sampling, where the TS server's stateless posture refuses (its documented caveat). The TS entry has since moved to its protected HTTP wiring (createMcpHonoApp, loopback bind + localhost Host/Origin validation); the Python entry gets the equivalent from the SDK's streamable-HTTP defaults, noted in server.py. Adversarial probes: schema-violating arguments and whitespace-only sampling replies match the TS semantics; out-of-range elicited answers fail the resolver framework's schema validation. A client without the sampling/elicitation capability now gets a structured -32021 error from both servers on 2026-07-28 connections (the TS SDK's capability gate); on pre-2026 connections the TS server reports an isError tool result where this server still answers -32021 — README fidelity section updated accordingly. Cancelling work_through_tasks mid-flight stops the loop on both eras (after #3046); the README documents the remaining granularity difference vs TS. uv run --frozen ruff format --check, ruff check, pyright (strict, root config), and the full pre-commit suite pass. Breaking Changes None — example only; no src/ changes. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context Two SDK gaps surfaced while verifying parity, documented in the example README rather than worked around: subscriptions/listen is not served over stdio (2026-era stdio clients get METHOD_NOT_FOUND, so board-change notifications over stdio reach 2025-era subscribers only), and there is no public seam to advertise listChanged capabilities to pre-2026 HTTP clients (serve_stdio patches the stdio path via the low-level server). A third gap noted in the first revision — no courtesy notifications/cancelled from the client on 2026-era transports — was fixed by #3046. Re-checked against current main after the latest rebase: both remaining gaps still stand, and nothing that landed since (the client-side Client.listen() driver from #3047, the httpx2 swap, Streamable HTTP body limits) changes the example's server-side surface. The README now points 2026-era watchers at client.listen(...) and its docs page. AI Disclaimer

Open Graph Description: Adds examples/servers/todos-server/ — a Python port of the TypeScript SDK's reference server, examples/todos-server: a small project todo board where every server-side MCP feature has a real jo...

X Description: Adds examples/servers/todos-server/ — a Python port of the TypeScript SDK's reference server, examples/todos-server: a small project todo board where every server-side MCP feature has a rea...

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

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:e18cf272-bc2f-2520-28bf-0a41bb622ba0
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id82E6:1E1ACC:231A466:2EFDB1B:6A5BDB74
html-safe-noncedd648cafbb7e788e5b6171d98ba2d5bbadcadc683d82fa7fdea50e2d2f5bbf2d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkU2OjFFMUFDQzoyMzFBNDY2OjJFRkRCMUI6NkE1QkRCNzQiLCJ2aXNpdG9yX2lkIjoiMjQzNDM2ODkxNTE5MzQ1MzQyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac88a0804f9b1e6090b15d97fd9a6220831b6ed40b90bed7b7985ca8ca765bef6b
hovercard-subject-tagpull_request:3973307418
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/3048/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:altAdds examples/servers/todos-server/ — a Python port of the TypeScript SDK's reference server, examples/todos-server: a small project todo board where every server-side MCP feature has a real jo...
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/3048/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3048%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%2F3048%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/3048/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/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.6k https://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk
Code https://github.com/modelcontextprotocol/python-sdk
Issues 259 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 307 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
todos-server-examplehttps://github.com/modelcontextprotocol/python-sdk/tree/todos-server-example
Conversation 8 https://github.com/modelcontextprotocol/python-sdk/pull/3048
Commits 3 https://github.com/modelcontextprotocol/python-sdk/pull/3048/commits
Checks 33 https://github.com/modelcontextprotocol/python-sdk/pull/3048/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Add the todos-server reference example https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#top
Show all changes 3 commits https://github.com/modelcontextprotocol/python-sdk/pull/3048/files
e950a81 Add the todos-server reference example maxisbey Jul 1, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3048/commits/e950a81309a87b0033a79cedbb7d507a98f1fb39
1ec54ed Adopt the resolver framework for the interactive tools maxisbey Jul 6, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3048/commits/1ec54edba7aed0f2541d0ad8115dde71f61ce005
a05dd3d Polish the todos-server example after rebasing onto latest main maxisbey Jul 16, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3048/commits/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
README.md https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-49aaa2819e35a856818ecec8c9fa7e1c79ad028d3f44bd749736353cfb51bac9
README.md https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-89f355e897bf3c1d2d428f66f70e0586a9f0dd934f949d8ec2d72e6dc3333d84
__init__.py https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-720db76a21dc53c4dc726f4814e6674556e62521e409d9173cb448dadc80bb97
__main__.py https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-e72587e0fec73ebdfb10ef62564a865895c25244ff26e48e2a111a87b7070da9
server.py https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-03f23ea1f84eaf2e8e9aa0aa4ce33c5abd923e851a9e542c215935bd19f1fdbe
todos.py https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-81743a68d31e24b426fbcc55f59bb221eba7a9b836fad60fe0c0d2bee1635259
pyproject.toml https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-2143a07753c552e1d06ac2a1af482e0a6af8639405a54197858099db37641696
uv.lock https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-84321598744d84dbee2318e634c74c9aae39a1c253f1c4bd17ebf9ef2f807b11
examples/README.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-49aaa2819e35a856818ecec8c9fa7e1c79ad028d3f44bd749736353cfb51bac9
View file https://github.com/modelcontextprotocol/python-sdk/blob/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5/examples/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3048/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-49aaa2819e35a856818ecec8c9fa7e1c79ad028d3f44bd749736353cfb51bac9
https://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-49aaa2819e35a856818ecec8c9fa7e1c79ad028d3f44bd749736353cfb51bac9
examples/servers/todos-server/README.mdhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-89f355e897bf3c1d2d428f66f70e0586a9f0dd934f949d8ec2d72e6dc3333d84
View file https://github.com/modelcontextprotocol/python-sdk/blob/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5/examples/servers/todos-server/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3048/{{ revealButtonHref }}
examples/servers/todos-server/mcp_todos_server/__init__.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-720db76a21dc53c4dc726f4814e6674556e62521e409d9173cb448dadc80bb97
View file https://github.com/modelcontextprotocol/python-sdk/blob/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5/examples/servers/todos-server/mcp_todos_server/__init__.py
Open in desktop https://desktop.github.com
examples/servers/todos-server/mcp_todos_server/__main__.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-e72587e0fec73ebdfb10ef62564a865895c25244ff26e48e2a111a87b7070da9
View file https://github.com/modelcontextprotocol/python-sdk/blob/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5/examples/servers/todos-server/mcp_todos_server/__main__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3048/{{ revealButtonHref }}
examples/servers/todos-server/mcp_todos_server/server.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files#diff-03f23ea1f84eaf2e8e9aa0aa4ce33c5abd923e851a9e542c215935bd19f1fdbe
View file https://github.com/modelcontextprotocol/python-sdk/blob/a05dd3da0c7cb4dfd835f5607454e38443fbd8b5/examples/servers/todos-server/mcp_todos_server/server.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3048/{{ revealButtonHref }}
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3048/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.