Title: how to get http request headers in mcp tools logic when i use streamable http mode to run mcp server ? · Issue #750 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: how to get http request headers in mcp tools logic when i use streamable http mode to run mcp server ? · Issue #750 · modelcontextprotocol/python-sdk
X Title: how to get http request headers in mcp tools logic when i use streamable http mode to run mcp server ? · Issue #750 · modelcontextprotocol/python-sdk
Description: i want to create a mcp server base on streamablehttp_stateless running mode(https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py examp...
Open Graph Description: i want to create a mcp server base on streamablehttp_stateless running mode(https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-streamablehttp-stateless/mcp_simple_...
X Description: i want to create a mcp server base on streamablehttp_stateless running mode(https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-streamablehttp-stateless/mcp_simple_...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/750
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"how to get http request headers in mcp tools logic when i use streamable http mode to run mcp server ?","articleBody":"i want to create a mcp server base on streamablehttp_stateless running mode(https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py example code), but i can not find any mothed to get http request msg in the tools logic. so how can i get the http request headers msg in the tools define function ?\n\n\u003cimg width=\"774\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/68be228e-a6a8-49a6-a589-787b0a03be11\" /\u003e","author":{"url":"https://github.com/kelify","@type":"Person","name":"kelify"},"datePublished":"2025-05-19T08:50:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/750/python-sdk/issues/750"}
| 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:a79e0db8-f969-c59a-3e92-6ef5b1f0c7f6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9A4:27DB14:665639:8B88DF:6A61111D |
| html-safe-nonce | 08801189d2c2253c970218b857f257575e957d1d0e1f5760256885e12ba5bbf7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUE0OjI3REIxNDo2NjU2Mzk6OEI4OERGOjZBNjExMTFEIiwidmlzaXRvcl9pZCI6IjQ4OTk3MDcwODU0Mjc2NDI2NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0eee7b3d69c08d22722b20e2eec65ae5fabb2506b7b41ac17963b246e4fb7cbb |
| hovercard-subject-tag | issue:3073054656 |
| 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/750/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd9955b06b6aab1149840581adaca3377bd9f4ea40e9b92f9c9c2ceaacb4a7de/modelcontextprotocol/python-sdk/issues/750 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd9955b06b6aab1149840581adaca3377bd9f4ea40e9b92f9c9c2ceaacb4a7de/modelcontextprotocol/python-sdk/issues/750 |
| og:image:alt | i want to create a mcp server base on streamablehttp_stateless running mode(https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/servers/simple-streamablehttp-stateless/mcp_simple_... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kelify |
| hostname | github.com |
| expected-hostname | github.com |
| None | f6dfd8e93b1f2b4f7bf96e6f6cd7edcd48360b75fee4f2ff9f611032fce38ec2 |
| 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 | 731b2ebd4784c28b421dc5f41abecd2dbac357f2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width