MCP Authentication / Authorization
Updated Jul 15, 2025
Version 2.0Hi Mark Harrison (UK)ā, thanks for the samples.
I was trying to go via the Web app route and followed the http MCP samples. I was able to successfully authenticate. However, I would need the user tokens inside my MCP tools as well to extract user claims. HttpContextAccessor does not seem to be injecting properly. By any chance, have you encountered similar issue. Thanks!
Hi ... check this file https://github.com/markharrison/ColorsMCP/blob/main/ColorsMCP-HTTP-Auth/Program.cs ... lines 54 to 60. By default I have them commented out - but i used them to dump the JWT token in its entirety and/or the individual claims from the token. Its in the screenshots in the post.
Is that what you need ?