Skip to content

Commit de3508d

Browse files
committed
Fix MCP server resource uri when working with sub path
1 parent 942f3d4 commit de3508d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Dibix.Http.Host/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ void ConfigureLogging(ILoggingBuilder logging)
137137
else
138138
{
139139
string externalHostname = hostingOptions.ExternalHostName ?? throw new InvalidOperationException($"Property not configured: {hostingConfigurationSection.Key}:{nameof(hostingOptions.ExternalHostName)}");
140-
resource = new Uri($"https://{externalHostname}{hostingOptions.ApplicationBaseAddress ?? "/"}");
140+
resource = new Uri($"https://{externalHostname}{hostingOptions.ApplicationBaseAddress?.TrimEnd('/')}/");
141141
}
142142

143143
x.ResourceMetadata = new ProtectedResourceMetadata
144144
{
145-
Resource = new Uri(resource, new Uri(mcpPath, UriKind.Relative)),
145+
Resource = new Uri(resource, new Uri(mcpPath.TrimStart('/'), UriKind.Relative)),
146146
AuthorizationServers = { new Uri(authenticationOptions.Authority) },
147147
ScopesSupported = ["openid"],
148148
ResourceName = $"{hostingOptions.EnvironmentName ?? "Dibix"} MCP Server",

0 commit comments

Comments
 (0)