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 propaga...
NET 10 introduces a new feature for developers: one-shot tool execution. If you've ever needed to quickly run a .NET tool for a CI/CD pipeline, a one-off script, or just to try something out without cluttering your system with globally installed tools, this feature is for you. What is one-shot tool execution? One-shot tool execution allows you to run .NET tools directly without installing them globally or locally on your machine. Instead of the traditional two-step process of installing and then running a tool, you can now execute it in a single command. Some use case where I think you could use this feature : CI/CD pipelines where you want clean, reproducible builds Ephemeral environments like containers or temporary build agents Quick experimentation with tools before committing to installation Scripts and automation that need specific tools without side effects The traditional way vs. one-shot execution Previously, to use a .NET tool, you'd ne...