AI

Build and Secure a C# MCP Server with .NET 11 and Duende IdentityServer

Duende Software Blog Khalid Abuhakmeh
AI

Opening application features to AI agents is simpler than ever with Model Context Protocol (MCP). This guide details the technical steps and OAuth 2.0 integration to set up a secure C# MCP server using .NET 11 and Duende IdentityServer.

Key points

  • .NET 11 SDK now natively supports the 'mcpserver' template.
  • The mental model of a web API applies directly to MCP tools.
  • OAuth 2.0 must be used to secure any publicly exposed MCP server.
  • Access control is implemented using the 'mcp:tools' scope in Duende IdentityServer.
  • JWT Bearer is configured in ASP.NET Core along with resource metadata.
  • Transitioning from standard (stdio) to remote (HTTP) transport is possible.

Real-world use

  • .Exposing tools for integration with a .NET-based AI agent.
  • Preventing unauthorized access of MCP tools by external agents.
  • Using standard OAuth authentication for enterprise MCP server endpoints.

This summary was generated by the agent from the original post on Duende Software Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message