Skip to content

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

Merged
merged 3 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static IResourceBuilder<McpInspectorResource> AddMcpInspector(this IDistr
.WithEnvironment("DANGEROUSLY_OMIT_AUTH", "true")
.WithHttpHealthCheck("/", endpointName: McpInspectorResource.ClientEndpointName)
.WithHttpHealthCheck("/config", endpointName: McpInspectorResource.ServerProxyEndpointName)
.WithEnvironment("MCP_AUTO_OPEN_ENABLED", "false")
.WithUrlForEndpoint(McpInspectorResource.ClientEndpointName, annotation =>
{
annotation.DisplayText = "Client";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;

namespace CommunityToolkit.Aspire.Hosting.McpInspector.Tests;

Expand Down Expand Up @@ -29,6 +30,11 @@

var annotations = inspector.Resource.Annotations;
Assert.Contains(ManifestPublishingCallbackAnnotation.Ignore, annotations);

// Assert that MCP_AUTO_OPEN_ENABLED is set to false
var envAnnotations = inspectorResource.Annotations.OfType<EnvironmentVariableAnnotation>();

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / run-tests / Hosting.McpInspector.Tests-ubuntu-latest

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / run-tests / Hosting.McpInspector.Tests-ubuntu-latest

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / run-tests / Hosting.McpInspector.Tests-windows-latest

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / run-tests / Hosting.McpInspector.Tests-windows-latest

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type or namespace name 'EnvironmentVariableAnnotation' could not be found (are you missing a using directive or an assembly reference?)
var autoOpenEnvVar = Assert.Single(envAnnotations, e => e.Name == "MCP_AUTO_OPEN_ENABLED");
Assert.Equal("false", autoOpenEnvVar.Value);
}

[Fact]
Expand Down
Loading