Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -1,23 +1,24 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5230",
"applicationUrl": "https://localhost:7295;http://localhost:5230",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7295;http://localhost:5230",
"applicationUrl": "http://localhost:5230",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,17 @@ internal void AddMcpServer(IResourceWithEndpoints mcpServer, bool isDefault, Mcp
throw new InvalidOperationException($"The MCP server {mcpServer.Name} is already added to the MCP Inspector resource.");
}

if (!mcpServer.TryGetEndpoints(out var endpoints) || !endpoints.Any())
{
throw new InvalidOperationException($"The MCP server {mcpServer.Name} must have at least one endpoint defined.");
}

McpServerMetadata item = new(
mcpServer.Name,
mcpServer.GetEndpoint("https") ?? mcpServer.GetEndpoint("http") ?? throw new InvalidOperationException($"The MCP server {mcpServer.Name} must have an 'https' or 'http' endpoint defined."),
mcpServer.GetEndpoint(
endpoints.FirstOrDefault(e => e.Name == "https")?.Name
?? endpoints.FirstOrDefault(e => e.Name == "http")?.Name
?? endpoints.First().Name),
transportType,
path);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,7 @@ public void WithMcpServerSupportsHttpsEndpoint()
var appBuilder = DistributedApplication.CreateBuilder();

// Create a mock MCP server resource with https endpoint (uses name "https")
var mockServer = appBuilder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_McpInspector_McpServer>("mcpServer")
.WithHttpsEndpoint(name: "https");
var mockServer = appBuilder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_McpInspector_McpServer>("mcpServer");

// Act
var inspector = appBuilder.AddMcpInspector("inspector")
Expand Down Expand Up @@ -448,8 +447,7 @@ public void WithMcpServerPrefersHttpsOverHttp()

// Create a mock MCP server resource with both https and http endpoints
// AddProject creates "http" by default, we add "https" with explicit name
var mockServer = appBuilder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_McpInspector_McpServer>("mcpServer")
.WithHttpsEndpoint(name: "https");
var mockServer = appBuilder.AddProject<Projects.CommunityToolkit_Aspire_Hosting_McpInspector_McpServer>("mcpServer");

// Act
var inspector = appBuilder.AddMcpInspector("inspector")
Expand Down
Loading