You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
Stdio类型的MCP服务
================
## 调用本质:客户端在内部使用命令行(Windows下为cmd.exe),调用MCP服务控制台程序的可执行文件。
windows下, 类似于
```cmd
cmd.exe /c "D://目录/McpServer.exe"
```
## 注意事项
1. .NET 开发的Stio程序, 客户端调用时: 一种是, 执行命令换成cmd,参数为 Studio类型的mcp服务程序可执行文件(带路径),另一种是,执行命令为 Dotnet, 参数为 Dotnet的命令及参数(dotnet 路径/mcpServer.dll或者dotnet run --project xxx.csproj)
2. 调用服务后, 很可能MCP服务进程没有自动退出, 还驻留在系统进程中, 造成后续调用失败; 特别是在开发与调试阶段, 这种情况更常见。调用失败时, 一定要先检查MCP服务进程是否还在运行, 如果还在运行, 先结束进程。
3. 可以使用`MCP C# SDK`中,提供的 `IMcpClient` 直接调用MCP服务相关功能(连接、列举工具、调用工具等); 方便开发与调试,但不建议在生产环境中使用;
4. 生产环境,使用 `Microsoft.Extensions.AI` 、`Microsoft.SemanticKernel`等AI库, 进行调用;