Get the FREE Ultimate OpenClaw Setup Guide →

McpDotNet.Extensions.SemanticKernel

Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio stefh-mcpdotnet.extensions.semantickernel docker run -i stefh/mcpdotnet.extensions.semantickernel

How to use

This MCP server provides an integration layer between Microsoft Semantic Kernel and the Model Context Protocol using the Stef.ModelContextProtocol.SemanticKernel package. It enables MCP tools to be invoked as AI functions inside Semantic Kernel workflows, allowing you to register MCP-defined tools and call them from prompts or orchestration code. You can register MCP functions from a Stdio or SSE server, or pull configuration from Claude Desktop, so that your Semantic Kernel prompts can offload function calls to the MCP server seamlessly. The typical pattern is to register a MCP server as a plugin, then invoke prompts that delegate specific tasks (like GitHub interactions or echo tooling) to those MCP-backed functions, with results returned to the kernel for further processing or completion.

How to install

Prerequisites:

  • .NET SDK installed and available on PATH for building or consuming the NuGet package
  • A C# project where you want to integrate MCP functions, or a sample project that demonstrates Kernel usage

Installation steps:

  1. Create or open your C# project (e.g., a .NET console app).
  2. Add the NuGet packages: dotnet add package Stef.ModelContextProtocol.SemanticKernel dotnet add package Stef.ModelContextProtocol.Schema
  3. Initialize Semantic Kernel in your code and configure MCP function registration (examples below).
  4. If you plan to run the MCP functionality via a Docker image, ensure Docker is installed and running on your machine, then use a container command such as the provided docker run approach to start the MCP server in the background and reference its URL/endpoint from your code.

Example snippet (C#) to register MCP functions from an MCP server: // Using the Semantic Kernel extensions await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("YourServerName", "npx", ["-y", "@modelcontextprotocol/server-github"]);

Example snippet to register via SSE: await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("YourServerName", new Uri("http://localhost:12345"));

Note: The exact commands may differ depending on how you host the MCP server (Stdio, SSE, Claude Desktop, etc.). Refer to the README examples for the precise method names and options.

Additional notes

Tips and considerations:

  • This MCP integration is in preview; there may be breaking changes in future releases.
  • When running servers via Stdio or SSE, ensure the MCP server is reachable at the expected command or URL.
  • If you host the MCP server in Docker, expose the necessary network ports and update your kernel configuration to point to the container endpoint.
  • Environment variables used by your underlying AI models (e.g., OPENAI_API_KEY) should be configured in the hosting application or container environment.
  • The NuGet packages you may rely on include Stef.ModelContextProtocol.SemanticKernel for MCP integration and Stef.ModelContextProtocol.Schema for schema support.

Related MCP Servers

Sponsor this space

Reach thousands of developers