Skip to content

Support auth token on MCP Inspector #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 8, 2025

Conversation

timheuer
Copy link
Contributor

@timheuer timheuer commented Aug 2, 2025

Closes #779

Enhance MCP Inspector with proxy token support

  • ✨ Add ProxyTokenParameter to McpInspectorResource
  • πŸ”§ Update AddMcpInspector method to accept proxy token
  • βœ… Implement authenticated health checks for server proxy endpoint
  • πŸ§ͺ Add tests for proxy token generation and usage

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

timheuer and others added 3 commits July 31, 2025 17:11
- πŸ”§ Bump InspectorVersion from 0.15.0 to 0.16.2
- πŸ“¦ Add inspectorVersion parameter to AddMcpInspector method
- ✨ Add ProxyTokenParameter to McpInspectorResource
- πŸ”§ Update AddMcpInspector method to accept proxy token
- βœ… Implement authenticated health checks for server proxy endpoint
- πŸ§ͺ Add tests for proxy token generation and usage
@Copilot Copilot AI review requested due to automatic review settings August 2, 2025 00:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the MCP Inspector integration with proxy token authentication support, moving away from the insecure DANGEROUSLY_OMIT_AUTH approach to proper authentication.

Key changes:

  • Add proxy token parameter support to McpInspectorResource with automatic generation or custom token acceptance
  • Replace insecure health checks with authenticated health checks for the server proxy endpoint
  • Update extension methods to handle proxy token configuration and environment variables

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
McpInspectorResource.cs Adds ProxyTokenParameter property to store authentication token
McpInspectorResourceBuilderExtensions.cs Updates AddMcpInspector method with proxy token support and authenticated health checks
CommunityToolkit.Aspire.Hosting.McpInspector.csproj Adds AspNetCore.HealthChecks.Uris package dependency
McpInspectorResourceBuilderExtensionsTests.cs Adds tests for proxy token generation and custom token usage
AppHostTests.cs Updates health check tests to use proper authentication with proxy token

if (url.Endpoint is not null)
{
var uriBuilder = new UriBuilder(url.Url);
uriBuilder.Query = $"MCP_PROXY_AUTH_TOKEN={Uri.EscapeDataString(token!)}";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmmm, interesting. This might not be the best practice right?

cc @DamianEdwards

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It definitely feels dirty. No link and defer to getting it (the link) rom console log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, this is the URI that is emitted in the console...so it's not like this surfaces a secret of sorts that isn't surfaced already.

@aaronpowell aaronpowell changed the title Update MCP Inspector version and extension method parameters Support auth token on MCP Inspector Aug 4, 2025
- πŸŽ‰ Introduced McpInspectorOptions for better configuration management
- πŸ”„ Updated AddMcpInspector methods to accept options
- πŸ› οΈ Deprecated old overloads for cleaner API
- πŸ“š Enhanced README with usage examples for new options
Copy link
Member

@aaronpowell aaronpowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the method refactor @timheuer - looks a lot cleaner now.

I'm good on the review front, just waiting on the comment from @davidfowl to see if there's any action we should take.

@aaronpowell aaronpowell merged commit c52c263 into CommunityToolkit:main Aug 8, 2025
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

McpInspector resource should not disable token authentication
3 participants