This is a follow-up on an earlier post where I demonstrated how to build your own MCP server in C# and expose one or more MCP resources.
Today we dive a little bit deeper and look at some more advanced features you can add to your MCP server implementation.
Working with complex return types
Resources can return various types. Here are some advanced examples:
Return values from resource methods can be strings (for simple text), ReadResourceResult (for full control), or other types that the SDK automatically marshals into the appropriate format.
Dependency injection
Resources can use dependency injection to access services:
We changed our implementation to use instance methods (not static). Now we need to register the class in Program.cs:
Progress reporting
For long-running operations, you can report progress:
IProgress parameters accepting ProgressNotificationValue values enable progress reporting from resources to clients, with progress notifications propagating to the client if they included a ProgressToken in their request.

Binary resources
You can also return binary content by using a BlobResourceContents type and providing a base64 encoded version of our blob:
Remote Deployment with SSE
For remote deployment, you can use Server-Sent Events (SSE) or HTTP streaming with ASP.NET Core, enabling your MCP server to be accessible over HTTP.
First install an extra NuGet package:
dotnet add package ModelContextProtocol.AspNetCore --prerelease
Then you need to update your Program.cs:
You can now publish the server as a self-contained, ahead-of-time compiled native application, creating small executables that run without requiring the .NET runtime.
More information
If you are looking for an end-2-end example showing all the features I demonstrated, have a look at my GitHub repo:


