web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Issue Connection Copil...
Copilot Studio
Unanswered

Issue Connection Copilot Studio to .Net Core 9 MCP Remote Server

(3) ShareShare
ReportReport
Posted on by 10
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;
        }
    }
}
 
I have the same question (0)
  • Suggested answer
    KJ-04060340-0 Profile Picture
    20 on at
    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.
     
        <outbound>
            <base />
            <choose>
                <when condition="@(context.Request.Method == "GET" && context.Request.Url.Path.Contains("/sse") && context.Response.StatusCode == 200)">
                    <set-header name="Content-Type" exists-action="override">
                        <value>text/event-stream</value>
                    </set-header>
                </when>
            </choose>
            <find-and-replace from="/messages/?" to="https://you-api-here.azure-api.net/messages/?" />
        </outbound>

Under review

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.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard