René's URL Explorer Experiment


Title: 401 Unauthorized · Issue #611 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: 401 Unauthorized · Issue #611 · modelcontextprotocol/python-sdk

X Title: 401 Unauthorized · Issue #611 · modelcontextprotocol/python-sdk

Description: Describe the bug Connecting from OpenAI SDK gives 401 Unauthorized, pretty sure #255 is related from 1.7.0 release. This worked with 1.6.0 To Reproduce Ubuntu 24.10 Python 3.12.7 pip install \ mcp==1.7.0 \ openai==1.76.2 \ openai-agents=...

Open Graph Description: Describe the bug Connecting from OpenAI SDK gives 401 Unauthorized, pretty sure #255 is related from 1.7.0 release. This worked with 1.6.0 To Reproduce Ubuntu 24.10 Python 3.12.7 pip install \ mcp=...

X Description: Describe the bug Connecting from OpenAI SDK gives 401 Unauthorized, pretty sure #255 is related from 1.7.0 release. This worked with 1.6.0 To Reproduce Ubuntu 24.10 Python 3.12.7 pip install \ mcp=...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"401 Unauthorized","articleBody":"**Describe the bug**\n\nConnecting from OpenAI SDK gives `401 Unauthorized`, pretty sure https://github.com/modelcontextprotocol/python-sdk/pull/255 is related from 1.7.0 release. This worked with `1.6.0`\n\n**To Reproduce**\n\n- Ubuntu 24.10\n- Python 3.12.7\n\n```bash\npip install \\\n  mcp==1.7.0 \\\n  openai==1.76.2 \\\n  openai-agents==0.0.14\n```\n\n\n**openai_agent_mcp.py**\n\n```python\nimport asyncio\n\nimport agents.mcp as openai_agents_mcp\nfrom agents import Agent, Runner\n\n\nasync def main():\n    async with openai_agents_mcp.MCPServerSse(\n        name=\"files\",\n        params={\n            \"url\": f\"http://localhost:8000/sse\",\n        },\n    ) as mcp_server:\n\n        agent = Agent(\n            name=\"Assistant\",\n            instructions=\"Use the tools to read the filesystem and answer questions based on those files.\",\n            mcp_servers=[mcp_server],\n        )\n\n        # List the files it can read\n        message = \"Read the os-release file and tell us what OS we are on\"\n        print(f\"Running: {message}\")\n        result = await Runner.run(starting_agent=agent, input=message)\n        print(result.final_output)\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n\n```\n\n**mcp_server_files.py**\n\n```python\nimport sys\nimport click\nimport pathlib\n\nimport uvicorn\nfrom mcp.server.fastmcp import FastMCP\n\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG)\n\n\nos_release_path = pathlib.Path(\"/usr/lib/os-release\")\nif not os_release_path.exists():\n    os_release_path = pathlib.Path(\"/etc/os-release\")\nif not os_release_path.exists():\n    os_release_path = pathlib.Path(__file__)\n\n\nSAMPLE_RESOURCES = {\n    \"/usr/lib/os-release\": os_release_path.read_text(),\n    \"/etc/os-release\": os_release_path.read_text(),\n}\n\n\n@click.command()\n@click.option(\"--port\", default=8000, help=\"Port to listen on for SSE\")\n@click.option(\n    \"--transport\",\n    type=click.Choice([\"stdio\", \"sse\"]),\n    default=\"stdio\",\n    help=\"Transport type\",\n)\ndef main(port: int, transport: str) -\u003e int:\n    # Create server\n    mcp = FastMCP(\"OS info sever\")\n\n\n    @mcp.tool()\n    def get_files() -\u003e list[str]:\n        print(\"[debug-server] get_files()\")\n        return list(SAMPLE_RESOURCES.keys())\n\n\n    @mcp.tool()\n    def get_file_content(file: str) -\u003e str:\n        print(\"[debug-server] get_file_content()\")\n        return SAMPLE_RESOURCES[file]\n\n\n    mcp.run(transport=\"sse\")\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\n**Expected behavior**\n\n```\nDEBUG:mcp.server.sse:Setting up SSE connection\nDEBUG:mcp.server.sse:Created new session with ID: 4c94bb47-1858-45f1-8f07-9a2cc31ae840\nDEBUG:mcp.server.sse:Starting SSE response task\nDEBUG:mcp.server.sse:Yielding read and write streams\nINFO:     127.0.0.1:62467 - \"GET /sse HTTP/1.1\" 200 OK\n```\n\n**Screenshots**\n\n```\nDEBUG:mcp.server.lowlevel.server:Registering handler for ListToolsRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for CallToolRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for ListResourcesRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for ReadResourceRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for PromptListRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for GetPromptRequest\nDEBUG:mcp.server.lowlevel.server:Registering handler for ListResourceTemplatesRequest\nDEBUG:asyncio:Using selector: KqueueSelector\nDEBUG:mcp.server.sse:SseServerTransport initialized with endpoint: /messages/\nINFO:     Started server process [60590]\nINFO:     Waiting for application startup.\nINFO:     Application startup complete.\nINFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)\nINFO:     127.0.0.1:62493 - \"GET /sse HTTP/1.1\" 401 Unauthorized\n```\n\n```\nError initializing MCP server: unhandled errors in a TaskGroup (1 sub-exception)\n  + Exception Group Traceback (most recent call last):\n  |   File \"/home/johnandersen777/sshai-client/openai_agent_mcp.py\", line 26, in \u003cmodule\u003e\n  |     asyncio.run(main())\n  |   File \"/usr/lib/python3.12/asyncio/runners.py\", line 194, in run\n  |     return runner.run(main)\n  |            ^^^^^^^^^^^^^^^^\n  |   File \"/usr/lib/python3.12/asyncio/runners.py\", line 118, in run\n  |     return self._loop.run_until_complete(task)\n  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  |   File \"/usr/lib/python3.12/asyncio/base_events.py\", line 687, in run_until_complete\n  |     return future.result()\n  |            ^^^^^^^^^^^^^^^\n  |   File \"/home/johnandersen777/sshai-client/openai_agent_mcp.py\", line 6, in main\n  |     async with openai_agents_mcp.MCPServerSse(\n  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/agents/mcp/server.py\", line 94, in __aenter__\n  |     await self.connect()\n  |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/agents/mcp/server.py\", line 107, in connect\n  |     transport = await self.exit_stack.enter_async_context(self.create_streams())\n  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  |   File \"/usr/lib/python3.12/contextlib.py\", line 659, in enter_async_context\n  |     result = await _enter(cm)\n  |              ^^^^^^^^^^^^^^^^\n  |   File \"/usr/lib/python3.12/contextlib.py\", line 210, in __aenter__\n  |     return await anext(self.gen)\n  |            ^^^^^^^^^^^^^^^^^^^^^\n  |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/mcp/client/sse.py\", line 43, in sse_client\n  |     async with anyio.create_task_group() as tg:\n  |                ^^^^^^^^^^^^^^^^^^^^^^^^^\n  |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py\", line 772, in __aexit__\n  |     raise BaseExceptionGroup(\n  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)\n  +-+---------------- 1 ----------------\n    | Traceback (most recent call last):\n    |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/mcp/client/sse.py\", line 53, in sse_client\n    |     event_source.response.raise_for_status()\n    |   File \"/home/johnandersen777/.local/.venv/lib/python3.12/site-packages/httpx/_models.py\", line 829, in raise_for_status\n    |     raise HTTPStatusError(message, request=request, response=self)\n    | httpx.HTTPStatusError: Client error '401 Unauthorized' for url 'http://localhost:8000/sse'\nFor more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401\n```\n","author":{"url":"https://github.com/johnandersen777","@type":"Person","name":"johnandersen777"},"datePublished":"2025-05-01T20:24:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/611/python-sdk/issues/611"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:691c4af6-0d45-40ed-a497-7cb2e808d672
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA930:19A853:11E3A5D:17F7FA0:6A5AAC8C
html-safe-nonce6edb683f1f0919fa9eaba8f510e2d07df0cd8dd8b77a75493c4eec8a839804de
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOTMwOjE5QTg1MzoxMUUzQTVEOjE3RjdGQTA6NkE1QUFDOEMiLCJ2aXNpdG9yX2lkIjoiNTUzNjIyNDA5NDg0NzY3NTUzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca4ce6d7c4495a9c2f4463ab65ec799dca5bc6210177857623066b80d07cf7fce
hovercard-subject-tagissue:3034646875
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/611/issue_layout
twitter:imagehttps://opengraph.githubassets.com/81db936f63169eb3b1a806a07a8003e13d6554a4d5b2efe2d2b865a55d59c933/modelcontextprotocol/python-sdk/issues/611
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/81db936f63169eb3b1a806a07a8003e13d6554a4d5b2efe2d2b865a55d59c933/modelcontextprotocol/python-sdk/issues/611
og:image:altDescribe the bug Connecting from OpenAI SDK gives 401 Unauthorized, pretty sure #255 is related from 1.7.0 release. This worked with 1.6.0 To Reproduce Ubuntu 24.10 Python 3.12.7 pip install \ mcp=...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejohnandersen777
hostnamegithub.com
expected-hostnamegithub.com
None21c53da6db0c40484841ba32fe19ecf485e7e734334faab487cd59d884d2bb33
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
release6e85f20f54e1147d8162094880590864abefff6b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/611#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F611
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%2Fissues%2F611
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/611
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/611
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/611
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/issues/611
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 257 https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests 303 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
#613https://github.com/modelcontextprotocol/python-sdk/issues/613
#613https://github.com/modelcontextprotocol/python-sdk/issues/613
401 Unauthorizedhttps://github.com/modelcontextprotocol/python-sdk/issues/611#top
https://github.com/johnandersen777
johnandersen777https://github.com/johnandersen777
on May 1, 2025https://github.com/modelcontextprotocol/python-sdk/issues/611#issue-3034646875
#255https://github.com/modelcontextprotocol/python-sdk/pull/255
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.