-
Notifications
You must be signed in to change notification settings - Fork 578
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When I remove app.UseHttpsRedirection(); the MCP server works fine but when I add HTTPS redirection it stops working even if I change the url and ports.
using Microsoft.AspNetCore;
using static Microsoft.AspNetCore.Http.StatusCodes;
// var builder = WebApplication.CreateSlimBuilder(args);
var builder = WebApplication.CreateBuilder(args);
builder.Services.Configure<ApplicationSettings>(builder.Configuration.GetSection("MyConfig"));
builder.Services.AddControllers();
builder.Services.AddCors(options =>
{
options.AddDefaultPolicy(policy =>
{
policy.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
.WithExposedHeaders(["Mcp-Session-Id"]);
});
});
builder.Services.AddMcpServer()
.WithHttpTransport()
.WithToolsFromAssembly();
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseCors();
app.UseAuthorization();
app.MapControllers();
app.MapMcp("/mcp");
app.UseHttpsRedirection();
app.Run();
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working