OpenMcp.Client
1.0.2
dotnet add package OpenMcp.Client --version 1.0.2
NuGet\Install-Package OpenMcp.Client -Version 1.0.2
<PackageReference Include="OpenMcp.Client" Version="1.0.2" />
<PackageVersion Include="OpenMcp.Client" Version="1.0.2" />
<PackageReference Include="OpenMcp.Client" />
paket add OpenMcp.Client --version 1.0.2
#r "nuget: OpenMcp.Client, 1.0.2"
#:package OpenMcp.Client@1.0.2
#addin nuget:?package=OpenMcp.Client&version=1.0.2
#tool nuget:?package=OpenMcp.Client&version=1.0.2
OpenMcp.Client
A generic, high-performance .NET client for the Model Context Protocol (MCP).
Designed to integrate MCP Servers (like PostgreSQL, FileSystem, Web Search) into Semantic Kernel agents or standard .NET applications.
Installation
dotnet add package OpenMcp.Client
Usage with Semantic Kernel
This is the primary use case. The client is designed to be imported directly as a Plugin.
using Microsoft.SemanticKernel;
using OpenMcp.Client.Plugins;
// 1. Setup Dependency Injection (HttpClient is required)
var httpClient = new HttpClient();
var logger = LoggerFactory.Create(b => b.AddConsole()).CreateLogger<DuckDuckGoMcpClient>();
// 2. Initialize the MCP Client
var ddgClient = new DuckDuckGoMcpClient(httpClient, "http://localhost:8083", logger);
// 3. Import into Kernel
var kernelBuilder = Kernel.CreateBuilder();
kernelBuilder.Plugins.AddFromObject(ddgClient, "DuckDuckGo");
var kernel = kernelBuilder.Build();
// 4. The Agent can now use the tool automatically!
// Invoke it via the Kernel (Simulating what an Agent would do)
// Instead of calling client.SearchAsync() directly, we ask the Kernel to invoke it.
// In a full Agent scenario, the LLM would automatically select this tool and generate the arguments.
var result = await kernel.InvokeAsync("DuckDuckGo", "Search",
new KernelArguments { ["query"] = "Latest .NET 9 features" });
🛠 Available Clients
1. DuckDuckGoMcpClient
- Purpose: Web Search (Privacy focused).
- Tools:
SearchAsync,SearchNewsAsync,SearchSiteAsync,FetchPageAsync
2. FileSystemMcpClient
- Purpose: Read/Write files in a sandboxed environment.
- Tools:
ListDirectoryAsync,ReadFileAsync,WriteFileAsync
3. PostgresMcpClient
- Purpose: Query databases safely.
- Tools:
QueryDatabaseAsync,FindTablesAsync,GetTableSchemaAsync
Manual Usage
You can also use the clients directly without Semantic Kernel.
using OpenMcp.Client.Plugins;
var client = new FileSystemMcpClient(httpClient, "http://localhost:8082", logger);
// Direct call
await client.WriteFileAsync("notes.txt", "Meeting at 10 AM");
var content = await client.ReadFileAsync("notes.txt");
Configuration
The clients require a BaseUrl pointing to the running MCP Server (usually a Docker container).
- Postgres:
http://localhost:8081 - FileSystem:
http://localhost:8082 - DuckDuckGo:
http://localhost:8083
MCP server docker images
To pull and start MCP servers from docker refer to doc - https://github.com/rahulanand428/OpenMcp/blob/9b322daea2c92a7c18b28c8736405a9a9babb07b/src/README.md
- GitHub Repository: https://github.com/rahulanand428/OpenMcp
- NuGet Package: OpenMcp.Client
- Docker Hub: openmcpserver
- Documentation:
- Samples:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.SemanticKernel (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.