Navigation
MPC C# SemanticKernel: AI-Powered Apps | Rapid Development - MCP Implementation

MPC C# SemanticKernel: AI-Powered Apps | Rapid Development

Crush your AI work with 🚀 Microsoft Semantic Kernel, OpenAI, and MCP Server – seamless C# magic, zero drama. Build apps that think faster than your coffee does.

✨ Developer Tools
4.5(118 reviews)
177 saves
82 comments

This tool saved users approximately 5280 hours last month!

About MPC C# SemanticKernel

What is MPC C# SemanticKernel: AI-Powered Apps | Rapid Development?

This project demonstrates how to rapidly build AI-driven applications using Microsoft's Semantic Kernel framework with OpenAI integration. Built on the Model Context Protocol (MCP) C# SDK, it provides a practical starting point for developers to experiment with generating text, handling email workflows, and leveraging large language models. While maintained as a proof-of-concept, it showcases modern AI development workflows in C#.

How to Use MPC C# SemanticKernel: AI-Powered Apps | Rapid Development?

  1. Setup Credentials: Get your OpenAI API key from their developer portal and configure SMTP server details for email capabilities.
  2. Configure Settings: Update appsettings.json files for both the web app and backend server with your API keys, SMTP credentials, and logging preferences.
  3. Customize Email List: Modify the hardcoded email dictionary in EmailTool.cs to include your contacts, or refactor this into dynamic configuration for production use.
  4. Deploy & Test: Run the application locally (default port 5109) and send requests via tools like Postman to trigger AI-generated emails through endpoints like /chat.

MPC C# SemanticKernel Features

Key Features of MPC C# SemanticKernel: AI-Powered Apps | Rapid Development?

  • Immediate integration with OpenAI models like GPT-4o-Mini through Semantic Kernel
  • SMTP email workflow automation powered by AI-generated content
  • Modular configuration for separating API keys and sensitive data
  • Pre-configured development environment with logging best practices
  • Expose AI capabilities as RESTful endpoints for seamless API consumption

Use Cases of MPC C# SemanticKernel: AI-Powered Apps | Rapid Development?

Developers can leverage this framework to:

  • Create conversational chatbots that trigger real-world actions (e.g., sending emails)
  • Prototype AI-driven customer service systems with minimal setup
  • Test multi-step workflows combining LLM responses with backend services
  • Explore model context protocol standards for future-proof AI architectures
  • Build proof-of-concepts for enterprise solutions requiring C#/.NET stack

MPC C# SemanticKernel FAQ

FAQ from MPC C# SemanticKernel: AI-Powered Apps | Rapid Development?

Q: How do I update allowed recipients dynamically?
A: Replace the static dictionary in EmailTool.cs with a database or config file lookup for production environments.

Q: Can I use different LLM providers?
A: The MCP SDK foundation allows swapping models, but this sample is optimized for OpenAI's API interface.

Q: What's the purpose of the MCPServer project?
A: Acts as a backend service to handle email sending, keeping API logic separated from the frontend interface.

Q: Why the MIT License?
A: Encourages experimentation while allowing commercial use - perfect for early-stage AI prototyping.

Content

$${\color{red}This \space repository \space will \space not \space be \space maintained. \space It's \space just \space a \space quick \space sample.}$$

mpc-csharp-semantickernel

An example usage of Microsoft Semantic Kernel with OpenAI and the The official C# SDK for the Model Context Protocol which can be found at https://github.com/modelcontextprotocol/csharp-sdk

Prerequisites

A SMTP Email Server (for the EmailTools) An OpenAI ApiKey

How to run the sample

  1. Use your OpenAI Developer Dashboard to get an ApiKey.
  2. Fill out the appsettings for each separate project.
  3. The email addresses that you can send emails to are hardcoded as a dictionary inside Tools/EmailTool.cs. Update the dictionary with your email list. Feel free to make this a setting.
  4. Run the project. The default launchSettings are set to http://localhost:5109

Appsettings

WebAppMCPPoc Project

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "OpenAI": {
    "ApiKey": "<yourApiKey>",
    "ChatModelId" : "gpt-4o-mini"
  }
}

MCPServer Project

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*",
  "EmailSettings": {
    "SMTPServer": {
      "MailPort": "465",
      "MailServer": "<yourserver.com>",
      "Sender": "<[[email protected]](/cdn-cgi/l/email-protection)>",
      "SenderName": "<AIEmailSender>",
      "Password": "<EmailPassword>",
      "Username": "<EmailUsername>"
    }
  }
}

Sending Requests:

You can use a tool like postman to send requests.

Example request: POST https://localhost:7113/chat Body: { "text": "send and email toaFriend and tell him that you are an ai in 250 words. Tell him you're using C# to do this.."}

Replace {someone} with a name you have added in the EmailTool emails dictionary.

        private static readonly Dictionary<string, string> emails = new Dictionary<string, string>
        {
            { "example", "[[email protected]](/cdn-cgi/l/email-protection)" },
            { "aFriend", "[[email protected]](/cdn-cgi/l/email-protection)" }
        };

License

This project is licensed under the MIT License.

Related MCP Servers & Clients