René's URL Explorer Experiment


Title: FastMCP server with SSE transport fails to shut down on a signal · Issue #514 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: FastMCP server with SSE transport fails to shut down on a signal · Issue #514 · modelcontextprotocol/python-sdk

X Title: FastMCP server with SSE transport fails to shut down on a signal · Issue #514 · modelcontextprotocol/python-sdk

Description: A very simple server fails to shut down on a signal if it processed at least one request: ❯ python test-server.py --port=8085 INFO: Started server process [216035] INFO: Waiting for application startup. INFO: Application startup complete...

Open Graph Description: A very simple server fails to shut down on a signal if it processed at least one request: ❯ python test-server.py --port=8085 INFO: Started server process [216035] INFO: Waiting for application sta...

X Description: A very simple server fails to shut down on a signal if it processed at least one request: ❯ python test-server.py --port=8085 INFO: Started server process [216035] INFO: Waiting for application sta...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"FastMCP server with SSE transport fails to shut down on a signal","articleBody":"A very simple server fails to shut down on a signal if it processed at least one request:\n\n```\n❯ python test-server.py --port=8085\nINFO:     Started server process [216035]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8085 (Press CTRL+C to quit)\nINFO:     127.0.0.1:55188 - \"GET /sse HTTP/1.1\" 200 OK\nINFO:     127.0.0.1:55192 - \"POST /messages/?session_id=e690de9733914d09aebf2b0e8c78191c HTTP/1.1\" 202 Accepted\nINFO:     127.0.0.1:55192 - \"POST /messages/?session_id=e690de9733914d09aebf2b0e8c78191c HTTP/1.1\" 202 Accepted\nINFO:     127.0.0.1:55192 - \"POST /messages/?session_id=e690de9733914d09aebf2b0e8c78191c HTTP/1.1\" 202 Accepted\nProcessing request of type CallToolRequest\n^CINFO:     Shutting down\nINFO:     Waiting for background tasks to complete. (CTRL+C to force quit)\n```\n\nThe expected behaviour would be:\n\n```\n❯ python test-server.py --port=8085\nINFO:     Started server process [216006]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8085 (Press CTRL+C to quit)\n^CINFO:     Shutting down\nINFO:     Waiting for application shutdown.\nINFO:     Application shutdown complete.\nINFO:     Finished server process [216006]\n```\n\nHere is the code for both the server and the client.\n\nWhat do I miss?\n\nthe server\n\n```\nimport click\nimport sys\nfrom pydantic import Field\nfrom mcp.server.fastmcp import FastMCP\n\n@click.command()\n@click.option(\"--port\", default=8085, help=\"Port to listen\", type=int)\ndef main(port: int):\n    mcp = FastMCP(\n        \"mcp-echo-tool\",\n        debug=True,\n        log_level=\"INFO\",\n        port=port,\n    )\n\n    @mcp.tool(name=\"echo\")\n    async def echo_tool(string: str = Field(description=\"A string to echo back\")) -\u003e str:\n        \"\"\"Echoes back the input string\"\"\"\n        return string\n\n    mcp.run(transport='sse')\n    return 0\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\nand the client\n\n```\nimport asyncio\nimport click\nimport sys\nfrom mcp.client.session import ClientSession\nfrom mcp.client.sse import sse_client\n\nasync def client(url, string):\n    async with sse_client(url) as (read, write):\n        async with ClientSession(read, write) as session:\n            await session.initialize()\n            result = await session.call_tool(\"echo\", {\"string\": string})\n            print(result.content)\n\n@click.command()\n@click.option('--url', default='http://localhost:8085', help='MCP Server URL', type=str)\n@click.argument('string', type=str)\ndef main(url: str, string: str):\n    asyncio.run(client(url, string))\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\n","author":{"url":"https://github.com/growler","@type":"Person","name":"growler"},"datePublished":"2025-04-14T21:46:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/514/python-sdk/issues/514"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:e155ee0a-57c0-e15e-4a3d-3edbf84fe88f
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCDA6:2D8BE0:44B3AD:59E130:6A5FF2CC
html-safe-nonced55918b72e4bc64f9232441946127831ffbd46fdf4ace08e14ae8b4dbcca0bac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDREE2OjJEOEJFMDo0NEIzQUQ6NTlFMTMwOjZBNUZGMkNDIiwidmlzaXRvcl9pZCI6IjM5NzE4NjA2MTc4NDA1MjQyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacca2675ecb5f9ddeec153ae77d1d4fb4b84e2cacc484f55cd56e1949c497fb3e2
hovercard-subject-tagissue:2994309207
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/514/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aae363a129508888ef64653a52480f8e1ffdae05582f1e863ac9e38e2584d9a6/modelcontextprotocol/python-sdk/issues/514
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aae363a129508888ef64653a52480f8e1ffdae05582f1e863ac9e38e2584d9a6/modelcontextprotocol/python-sdk/issues/514
og:image:altA very simple server fails to shut down on a signal if it processed at least one request: ❯ python test-server.py --port=8085 INFO: Started server process [216035] INFO: Waiting for application sta...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegrowler
hostnamegithub.com
expected-hostnamegithub.com
Noneec26f1a08b78b3d576999ee8b45a2abc017c95dbee903a8019940cd2e9bf7b3d
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
release0a29f0b91ade2368fc0b74327c0f64ec1f98f5ff
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/514#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F514
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%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F514
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%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/514
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/514
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/514
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/issues/514
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 265 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 312 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
FastMCP server with SSE transport fails to shut down on a signalhttps://github.com/modelcontextprotocol/python-sdk/issues/514#top
P3Nice to haves, rare edge caseshttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P3%22
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%22
https://github.com/growler
growlerhttps://github.com/growler
on Apr 14, 2025https://github.com/modelcontextprotocol/python-sdk/issues/514#issue-2994309207
P3Nice to haves, rare edge caseshttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P3%22
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
ready for workEnough information for someone to start working onhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22ready%20for%20work%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

Viewport: width=device-width


URLs of crawlers that visited me.