Skip to content
Merged
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
6 changes: 5 additions & 1 deletion mcpserver/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

var tenantId = Environment.GetEnvironmentVariable("TW_ENTRA_TENANT_ID") ?? "";
var audience = Environment.GetEnvironmentVariable("TW_ENTRA_AUDIENCE") ?? "";
var clientId = Environment.GetEnvironmentVariable("TW_ENTRA_CLIENT_ID") ?? "";
var mcpResource = Environment.GetEnvironmentVariable("TW_MCP_RESOURCE") ?? "";

if (string.IsNullOrWhiteSpace(tenantId))
Expand All @@ -16,6 +17,9 @@
if (string.IsNullOrWhiteSpace(audience))
throw new InvalidOperationException("TW_ENTRA_AUDIENCE must be set to a valid Entra audience.");

if (string.IsNullOrWhiteSpace(clientId))
throw new InvalidOperationException("TW_ENTRA_CLIENT_ID must be set to the Entra app registration's client ID.");

if (string.IsNullOrWhiteSpace(mcpResource))
throw new InvalidOperationException("TW_MCP_RESOURCE must be set to the canonical URL of this MCP server (e.g. https://mcp.example.com).");

Expand Down Expand Up @@ -46,7 +50,7 @@
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidAudience = audience,
ValidAudiences = new[] { audience, clientId },
ValidIssuer = authority,
};
})
Expand Down
Loading