I have been struggling to get my sample MCP Server which is a .net core 9 web app connected as custom connector in copilot studio. I was told that the sse endpoint needs to return a fully qualified url but I do not know how to achieve this using the .net core mcp sdk and using the WithHttpTransport. Below is the code and also the output of my sse endpoint. I also do not wish to use an api gateway
I have been struggling on this for weeks now....
Program.cs
var builder = WebApplication.CreateBuilder(args);
// Register MCP server and discover tools from the current assembly
builder.Services.AddMcpServer().WithHttpTransport().WithToolsFromAssembly();
var app = builder.Build();
// Add MCP middleware
app.MapMcp();
app.Run();
using ModelContextProtocol.Server;
using System.ComponentModel;
namespace MVCSampleWebApp
{
[McpServerToolType]
public sealed class GreetingTools
{
public GreetingTools()
{
}
[McpServerTool, Description("Says Hello to a user")]
public static string Echo(string username)
{
return "Hello " + username;
}
}
}
To give you context these are my outbound policies on APIM to get over this error. I override the content type header from the response and the "/messages/?" path to the full url. My app is in python, but you could find a way to control this in your .net server too.
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.