mrazvanalex_mpc_csharp_semantickernel

mrazvanalex_mpc_csharp_semantickernel

by mrazvanalex
Demonstrates the integration of Microsoft Semantic Kernel with OpenAI and the Model Context Protocol (MCP) Server for AI-driven applications.

Semantic Kernel Integration with OpenAI and MCP Server

Overview

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.

Prerequisites

Before running the sample, ensure you have the following:

  • SMTP Email Server: Required for the EmailTools.
  • OpenAI API Key: Obtain this from your OpenAI Developer Dashboard.

How to Run the Sample

  1. Obtain an OpenAI API Key: Use your OpenAI Developer Dashboard to get an API key.
  2. Configure AppSettings: Fill out the appsettings.json files for each project.
  3. Update Email Addresses: Modify the hardcoded dictionary in Tools/EmailTool.cs with your email list.
  4. Run the Project: The default launch settings are configured for http://localhost:5109.

AppSettings Configuration

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]>",
      "SenderName": "<AIEmailSender>",
      "Password": "<EmailPassword>",
      "Username": "<EmailUsername>"
    }
  }
}

Sending Requests

You can use tools like Postman to send requests. Here’s an example:

  • Method: POST
  • URL: https://localhost:7113/chat
  • Body:
    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]" }
};

License

This project is licensed under the MIT License.

About

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.

Resources

Activity

  • Stars: 2
  • Watchers: 1
  • Forks: 0

Languages

  • C#: 100.0%

Features & Capabilities

Categories
mcp_server model_context_protocol csharp semantic_kernel openai api_integration

Implementation Details

Stats

0 Views
2 GitHub Stars

Repository Info

mrazvanalex Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300