-
Notifications
You must be signed in to change notification settings - Fork 110
Fix MCP Inspector auto-opening browser when using aspire run #789
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
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
aspire run
There was a problem hiding this 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 fixes an issue where the MCP Inspector integration was automatically opening a browser during aspire run
due to the underlying npm package's default behavior. The solution adds an environment variable to disable this auto-opening functionality.
- Adds
MCP_AUTO_OPEN_ENABLED=false
environment variable to prevent automatic browser opening - Enhances existing test to validate the environment variable is properly configured
- Adds required using statement for test validation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/CommunityToolkit.Aspire.Hosting.McpInspector/McpInspectorResourceBuilderExtensions.cs |
Adds environment variable to disable auto-opening browser |
tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs |
Adds test validation and required using statement |
Comments suppressed due to low confidence (1)
tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs:35
- The variable
inspectorResource
is not defined in this scope. It should beinspector.Resource
to match the existing pattern in the test.
var envAnnotations = inspectorResource.Annotations.OfType<EnvironmentVariableAnnotation>();
Minimum allowed line rate is |
The MCP Inspector integration was automatically opening a browser when running
aspire run
due to theMCP_AUTO_OPEN_ENABLED
environment variable defaulting totrue
in the underlying npm package.This change adds the environment variable
MCP_AUTO_OPEN_ENABLED=false
to the MCP Inspector resource configuration to prevent automatic browser opening during development workflows.Changes Made
.WithEnvironment("MCP_AUTO_OPEN_ENABLED", "false")
to theAddMcpInspector
method inMcpInspectorResourceBuilderExtensions.cs
Aspire.Hosting.ApplicationModel
Testing
The existing test
AddMcpInspectorWithDefaultsAddsResource
has been enhanced to verify that theMCP_AUTO_OPEN_ENABLED
environment variable is properly set to"false"
.Fixes #788.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
dnceng.pkgs.visualstudio.com
dotnet build src/CommunityToolkit.Aspire.Hosting.McpInspector/
(dns block)dotnet test tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/ --verbosity normal
(dns block)dotnet workload install aspire
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.