Title: Question: How to authorise a client with Bearer header with SSE? · Issue #431 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Question: How to authorise a client with Bearer header with SSE? · Issue #431 · modelcontextprotocol/python-sdk
X Title: Question: How to authorise a client with Bearer header with SSE? · Issue #431 · modelcontextprotocol/python-sdk
Description: I am building the MCP server application to connect some services to LLM . One of things i want to implement is authorisation of a user with the token. I see it must be possible somehow. Because MCP inspector has the Authentification and...
Open Graph Description: I am building the MCP server application to connect some services to LLM . One of things i want to implement is authorisation of a user with the token. I see it must be possible somehow. Because MC...
X Description: I am building the MCP server application to connect some services to LLM . One of things i want to implement is authorisation of a user with the token. I see it must be possible somehow. Because MC...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/431
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Question: How to authorise a client with Bearer header with SSE?","articleBody":"I am building the MCP server application to connect some services to LLM . \nOne of things i want to implement is authorisation of a user with the token.\n\nI see it must be possible somehow. Because MCP inspector has the Authentification and Bearer Token field\n\nMost of tutorials about MCP are related to STDIO kind of a server run. My will be SSE.\n\nThere is my code:\n\n```\nfrom mcp.server.fastmcp import FastMCP\nfrom fastapi import FastAPI, Request, Depends, HTTPException\n\napp = FastAPI()\nmcp = FastMCP(\"SMB Share Server\")\n\n@mcp.tool()\ndef create_folder(parent_path: str, name: str) -\u003e str:\n \"\"\"Create new subfolder in the specified path\"\"\"\n return f\"Folder {name} created in {parent_path}\"\n\napp.mount(\"/\", mcp.sse_app())\n```\n\nHow can i read Authorization header in case if it is sent by the client?\n\nI tried to use approaches of FastAPI - setting dependency, adding request:Request to arguments but this doesn't work.\n\nIs there a way?","author":{"url":"https://github.com/Gelembjuk","@type":"Person","name":"Gelembjuk"},"datePublished":"2025-04-04T21:22:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/431/python-sdk/issues/431"}
| 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:9d95edcb-1704-4785-f963-de884c2eda3e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B7D8:151940:133FC02:1B92904:6A5A226C |
| html-safe-nonce | f8791940031311804165988a1acfc2fc2ec4aac3162061f212c615738b1605e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0Q4OjE1MTk0MDoxMzNGQzAyOjFCOTI5MDQ6NkE1QTIyNkMiLCJ2aXNpdG9yX2lkIjoiOTA1Njc5MzUzMTY1NTAwNDc4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ef6712cec87c8d4b8ff1b0189dade0d70020db61c65e9e2fc652cc409e7eb80 |
| hovercard-subject-tag | issue:2973391673 |
| 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/431/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cb0cf089093de7ddacb0dc6cce34ba040f2e4374ba565a123fda856e6cb6d6f7/modelcontextprotocol/python-sdk/issues/431 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cb0cf089093de7ddacb0dc6cce34ba040f2e4374ba565a123fda856e6cb6d6f7/modelcontextprotocol/python-sdk/issues/431 |
| og:image:alt | I am building the MCP server application to connect some services to LLM . One of things i want to implement is authorisation of a user with the token. I see it must be possible somehow. Because MC... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Gelembjuk |
| hostname | github.com |
| expected-hostname | github.com |
| None | e31742e80bbd077fd5679c13ed870ce4e0c13803a2fa5beaae557b6769de2c8a |
| 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 | c9fcdbf98c619d1561ed843fa01d9766a32b5cd9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width