McpProbe 0.2.0-preview

This is a prerelease version of McpProbe.
dotnet add package McpProbe --version 0.2.0-preview
                    
NuGet\Install-Package McpProbe -Version 0.2.0-preview
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="McpProbe" Version="0.2.0-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="McpProbe" Version="0.2.0-preview" />
                    
Directory.Packages.props
<PackageReference Include="McpProbe" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add McpProbe --version 0.2.0-preview
                    
#r "nuget: McpProbe, 0.2.0-preview"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package McpProbe@0.2.0-preview
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=McpProbe&version=0.2.0-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=McpProbe&version=0.2.0-preview&prerelease
                    
Install as a Cake Tool

McpProbe

CI NuGet License: MIT

Test kit for MCP servers built with the MCP C# SDK.

  • In-memory host. Start your server in the test process and get a connected McpClient. No ports, no child processes.
  • Assertions for tools, tool results (text, images, structured output, errors), prompts and resources.
  • Tool surface snapshots. Commit mcp-tools.json, and the test fails when a change would break existing clients.
  • Lint rules for tool names, descriptions and parameters.
  • mcpprobe CLI that runs the snapshot and lint checks against any MCP server over stdio or HTTP, for CI.

Works with any test framework: failures are plain McpProbeAssertionExceptions. Targets .NET 8 and .NET 10, on ModelContextProtocol 2.4.0.

Status: 0.2.0-preview on NuGet. The API may change before 1.0.

Quickstart

dotnet add package McpProbe --prerelease
using McpProbe;
using McpProbe.Assertions;
using Microsoft.Extensions.DependencyInjection; // WithTools<T>()

[Fact]
public async Task Forecast_works()
{
    await using var probe = await McpProbeHost.StartAsync(mcp => mcp.WithTools<WeatherTools>());

    var tools = await probe.Client.ListToolsAsync();
    McpAssert.That(tools).ContainsTool("get_forecast").HasParameter("city", type: "string", required: true);

    var result = await probe.Client.CallToolAsync("get_forecast", new Dictionary<string, object?> { ["city"] = "Paris" });
    McpAssert.That(result).Succeeded().HasStructuredValue("city", "Paris");
}

StartAsync takes the same IMcpServerBuilder you configure in Program.cs, so put your WithTools/WithPrompts/WithResources calls in one extension method and share it (see samples/WeatherServer). Register your own services with McpProbeHostOptions.ConfigureServices.

Assertions

Every assertion returns the same object, so you can chain them. Failures throw McpProbeAssertionException with a message that says what was expected and what was there.

McpAssert.That(tools).ContainsTool("delete_file").HasDestructiveHint().DoesNotHaveParameter("force");
McpAssert.That(result).Failed("Unknown city");
McpAssert.That(result).HasTextContent("sunny", StringComparison.OrdinalIgnoreCase);
McpAssert.That(result).HasImageContent("image/png");
McpAssert.That(result).HasStructuredValue("days[0].high", 26);
McpAssert.That(prompts).ContainsPrompt("plan_trip").HasArgument("city", required: true);
McpAssert.That(resources).ContainsResource("weather://cities").HasMimeType("text/plain");

Snapshot workflow

[Fact]
public Task Tool_surface_matches_snapshot() => probe.VerifyToolSnapshotAsync();
  1. The first run writes mcp-tools.json next to the test file and fails, so you look at it. Commit it.
  2. Later runs compare the live tool surface with the file:
    • Breaking changes fail the test: removed tool, removed parameter, newly required parameter, narrowed type or enum, tighter input constraints (minimum, maxLength, minItems, multipleOf, a new or changed pattern, ...), and removed or narrowed output fields. A removed parameter that looks renamed gets a hint.
    • Non-breaking changes pass: added tools, optional parameters, descriptions, annotations, widened types, looser input constraints. They are in the returned ToolSurfaceDiff, and SnapshotOptions.Log gets a report (for example Log = output.WriteLine with xUnit's ITestOutputHelper).
    • Local $refs (#/$defs/..., #/definitions/..., and the #/properties/... refs the C# SDK emits for recursive types) are followed, so a change inside a referenced schema is classified like an inline one.
    • Schema keywords McpProbe doesn't classify yet (such as format or uniqueItems) are reported as non-breaking, marked "review by hand".
  3. On a failure, the current surface is written to mcp-tools.received.json. To accept the change, run with MCPPROBE_UPDATE_SNAPSHOTS=1 (or set SnapshotOptions.Update), review the diff in git, and commit.

On CI (CI or TF_BUILD set), a missing snapshot is not created: the test fails. Set SnapshotOptions.FailOnNonBreakingChanges to fail on every change.

Example failure:

Tool surface changed: 1 breaking, 2 non-breaking.

Breaking:
  - get_forecast: Parameter 'days' type changed from string to integer. [input.days]

Non-breaking:
  ~ get_alerts: Tool was added.
  ~ get_forecast: Parameter 'days' became optional. [input.days]

Lint rules

var report = await probe.LintToolsAsync();
report.ThrowIfFailed(); // fails on warnings and errors by default
Id Default Checks
MCPP001 error The tool has a description.
MCPP002 warning The description is at least MinToolDescriptionLength (20) characters.
MCPP003 warning Every parameter has a description.
MCPP004 warning The tool name is 1-128 characters of A-Z a-z 0-9 _ - ..
MCPP005 warning All tool names use the same style (snake_case, camelCase, ...).
MCPP006 warning All parameter names use the same style.
MCPP007 info Parameter names aren't vague (data, value, input, ...).

Change severities with LintOptions.Severities["MCPP007"] = LintSeverity.None, and the threshold with LintOptions.FailOn. By default MCPP003, MCPP006 and MCPP007 check top-level parameters. Set LintOptions.CheckNestedParameters = true (CLI: mcpprobe lint --nested) to also check nested object properties and array items (reported as home.zip or stops[].city), following local $refs; a schema used in several places is checked once.

CLI in CI

dotnet tool install --global McpProbe.Cli --prerelease

mcpprobe snapshot --stdio "dotnet run --project src/MyServer" --out mcp-tools.json   # once, then commit
mcpprobe diff     --stdio "dotnet run --project src/MyServer" --baseline mcp-tools.json
mcpprobe lint     --http https://localhost:5001/mcp --header "Authorization: Bearer $TOKEN"

Exit codes: 0 passed, 1 check failed (breaking change or lint findings), 2 usage or connection error. The server's stderr is printed when it fails to start.

GitHub Actions step:

- name: Check MCP tool surface
  run: |
    dotnet tool install --global McpProbe.Cli --prerelease
    mcpprobe diff --stdio "dotnet run --project src/MyServer -c Release" --baseline mcp-tools.json
    mcpprobe lint --stdio "dotnet run --project src/MyServer -c Release"

diff and lint also take --from-file <snapshot> to check a file without starting a server. Run mcpprobe <command> --help for every option.

Snapshot file format

{
  "formatVersion": 1,
  "tools": [
    { "name": "get_forecast", "description": "...", "inputSchema": { }, "outputSchema": { }, "annotations": { } }
  ]
}

Tools are sorted by name and JSON keys are sorted, so diffs stay small. Comparison is semantic: formatting and line endings don't matter.

Limitations

  • Only local $refs are followed. Remote refs, $anchor/$id refs and $dynamicRef are compared as plain keywords, and so is $defs when such a ref is present.
  • allOf, anyOf and oneOf aren't walked; changes inside them are reported as unclassified keyword changes.
  • Two different patterns can't be compared, so any change to one counts as breaking. format, uniqueItems, const and additionalProperties aren't classified yet.
  • The test suite in this repo uses xUnit v3. The quickstart was also run once by hand with NUnit 4, MSTest 4 and TUnit 1.87 against the packed library; those checks aren't part of CI yet.

Contributing

See CONTRIBUTING.md. License: MIT.

Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-preview 0 11/27/2026
0.1.0-preview 0 11/27/2026