Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - Model Context Protocol
Suggested answer

Custom connector not able to connect with MCP Server built in C# .NET SDK

(3) ShareShare
ReportReport
Posted on by

I have created an MCP Server in .NET C# SDK and deployed via Visual Studio in Azure. However, while creating the custom connection in Power App Platform, I am not able to test the connection successfully. Kindly help with correct specification for MCP Server custom connector in C# .Net Implementation. It works with MCP Inspector, VSCode GitHub Copilot in Agent mode but just not with Copilot Studio.

This is the swagger that shows up -

```
swagger: '2.0'
info:
  title: MCP Server
  description: >-
    This MCP Server will work with Streamable HTTP and is meant to work with
    Microsoft Copilot Studio
  version: 1.0.0
host: <host>.azurewebsites.net
basePath: /
schemes:
  - https
consumes: []
produces: []
paths:
  /:
    post:
      summary: MCP Server Streamable HTTP
      x-ms-agentic-protocol: mcp-streamable-1.0
      operationId: InvokeServer
      responses: {}
definitions: {}
parameters: {}
responses: {}
securityDefinitions: {}
security: []
tags: []

```

## Program.cs

```
var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddLogging();

// Register MCP actions
builder.Services.AddScoped<AnalyzeAppInsightsAction>();
builder.Services.AddScoped<TriggerUatDeploymentAction>();

// Add MCP Server with automatic action discovery
builder.Services.AddMcpServer().WithHttpTransport().WithTools<AnalyzeAppInsightsAction>().WithTools<TriggerUatDeploymentAction>();

var app = builder.Build();

// Enable MCP endpoints
app.MapMcp();

app.UseHttpsRedirection();

await app.RunAsync();

```

## Tool/Action -

```
[McpServerToolType]
public class AnalyzeAppInsightsAction
{
[McpServerTool, Description("Analyzes Application Insights.")]
public async Task<JsonElement> AppInsightsLoad(bool input, CancellationToken cancellationToken)
{
  /// code here
}
}

```
  • Suggested answer
    Romain The Low-Code Bearded Bear Profile Picture
    356 on at
    Custom connector not able to connect with MCP Server built in C# .NET SDK
    hello , did you have a look add this amazin tutorial ? Could help probably.
    How and from the custom connector there are some problem, directly try it from a copilot studio in preview mode with the official MCP mode.
     
    all source here , if it help : Community.powerplatform.com/forums/thread/?groupid=db8f53c2-767d-47d6-a1ae-fe4c828a6553
     
    :) if this post help you please click on answered it's important :)

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Copilot Studio

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 132

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 81 Super User 2025 Season 1

#3
Pablo Roldan Profile Picture

Pablo Roldan 61