S
StefH/McpDotNet.Extensions.SemanticKernel
Use MCP tools as Semantic Kernel functions
在 GitHub 查看 ↗链接已于 2026-11-12 核查 · HTTP 200 · 打开的是厂商自己的官网
我们没有从该仓库取到可核对的安装命令,也没有公开的远端端点。这两样都没有时,我们不出配置——编一条出来比不给更糟。 各客户端的接法 →
- 来源明细
- 收录自 abordage/awesome-mcp 榜单(我们从中收集的条目之一) · 条目类型:MCP 服务
- 收录与活跃
- 收录于 2026-11-05 · 最近见到 2026-11-14 · 共见到 10 次 · 被 10 个来源列出
- 评分构成
- 综合分 1,003 · 10 个来源 · mcp
常见问题(答案都来自我们的记录)
它适合谁 / 用来做什么?
我们把它归在这些标签下: MCP 服务。标签来自条目自身,不是我们强加的分类。
谁维护它、还在更新吗?
我们收录于 2026-11-05;最近见到 2026-11-14。这里没有"官方认证"或"质量评级"——我们只记录来源与时间。
# ModelContextProtocol.SemanticKernel
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Microsoft SemanticKernel integration for the Model Context Protocol using the csharp-sdk.
Enables seamless use of MCP tools as AI functions.
> [!NOTE]
> This project is in preview; breaking changes can be introduced without prior notice.
## 📦 NuGet packages
Stef.ModelContextProtocol.SemanticKernel |
Stef.ModelContextProtocol.Schema |
## Overview
mermaid
title: "Overview"
graph LR;
SK[Semantic Kernel 'OpenAI']
MCPClient[MCPClient 'Function Calling']
MCPServer[Local MCP Server 'server-github']
GitHub[GitHub]
SK MCPClient
MCPClient MCPServer
MCPServer GitHub
## ⚙️ Usage
Use an extension method to register a specific MCP function/tool
### Register single function or tool
csharp
// 💡Stdio
await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("GitHub", "npx", ["-y", "@modelcontextprotocol/server-github"]);
// 💡SSE
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("GitHub", new Uri("http://localhost:12345"));
### Register MCP Server(s) from Claude Desktop configuration
It's also possible to register all Stdio MCP Servers which are registered in Claude Desktop:
csharp
// 💡Stdio MCP Tools defined in claudedesktopconfig.json
await kernel.Plugins.AddToolsFromClaudeDesktopConfigAsync(cancellationToken: cts.Token);
## 💻 Full Stdio Example
### Code
csharp
var builder = Kernel.CreateBuilder();
builder.Services.AddLogging(c => c.AddDebug().SetMinimumLevel(LogLevel.Trace));
builder.Services.AddOpenAIChatCompletion(
serviceId: "openai",
modelId: "gpt-4o-mini",
apiKey: Environment.GetEnvironmentVariable("OPENAIAPIKEY")!);
var kernel = builder.Build();
// 💡 Add this line to enable MCP functions from a Stdio server named "Everything"
await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("Everything", "npx", ["-y", "@modelcontextprotocol/server-github"]);
var executionSettings = new OpenAIPromptExecutionSettings
Temperature = 0,
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
};
var prompt = "Please call the echo tool with the string 'Hello Stef!' and give me the response as-is.";
var result = await kernel.InvokePromptAsync(prompt, new(executionSettings)).ConfigureAwait(false);
Console.WriteLine($"\n\n{prompt}\n{result}");
### Result
Please call the echo tool with the string 'Hello Stef!' and give me the response as-is.
Echo: Hello Stef!
## 💻 Full SSE (Server-Sent Events) Example
### Code
csharp
var builder = Kernel.CreateBuilder();
builder.Services.AddLogging(c => c.AddDebug().SetMinimumLevel(LogLevel.Trace));
builder.Services.AddOpenAIChatCompletion(
serviceId: "openai",
modelId: "gpt-4o-mini",
apiKey: Environment.GetEnvironmentVariable("OPENAIAPIKEY")!);
var kernel = builder.Build();
// 💡 Add this line to enable MCP functions from a Sse server named "Github"
// - Note that a server must be running at the specified URL
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("GitHub", "http://localhost:12345");
var executionSettings = new OpenAIPromptExecutionSettings
Temperature = 0,
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
Enables seamless use of MCP tools as AI functions.
> [!NOTE]
> This project is in preview; breaking changes can be introduced without prior notice.
## 📦 NuGet packages
Stef.ModelContextProtocol.SemanticKernel |
Stef.ModelContextProtocol.Schema |
## Overview
mermaid
title: "Overview"
graph LR;
SK[Semantic Kernel 'OpenAI']
MCPClient[MCPClient 'Function Calling']
MCPServer[Local MCP Server 'server-github']
GitHub[GitHub]
SK MCPClient
MCPClient MCPServer
MCPServer GitHub
## ⚙️ Usage
Use an extension method to register a specific MCP function/tool
### Register single function or tool
csharp
// 💡Stdio
await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("GitHub", "npx", ["-y", "@modelcontextprotocol/server-github"]);
// 💡SSE
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("GitHub", new Uri("http://localhost:12345"));
### Register MCP Server(s) from Claude Desktop configuration
It's also possible to register all Stdio MCP Servers which are registered in Claude Desktop:
csharp
// 💡Stdio MCP Tools defined in claudedesktopconfig.json
await kernel.Plugins.AddToolsFromClaudeDesktopConfigAsync(cancellationToken: cts.Token);
## 💻 Full Stdio Example
### Code
csharp
var builder = Kernel.CreateBuilder();
builder.Services.AddLogging(c => c.AddDebug().SetMinimumLevel(LogLevel.Trace));
builder.Services.AddOpenAIChatCompletion(
serviceId: "openai",
modelId: "gpt-4o-mini",
apiKey: Environment.GetEnvironmentVariable("OPENAIAPIKEY")!);
var kernel = builder.Build();
// 💡 Add this line to enable MCP functions from a Stdio server named "Everything"
await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("Everything", "npx", ["-y", "@modelcontextprotocol/server-github"]);
var executionSettings = new OpenAIPromptExecutionSettings
Temperature = 0,
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
};
var prompt = "Please call the echo tool with the string 'Hello Stef!' and give me the response as-is.";
var result = await kernel.InvokePromptAsync(prompt, new(executionSettings)).ConfigureAwait(false);
Console.WriteLine($"\n\n{prompt}\n{result}");
### Result
Please call the echo tool with the string 'Hello Stef!' and give me the response as-is.
Echo: Hello Stef!
## 💻 Full SSE (Server-Sent Events) Example
### Code
csharp
var builder = Kernel.CreateBuilder();
builder.Services.AddLogging(c => c.AddDebug().SetMinimumLevel(LogLevel.Trace));
builder.Services.AddOpenAIChatCompletion(
serviceId: "openai",
modelId: "gpt-4o-mini",
apiKey: Environment.GetEnvironmentVariable("OPENAIAPIKEY")!);
var kernel = builder.Build();
// 💡 Add this line to enable MCP functions from a Sse server named "Github"
// - Note that a server must be running at the specified URL
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("GitHub", "http://localhost:12345");
var executionSettings = new OpenAIPromptExecutionSettings
Temperature = 0,
FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
收录徽章(可选)
想把收录标记放进 README 就复制这行,可选,不影响收录。
[](https://anclum.com/zh/s/stefh-mcpdotnet-extensions-semantickernel/)
- 来源
- awesome · https://github.com/StefH/McpDotNet.Extensions.SemanticKernel
- 按领域浏览
- MCP 服务
- 收录来源
- 10 个独立来源
- 收录于
- 今天
同类推荐
所属领域与标签
每个标签都能点进去看同类的全部条目。数字是当前库里的真实条数。