This repository demonstrates the integration of Microsoft Semantic Kernel with OpenAI and the Model Context Protocol (MCP) Server. It provides a practical example of how to leverage these technologies to build intelligent applications, such as sending emails using AI-generated content.
Before running the sample, ensure you have the following:
appsettings.json
files for each project.Tools/EmailTool.cs
with your email list.http://localhost:5109
.{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"OpenAI": {
"ApiKey": "<yourApiKey>",
"ChatModelId": "gpt-4o-mini"
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"EmailSettings": {
"SMTPServer": {
"MailPort": "465",
"MailServer": "<yourserver.com>",
"Sender": "<[email protected]>",
"SenderName": "<AIEmailSender>",
"Password": "<EmailPassword>",
"Username": "<EmailUsername>"
}
}
}
You can use tools like Postman to send requests. Here’s an example:
POST
https://localhost:7113/chat
json
{
"text": "Send an email to aFriend and tell him that you are an AI in 250 words. Tell him you're using C# to do this."
}
Replace aFriend
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]" },
{ "aFriend", "[email protected]" }
};
This project is licensed under the MIT License.
This repository serves as an example of using Microsoft Semantic Kernel with OpenAI and the MCP Server. It is not actively maintained but provides a quick sample for developers.