René's URL Explorer Experiment


Title: Authentication in High Level MCPServer · Issue #3283 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Authentication in High Level MCPServer · Issue #3283 · modelcontextprotocol/python-sdk

X Title: Authentication in High Level MCPServer · Issue #3283 · modelcontextprotocol/python-sdk

Description: Question I'm trying to understand the authentication model in the new MCP Python SDK v2. I want to implement the simplest possible authentication for a remote Streamable HTTP MCP server: The server has a pre-configured bearer token. The ...

Open Graph Description: Question I'm trying to understand the authentication model in the new MCP Python SDK v2. I want to implement the simplest possible authentication for a remote Streamable HTTP MCP server: The server...

X Description: Question I'm trying to understand the authentication model in the new MCP Python SDK v2. I want to implement the simplest possible authentication for a remote Streamable HTTP MCP server: The se...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Authentication in High Level MCPServer","articleBody":"## Question\n\nI'm trying to understand the authentication model in the new MCP Python SDK v2.\n\nI want to implement the simplest possible authentication for a **remote Streamable HTTP MCP server**:\n\n1. The server has a pre-configured bearer token.\n2. The client sends `Authorization: Bearer \u003ctoken>`.\n3. The server verifies the token.\n4. If valid, the MCP request is allowed.\n5. There is no OAuth login flow and no Authorization Server involved.\n\nI initially tried using `TokenVerifier`:\n\n```python\nclass StaticTokenVerifier(TokenVerifier):\n    async def verify_token(self, token: str) -> AccessToken | None:\n        if token == ACCESS_TOKEN:\n            return AccessToken(token=token)\n\n        return None\n```\n\nHowever, `MCPServer` requires `AuthSettings` whenever a `token_verifier` is supplied. `AuthSettings` in my version requires both `issuer_url` and `resource_server_url`.\n\nI don't understand why `issuer_url` is required for this use case. There is no Authorization Server issuing the token—the token is simply pre-configured on the MCP server.\n\nAdding `AuthSettings` also appears to cause the client to enter the OAuth discovery/authorization flow. For example, I encountered:\n\n```text\nThe connection is now reaching the OAuth authorization step,\nbut this server does not implement an /authorize endpoint.\n```\n\nI also encountered a protected-resource URL validation error when the URL differed only by `localhost` vs `127.0.0.1`:\n\n```text\nProtected resource [http://localhost:10000/mcp] does not match expected\n[http://127.0.0.1:10000/mcp] (or origin)\n```\n\nMy understanding is that `TokenVerifier` and the OAuth discovery/authorization-server configuration are separate concerns. The low-level SDK code appears to support `BearerAuthBackend(token_verifier)` independently, while `resource_server_url` is used for protected-resource metadata.\n\n**Is there a supported way in MCP Python SDK v2 to implement simple bearer-token authentication for Streamable HTTP without configuring an OAuth Authorization Server and without having to implement or manually compose Starlette middleware?**\n\nIn other words, I'm looking for the equivalent of:\n\n```text\nHTTP Request\n     ↓\nAuthorization: Bearer alice-token\n     ↓\nTokenVerifier\n     ↓\nvalid → MCP request\ninvalid → 401\n```\n\nwithout requiring:\n\n```text\nAuthorization Server\n    ↓\n/authorize\n/token\nOAuth discovery\nissuer_url\nresource_server_url\n```\n\nIs this supported by the high-level `MCPServer` API, or is OAuth intentionally a prerequisite for using `TokenVerifier`?\n","author":{"url":"https://github.com/saurabhlalsaxena","@type":"Person","name":"saurabhlalsaxena"},"datePublished":"2026-08-11T13:06:45Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3283"}

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:4893f5b0-9063-2714-5bd4-0d3f4672caef
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBDF0:6B887:93224:C1C8D:6B00B902
html-safe-noncecefdde28aca618b6b09095768b01962340e1ef450ea15ce479cad22bd2e4e391
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREYwOjZCODg3OjkzMjI0OkMxQzhEOjZCMDBCOTAyIiwidmlzaXRvcl9pZCI6IjI3MTgzMzQ1NjkyMTk2NjgyMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0b89b9d19d83ac4e42da57bc5f13f6b6c44bc686f2d4f3385ded9e4ed002824f
hovercard-subject-tagissue:5120491596
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/3283/issue_layout
twitter:imagehttps://opengraph.githubassets.com/12c6ee404acc31a780e2d64fe3d363a83f0f7d3118d9e67795c0099957f9c71e/modelcontextprotocol/python-sdk/issues/3283
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/12c6ee404acc31a780e2d64fe3d363a83f0f7d3118d9e67795c0099957f9c71e/modelcontextprotocol/python-sdk/issues/3283
og:image:altQuestion I'm trying to understand the authentication model in the new MCP Python SDK v2. I want to implement the simplest possible authentication for a remote Streamable HTTP MCP server: The server...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesaurabhlalsaxena
hostnamegithub.com
expected-hostnamegithub.com
None1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2
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
release5429cbfc6aca8c7b9a086a3c8f47400346f38cc9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3283#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3283
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%2F3283
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/3283
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3283
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3283
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues308 (308)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/3283
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3283
#3292https://github.com/modelcontextprotocol/python-sdk/pull/3292
Authentication in High Level MCPServerhttps://github.com/modelcontextprotocol/python-sdk/issues/3283#top
#3292https://github.com/modelcontextprotocol/python-sdk/pull/3292
P3Nice to haves, rare edge caseshttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P3%22
questionFurther information is requestedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22question%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/saurabhlalsaxena
saurabhlalsaxenahttps://github.com/saurabhlalsaxena
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#issue-5120491596
saurabhlalsaxenahttps://github.com/saurabhlalsaxena
questionFurther information is requestedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22question%22
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#event-29281061582
https://github.com/Ben-Home
Ben-Homehttps://github.com/Ben-Home
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#issuecomment-5254243272
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#issuecomment-5254538736
examples/stories/bearer_auth/https://github.com/modelcontextprotocol/python-sdk/tree/main/examples/stories/bearer_auth
docs/client/transports.mdhttps://github.com/modelcontextprotocol/python-sdk/blob/main/docs/client/transports.md#bring-your-own-httpx2asyncclient
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
https://github.com/saurabhlalsaxena
saurabhlalsaxenahttps://github.com/saurabhlalsaxena
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#issuecomment-5254962348
https://github.com/saurabhlalsaxena
saurabhlalsaxenahttps://github.com/saurabhlalsaxena
on Aug 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#issuecomment-5255205141
maxisbeyhttps://github.com/maxisbey
P3Nice to haves, rare edge caseshttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P3%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
on Aug 12, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3283#event-29354942977
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3283
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3283
P3Nice to haves, rare edge caseshttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22P3%22
questionFurther information is requestedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22question%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2Affects the v2 line (2.x on main)https://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

Viewport: width=device-width


URLs of crawlers that visited me.