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
Domain: github.com
{"@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-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:4893f5b0-9063-2714-5bd4-0d3f4672caef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDF0:6B887:93224:C1C8D:6B00B902 |
| html-safe-nonce | cefdde28aca618b6b09095768b01962340e1ef450ea15ce479cad22bd2e4e391 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREYwOjZCODg3OjkzMjI0OkMxQzhEOjZCMDBCOTAyIiwidmlzaXRvcl9pZCI6IjI3MTgzMzQ1NjkyMTk2NjgyMjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0b89b9d19d83ac4e42da57bc5f13f6b6c44bc686f2d4f3385ded9e4ed002824f |
| hovercard-subject-tag | issue:5120491596 |
| 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/3283/issue_layout |
| twitter:image | https://opengraph.githubassets.com/12c6ee404acc31a780e2d64fe3d363a83f0f7d3118d9e67795c0099957f9c71e/modelcontextprotocol/python-sdk/issues/3283 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/12c6ee404acc31a780e2d64fe3d363a83f0f7d3118d9e67795c0099957f9c71e/modelcontextprotocol/python-sdk/issues/3283 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | saurabhlalsaxena |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2 |
| 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 | 5429cbfc6aca8c7b9a086a3c8f47400346f38cc9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width