René's URL Explorer Experiment


Title: MCPServer serves subscriptions/listen and advertises listChanged=true unconditionally — hold-open streams pin serverless invocations to the platform timeout · Issue #3493 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: MCPServer serves subscriptions/listen and advertises listChanged=true unconditionally — hold-open streams pin serverless invocations to the platform timeout · Issue #3493 · modelcontextprotocol/python-sdk

X Title: MCPServer serves subscriptions/listen and advertises listChanged=true unconditionally — hold-open streams pin serverless invocations to the platform timeout · Issue #3493 · modelcontextprotocol/python-sdk

Description: Summary MCPServer always registers the subscriptions/listen handler (on_subscriptions_listen=ListenHandler(self._subscriptions)), and Server.get_capabilities() derives tools/prompts/resources.listChanged = true and resources.subscribe = ...

Open Graph Description: Summary MCPServer always registers the subscriptions/listen handler (on_subscriptions_listen=ListenHandler(self._subscriptions)), and Server.get_capabilities() derives tools/prompts/resources.listC...

X Description: Summary MCPServer always registers the subscriptions/listen handler (on_subscriptions_listen=ListenHandler(self._subscriptions)), and Server.get_capabilities() derives tools/prompts/resources.listC...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3493

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MCPServer serves subscriptions/listen and advertises listChanged=true unconditionally — hold-open streams pin serverless invocations to the platform timeout","articleBody":"## Summary\n\n`MCPServer` always registers the `subscriptions/listen` handler (`on_subscriptions_listen=ListenHandler(self._subscriptions)`), and `Server.get_capabilities()` derives `tools/prompts/resources.listChanged = true` and `resources.subscribe = true` from the mere presence of that handler on the 2026-07-28 wire. A server that never publishes any change notification therefore advertises subscriptions, 2026-era clients open `subscriptions/listen`, and the response stream stays open until the client closes it (as specified).\n\nOn serverless HTTP platforms where a client disconnect does not propagate to the app (AWS Lambda Function URL with response streaming behind Lambda Web Adapter, in our case), every such stream pins one invocation until the platform timeout. There is no public way to opt out.\n\nThis is the same failure mode as #3492 (legacy GET stream), now on the modern wire.\n\n## Environment\n\n- mcp 2.1.1 (local reproduction) and 2.2.0 (production, same behaviour)\n- `MCPServer(...)` + `mcp.streamable_http_app(streamable_http_path=\"/\", stateless_http=True, transport_security=...)`, no `json_response`\n- uvicorn 0.52.4 (uvloop + httptools), sse-starlette 3.4.8, Python 3.12\n- AWS Lambda (container image, Function URL `RESPONSE_STREAM`, aws-lambda-web-adapter 0.9.1) — client disconnects never reach the ASGI app\n- Clients: TypeScript SDK based (auto-open listen on connect) and a hosted connector\n\n## Reproduction (no Lambda needed)\n\n```python\nimport asyncio, json\nfrom mcp.server.mcpserver import MCPServer\n\nmcp = MCPServer(\"demo\")\n\n@mcp.tool()\nasync def hello() -> str:\n    return \"hi\"\n\nmcp.streamable_http_app(streamable_http_path=\"/\", stateless_http=True)\nsm = mcp.session_manager\n\nMETA = {\"io.modelcontextprotocol/protocolVersion\": \"2026-07-28\",\n        \"io.modelcontextprotocol/clientInfo\": {\"name\": \"probe\", \"version\": \"1\"},\n        \"io.modelcontextprotocol/clientCapabilities\": {}}\n\ndef scope(body, method):\n    return {\"type\": \"http\", \"http_version\": \"1.1\", \"method\": \"POST\", \"scheme\": \"http\", \"path\": \"/\",\n            \"raw_path\": b\"/\", \"query_string\": b\"\", \"server\": (\"localhost\", 3000), \"client\": (\"127.0.0.1\", 1),\n            \"headers\": [(b\"host\", b\"localhost\"), (b\"accept\", b\"application/json, text/event-stream\"),\n                        (b\"content-type\", b\"application/json\"), (b\"content-length\", str(len(body)).encode()),\n                        (b\"mcp-protocol-version\", b\"2026-07-28\"), (b\"mcp-method\", method.encode())]}\n\nasync def post(msg, timeout=3):\n    body = json.dumps(msg).encode(); got = False\n    async def receive():\n        nonlocal got\n        if not got:\n            got = True\n            return {\"type\": \"http.request\", \"body\": body, \"more_body\": False}\n        await asyncio.sleep(3600)          # like Lambda: no http.disconnect ever arrives\n    events, done = [], asyncio.Event()\n    async def send(m):\n        events.append(m)\n        if m[\"type\"] == \"http.response.body\" and not m.get(\"more_body\", False):\n            done.set()\n    task = asyncio.create_task(sm.handle_request(scope(body, msg[\"method\"]), receive, send))\n    try:\n        await asyncio.wait_for(done.wait(), timeout); print(msg[\"method\"], \"completed\")\n    except asyncio.TimeoutError:\n        print(msg[\"method\"], \"STILL OPEN after\", timeout, \"s\")\n    print(\"  \", b\"\".join(e.get(\"body\", b\"\") for e in events if e[\"type\"] == \"http.response.body\")[:200])\n    task.cancel()\n\nasync def main():\n    async with sm.run():\n        await post({\"jsonrpc\": \"2.0\", \"id\": \"d1\", \"method\": \"server/discover\", \"params\": {\"_meta\": META}})\n        await post({\"jsonrpc\": \"2.0\", \"id\": \"listen:1\", \"method\": \"subscriptions/listen\",\n                    \"params\": {\"_meta\": META, \"notifications\": {\"toolsListChanged\": True}}})\n\nasyncio.run(main())\n```\n\nOutput:\n\n```\nserver/discover completed\n   {\"jsonrpc\":\"2.0\",\"id\":\"d1\",\"result\":{\"cacheScope\":\"private\",\"capabilities\":{\"prompts\":{\"listChanged\":true},\"resources\":{\"listChanged\":true,\"subscribe\":true},\"tools\":{\"listChanged\":true}}, ...\nsubscriptions/listen STILL OPEN after 3 s\n   event: message\\r\\ndata: {\"jsonrpc\":\"2.0\",\"method\":\"notifications/subscriptions/acknowledged\",\"params\":{\"_meta\":{\"io.modelcontextprotocol/subscriptionId\":\"listen:1\"},\"notifications\":{\"toolsListChanged\":true}}}\n```\n\nThe server has nothing it could ever publish, yet it advertises `listChanged: true` and holds the listen stream open.\n\n## Impact observed in production\n\nAfter migrating from mcp 1.29 (FastMCP) to 2.x, the only method that never completed was `subscriptions/listen`: in a 30-minute sample, 19 of 19 listen POSTs were still unanswered after 60 s while every other method (tools/call, tools/list, prompts/list, resources/list, server/discover, initialize) completed in milliseconds. Each open stream ran to the Lambda timeout (900 s); ~1,300–1,800 such invocations per day accounted for 99% of the function's billed GB-seconds. Clients re-sent the listen request immediately after each timeout, so the streams were permanently occupied.\n\n## Current workaround\n\n```python\nmcp._lowlevel_server._request_handlers.pop(\"subscriptions/listen\")\n```\n\nWith the handler gone, `get_capabilities()` reports `listChanged: false / subscribe: false`, and a listen POST gets the SDK's standard `404` + JSON-RPC `-32601`, which the TypeScript client treats as a soft error (\"a failed auto-open MUST NOT fail connect\"). It works, but it depends on two private attributes.\n\n## Request\n\nA public way to run a server without `subscriptions/listen`, for example `MCPServer(subscriptions=None)` meaning \"not served\" (today `None` means \"use the in-memory bus\"), or an explicit `listen=False` / `serve_subscriptions=False` flag — and have `get_capabilities()` derive `listChanged=false` from it, as it already does from handler presence. Alternatively, a documented guidance for stateless/serverless deployments.\n\nThanks for the SDK — the 2.x transport is otherwise working well for us.\n","author":{"url":"https://github.com/tomoki-takahashi-oisix","@type":"Person","name":"tomoki-takahashi-oisix"},"datePublished":"2026-09-11T12:08:24Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3493"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:25bd7e0d-33ac-a356-364f-de234f7c3b45
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8E3E:F8826:276A9AC:33DCB6C:6B055D13
html-safe-nonce47e4ba524afa12a0614fd8123f5880a8dda577b42190e4fe788f13931be7304e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTNFOkY4ODI2OjI3NkE5QUM6MzNEQ0I2Qzo2QjA1NUQxMyIsInZpc2l0b3JfaWQiOiI1OTk2MDQwODg4Mzg2OTM2MDgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac972c4da1f8ba1dc0b40c72f564f1b14c8eb991e56117fa11d92f111a0e10de87
hovercard-subject-tagissue:5424111684
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3493/issue_layout
twitter:imagehttps://opengraph.githubassets.com/77b0385d40e9fca361998eeb7900694925f1110b837029553cfdbca20fdbe4e8/modelcontextprotocol/python-sdk/issues/3493
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/77b0385d40e9fca361998eeb7900694925f1110b837029553cfdbca20fdbe4e8/modelcontextprotocol/python-sdk/issues/3493
og:image:altSummary MCPServer always registers the subscriptions/listen handler (on_subscriptions_listen=ListenHandler(self._subscriptions)), and Server.get_capabilities() derives tools/prompts/resources.listC...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametomoki-takahashi-oisix
hostnamegithub.com
expected-hostnamegithub.com
None8a6760da3cce5e2d079d07e3b62df71194316c4478db1a5e38050f44fce72c72
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8327739ac0648b9c3c722b5f401f7338553936b8
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3493#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3493
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3493
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3493
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3493
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3493
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues320 (320)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
https://github.com/modelcontextprotocol/python-sdk
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3493
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3493
MCPServer serves subscriptions/listen and advertises listChanged=true unconditionally — hold-open streams pin serverless invocations to the platform timeouthttps://github.com/modelcontextprotocol/python-sdk/issues/3493#top
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/tomoki-takahashi-oisix
tomoki-takahashi-oisixhttps://github.com/tomoki-takahashi-oisix
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issue-5424111684
#3492https://github.com/modelcontextprotocol/python-sdk/issues/3492
claudehttps://github.com/apps/claude
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#event-30971907407
https://github.com/Ben-Home
Ben-Homehttps://github.com/Ben-Home
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5635579017
https://github.com/owlofjaylan
owlofjaylanhttps://github.com/owlofjaylan
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5635932909
#3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
@maintainershttps://github.com/maintainers
https://github.com/mikerva
mikervahttps://github.com/mikerva
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5635981479
@owlofjaylanhttps://github.com/owlofjaylan
https://github.com/tomoki-takahashi-oisix
tomoki-takahashi-oisixhttps://github.com/tomoki-takahashi-oisix
on Sep 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5657234515
#3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Oct 1, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5931647537
#3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
#3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
maxisbeyhttps://github.com/maxisbey
duplicatehttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Aduplicate
[v2] Allow MCPServer to disable subscriptions/listen #3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
on Oct 1, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#event-32251537125
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3493#issuecomment-5957268951
#3357https://github.com/modelcontextprotocol/python-sdk/issues/3357
#3626https://github.com/modelcontextprotocol/python-sdk/pull/3626
Turning it offhttps://py.sdk.modelcontextprotocol.io/handlers/subscriptions/#turning-it-off
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3493
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3493
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.