Title: [v2] Allow MCPServer to disable subscriptions/listen · Issue #3357 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: [v2] Allow MCPServer to disable subscriptions/listen · Issue #3357 · modelcontextprotocol/python-sdk
X Title: [v2] Allow MCPServer to disable subscriptions/listen · Issue #3357 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before openi...
Open Graph Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontex...
X Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/mod...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3357
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[v2] Allow MCPServer to disable subscriptions/listen","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Release line\n\n2.x (current stable)\n\n### Description\n\n#### What happened?\n`MCPServer` always installs a `subscriptions/listen` handler:\n```python\non_subscriptions_listen=ListenHandler(self._subscriptions)\n```\nThe constructor exposes `subscriptions: SubscriptionBus | None = None`, but `None` creates an `InMemorySubscriptionBus`; it does not disable subscriptions.\n\nThis causes `server/discover` to advertise:\n```json\n{\n \"tools\": {\"listChanged\": true},\n \"prompts\": {\"listChanged\": true},\n \"resources\": {\"listChanged\": true, \"subscribe\": true}\n}\n```\nOur MCP server has a static catalog and never publishes change notifications. It runs as a stateless Streamable HTTP server on AWS Lambda.\n\nClaude Code 2.1.235 automatically opened four subscriptions/listen streams during discovery. Each request followed the long-lived SSE path and held a Lambda invocation until timeout.\n\nWe currently reject these requests in ASGI middleware. This prevents the timeout, but the server still advertises subscription support, so clients continue attempting the requests.\n\nThe low-level Server supports disabling this correctly through:\n```python\nServer(..., on_subscriptions_listen=None)\n```\nThe high-level `MCPServer` has no equivalent public option. Removing the handler through `_lowlevel_server._request_handlers` works, but relies on private internals.\n\n#### What did you expect?\n``MCPServer`` should provide a supported opt-out, for example:\n```python\nMCPServer(..., subscriptions=False)\n```\nor:\n```python\nMCPServer(..., enable_subscriptions=False)\n```\nWhen disabled:\n- `subscriptions/listen` should not be registered.\n- server/discover should advertise the relevant change and subscription capabilities as false.\n- An unsolicited subscriptions/listen call should return Method not found.\n- Existing behavior should remain the default for compatibility.\nThis matches SEP-2575’s stateless-first, “pay as you go” design. Long-lived streams should only be enabled when the server uses them.\n\n#### Area\n`Server`\n\n#### References\n- [SEP-2575](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/seps/2575-stateless-mcp.md)\n- [Subscription implementation PR #3035](https://github.com/modelcontextprotocol/python-sdk/pull/3035)\n- [Capabilities issue #2896](https://github.com/modelcontextprotocol/python-sdk/issues/2896)\n\nAI assistance disclosure: I used an AI coding assistant to inspect the SDK source and help draft this report. I reviewed and verified the contents.\n\n### Example Code\n\n```Python\nfrom mcp.server import MCPServer\n\nserver = MCPServer(\"static-server\")\n\ncapabilities = server._lowlevel_server.get_capabilities(\n protocol_version=\"2026-07-28\"\n)\n\nprint(capabilities.model_dump(by_alias=True, exclude_none=True))\n```\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.11\nmcp 2.0.0\nAWS Lambda\nStreamable HTTP\njson_response=True\nstateless_http=True\n```","author":{"url":"https://github.com/owlofjaylan","@type":"Person","name":"owlofjaylan"},"datePublished":"2026-08-21T19:18:08Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3357"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:25baeda9-9f6c-70c9-e1dc-7e2a58e6d3da |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 841A:199A0D:29FEE22:370DFCB:6B055D16 |
| html-safe-nonce | cdb6913be35d0be368186112303ad4a86c86be27b7c00ef345eb330a7c1d8c59 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDFBOjE5OUEwRDoyOUZFRTIyOjM3MERGQ0I6NkIwNTVEMTYiLCJ2aXNpdG9yX2lkIjoiNjQzMjQzNTg2ODA0MDI1Njc5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9b1cefe393bcaa4d45aa1ffdec57339a20a6b88ddc3fe709e6f7ec2fa8d71676 |
| hovercard-subject-tag | issue:5217414270 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3357/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0a6c5b13480dc83a010390f339fbed2b81b1cdbb96cc2d0001605767c15798c/modelcontextprotocol/python-sdk/issues/3357 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0a6c5b13480dc83a010390f339fbed2b81b1cdbb96cc2d0001605767c15798c/modelcontextprotocol/python-sdk/issues/3357 |
| og:image:alt | Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontex... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | owlofjaylan |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8a6760da3cce5e2d079d07e3b62df71194316c4478db1a5e38050f44fce72c72 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8327739ac0648b9c3c722b5f401f7338553936b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width