Writing style edits (#1024)

This commit is contained in:
Genevieve Warren 2025-11-25 13:27:39 -08:00 • committed by GitHub
commit e2a802ebdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,11 +7,11 @@ uid: httpcontext
## HTTP Context
When using the Streamable HTTP transport, an MCP server may need to access the underlying [HttpContext] for a request.
When using the Streamable HTTP transport, an MCP server might need to access the underlying [HttpContext] for a request.
The [HttpContext] contains request metadata such as the HTTP headers, authorization context, and the actual path and query string for the request.
To access the [HttpContext], the MCP server should add the [IHttpContextAccessor] service to the application service collection (typically in Program.cs).
Then any classes, e.g. a class containing MCP tools, should accept an [IHttpContextAccessor] in their constructor and store this for use by its methods.
Then any classes, for example, a class containing MCP tools, should accept an [IHttpContextAccessor] in their constructor and store this for use by its methods.
Methods then use the [HttpContext property][IHttpContextAccessor.HttpContext] of the accessor to get the current context.
[HttpContext]: https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.http.httpcontext