Token导航 LogoToken导航TokenDH.com
MCP Dotnet Sk Extensions Pro logo
开发工具未说明官方级别未说明来源级核验

MCP Dotnet Sk Extensions Pro

MCP Server

该工具将Model Context Protocol(MCP)集成到Microsoft Semantic Kernel中,使MCP工具能够作为AI功能无缝使用。

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
开发工具C#ClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

brandonArcher

提供方

brandonArcher

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

模型上下文协议语义内核

实现MCP工具作为AI功能的无缝使用。

纽吉特

模型上下文协议

](https://www.nuget.org/packages/ModelContextProtocol-SemanticKernel)

McpDotNet(已过时)

](https://www.nuget.org/packages/McpDotNet.Extensions.SemanticKernel)

概述

---
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

⚙️ 用法

使用扩展方法注册特定的MCP功能/工具

注册单个功能或工具

// 💡Stdio
await kernel.Plugins.AddMcpFunctionsFromStdioServerAsync("GitHub", "npx", ["-y", "@modelcontextprotocol/server-github"]);

// 💡SSE
await kernel.Plugins.AddMcpFunctionsFromSseServerAsync("GitHub", new Uri("http://localhost:12345"));

从Claude Desktop配置注册MCP服务器

也可以注册在Claude Desktop中注册的所有Stdio MCP服务器:

// 💡Stdio MCP Tools defined in claude_desktop_config.json
await kernel.Plugins.AddToolsFromClaudeDesktopConfigAsync(cancellationToken: cts.Token);

💻 完整标准示例

代码

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("OPENAI_API_KEY")!);

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}");

结果

Please call the echo tool with the string 'Hello Stef!' and give me the response as-is.
Echo: Hello Stef!

💻 完整SSE(服务器发送事件)示例

代码

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("OPENAI_API_KEY")!);

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()
};

var prompt = "Summarize the last 3 commits to the StefH/FluentBuilder repository.";
var result = await kernel.InvokePromptAsync(prompt, new(executionSettings)).ConfigureAwait(false);
Console.WriteLine($"\n\n{prompt}\n{result}");

结果

Summarize the last 3 commits to the StefH/FluentBuilder repository.
Here are the summaries of the last three commits to the `StefH/FluentBuilder` repository:

1. **Commit [2293880](https://github.com/StefH/FluentBuilder/commit/229388090f50a39f489e30cb535f67f3705cf61f)** (January 30, 2025)
   - **Author:** Stef Heyenrath
   - **Message:** Update README.md
   - **Details:** This commit updates the README.md file. The commit was verified and is valid.

2. **Commit [ae27064](https://github.com/StefH/FluentBuilder/commit/ae2706424c3b75613bf5625091aa2649fb33ecde)** (November 6, 2024)
   - **Author:** Stef Heyenrath
   - **Message:** Update README.md
   - **Details:** This commit also updates the README.md file. The commit was verified and is valid.

3. **Commit [53096a8](https://github.com/StefH/FluentBuilder/commit/53096a8b54a1029532425bc727fdd831e9ed0092)** (October 20, 2024)
   - **Author:** Stef Heyenrath
   - **Message:** Update README.md
   - **Details:** This commit updates the README.md file as well. The commit was verified and is valid.

All three commits involve updates to the README.md file, reflecting ongoing improvements or changes to the documentation.

📖 参考文献

  • https://modelcontextprotocol.io
  • https://github.com/PederHP/mcpdotnet
  • https://github.com/modelcontextprotocol/csharp-sdk
  • https://devblogs.microsoft.com/semantic-kernel/integrating-model-context-protocol-tools-with-semantic-kernel-a-step-by-step-guide/

目录标签

目录标签

开发工具C#ClaudeAI集成本地部署语义内核功能调用SDK

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP