NuGet
NuGet 
The MockServerClient package provides an idiomatic .NET client for MockServer's control-plane REST API. The assembly and namespace are MockServer.Client. It targets .NET Standard 2.0 (compatible with .NET Framework 4.6.1+, .NET Core 2.0+, and Mono 5.4+) and .NET 8.0, and includes an on-demand binary launcher that starts MockServer without Java or Docker.
Install
.NET CLI:
dotnet add package MockServerClient
Or via PackageReference in your .csproj:
<PackageReference Include="MockServerClient" Version="7.1.0" />
Quick start
using MockServer.Client;
using MockServer.Client.Models;
using var client = new MockServerClient("localhost", 1080);
// Create an expectation
client.When(
HttpRequest.Request()
.WithMethod("GET")
.WithPath("/hello")
).Respond(
HttpResponse.Response()
.WithStatusCode(200)
.WithBody("world")
);
// Verify the request was received
client.Verify(
HttpRequest.Request().WithPath("/hello"),
VerificationTimes.AtLeastTimes(1)
);
// Reset
client.Reset();
Async API
await client.VerifyAsync(
HttpRequest.Request().WithPath("/hello"),
VerificationTimes.AtLeastTimes(1)
);
Launch MockServer from .NET
The package includes a binary launcher — no Java installation or Docker required:
using MockServer.Client;
using var launcher = MockServerBinaryLauncher.Start(port: 1080);
Console.WriteLine($"MockServer started, PID {launcher.Process?.Id}");
// ... use MockServer ...
launcher.Stop();
See Running MockServer — client library launcher for full launcher options (version pinning, cache directory, air-gapped networks).
For the full .NET client API, see MockServer clients.